Can't locate wxWidgets app with EnumWindows()/EnumDesktopWindows()

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
Experienced Solver
Experienced Solver
Posts: 63
Joined: Thu May 26, 2016 9:19 pm

Can't locate wxWidgets app with EnumWindows()/EnumDesktopWindows()

Post by bsenftner » Wed Aug 22, 2018 2:57 am

I have a wxWidgets application I want to periodically check is running. I believe the method to do this on Windows is with a Service.

I am using a minimally modified version of the "A basic Windows service in C++" sample, located here: ... e-cacf4948

The Service compiles and runs fine. At this point, the Service is just the Service skeleton provided by that sample. I'm trying to add logic that locates my wxWidgets application, but am having zero luck...

I have tried both EnumWindows() and EnumDesktopWindows() with different Service Users ("LocalSystem", "NT AUTHORITY\\LocalService", & my own account) and in every case a series of window names are generated, but no where near the actual number of desktop windows I have, and never my wxWidgets application.

I actually have one other wxWidgets app running, multiple Google Chrome browser windows, multiple ms windows cmd shells, Visual Studio, Outlook, Skype, the Event Lister, and Notepad++ (not to mention 6 different File Browser windows) and NONE of these show up in any cases of my Service's call to EnumWindows() or EnumDesktopWindows().

When trying with Service Users "LocalSystem" or "NT AUTHORITY\\LocalService" I do set the Service to interact with the desktop. Makes no difference...

I have some log messages:
Just entered wmain.

Attempting Service Start...




window title: Windows Push Notifications Platform, window class: PushNotificationsPowerManagement

window title: CWNPTransportImpl, window class: WNPGeneric

window title: DeviceMsgListenerWnd, window class: DeviceMsgListenerWndCls

window title: CWNPTransportImpl, window class: WNPGeneric

window title: OfficePowerManagerWindow, window class: OfficePowerManagerWindow

GetWindowTextLength() returned 0! Window class: IpOverUsbDeviceNotificationWindowClass

window title: NvContainerWindowClass00000B38, window class: NvContainerWindowClass00000B38

window title: HID Input Service, window class: HidServClass

CServiceBase::Start: I think we're running!!!
Where you see "window title:" that is the output from EnumDesktopWindows(). I get the same listing from EnumWindows(). Of those 8 "windows" listed, none are my desktop applications. So, I'm confused...

Anyone have any ideas here?

User avatar
Posts: 14519
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Can't locate wxWidgets app with EnumWindows()/EnumDesktopWindows()

Post by doublemax » Wed Aug 22, 2018 5:06 am

First of all: Try the code from inside a "normal" application instead of a service. Just to make sure that that's not the reason.

I don't know why you don't see the wx windows (maybe you should have posted the code for the searching), but maybe getting a list of running processes does also work for your purpose:
Use the source, Luke!

Post Reply