Windows services typically run in non-interactive session 0. Interactive applications run in other sessions and generally will not receive window message broadcasts from sessions other than their own. One workaround would be to start a process in the user's interactive session that broadcasts the WM_DEVICECHANGE message. If your service is running as SYSTEM you can get the user's token with WTSQueryUserToken and then start the process with CreateProcessAsUser
BroadcastSystemMessage function issue while using in a Service module
Hi,
First of all sorry if this is not the right forum for this question. If so, please guide me to the forum where I can post this query.
I am doing a prototype where I need to Broadcast "WM_DEVICECHANGE" message to all applications (specifically to those who are working with camera, like skype/teams etc) running on my pc.
I am registering a direcshow camera device (my custom dll) using regsvr32 command on my pc. Once it is registered successfully I broadcast this message to all app from my desktop application (say as Notifier.exe) and they update their camera list immediately.
This solution works fine till I do it from desktop application. But if I am doing it from a service module then, even though BroadcastSystemMessage() returns success, it is not working correctly (I mean skype/teams dont get notified with this message as their list is not updated).
If I launch my notifier.exe from this service app (using createprocess() or shellexecute()) then also it doesn't work correctly.
I understand service have some other privileges/restriction for some operation, and probably launching any app from a service module might require some more settings/configuration to do, but I am unbale to find that.
So can anyone suggest how can I overcome this issue.
Thanks.