-
April 16th, 2012, 05:37 PM
#1
How to sense a display change from a NT Service
I am migrating an unmanaged C++ application from a windowed GUI app to a NT Service.
If there is a change in the display resolution, it sends some information to some specialized hardware.
From a Windows App, I just trap WM_DISPLAYCHANGE and deal with it there.
But for a NT Service, I cannot find a way to get to that message.
The SERVICE_CONTROL_... messages don't seem to cover these types of events.
-
April 16th, 2012, 06:34 PM
#2
Re: How to sense a display change from a NT Service
The problem is there could be multiple users in the system, so the service might have problems knowing which user to track.
Given that, I would approach the problem as a client/server app, where the client is a tray app that runs under the user you wish it to run under (or multiple users). The client app would use some form of interprocess communication (or COM) to communicate with the NT service.
ATL makes a great project template for this sort of thing. You can create an NT service that hosts a COM server. The COM server could be called by your client app.
-
April 16th, 2012, 08:15 PM
#3
Re: How to sense a display change from a NT Service
The SERVICE_CONTROL_... messages don't seem to cover these types of events.
Service lives in its own session and window station. Therefore, it has its own display and lives its own GUI life. Besides, the display change is applied to a session only, and never crosses the bounds. As Arjay said, there might be several user sessions running simultaneously. It would be a shame to have foreign setting applied to your display.
Best regards,
Igor
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|