winapi - WTSRegisterSessionNotification doesn't work sometimes on startup with XP home -
I am using the function / message to check whether the workstation is locked. Now my application is in the startup folder, it worked without any problem on XP pro, but since I'm using XP program on XP, WTSRegisterSessionNotification fails at approximately 50% time at startup, but it never fails Does not happen when the system is already booted. Why can any one think?
On XP, the services start in the background and do not block boot or log on to . TermsRv service is likely to not run when you call WTSRegisterSessionNotification.
You can check whether service is run by:
// Error handling for brevity SC_HANDLE Scm = OpenSCManager (NULL, NULL, GENERIC_READ ); SC_HANDLE svc = OpenService (scm, L "TermSrv", SERVICE_QUERY_STATUS); SERVICE_STATUS status; QueryServiceStatus (svc, and status); If trying to start (status.dwCurrentSTate! = SERVICE_RUNNING) {//, try again, etc.} CloseServiceHandle (svc); CloseServiceHandle (SCM);
Comments
Post a Comment