Catch Dialog Win at Login Screen

Started by
4 comments, last by ChaoticCanuck 19 years, 7 months ago
Hi, I'm trying to use Visual C++ to create a service that logs Windows Dialog Messages. The service works great when someone is logged on to the system. However, it will not work at the login screen. Hence, a Win warning message window won't be caught if it appears at the login screen. My original method uses FindWindow and GetText to work. However, it only works when a desktop is available. I recently found that no desktop exists at login screen. Any ideas around this? Can I catch an assert message generated by another app??
Advertisement
sounds dubious

edit: you can delete your other thread by editing the original post and checking the 'delete' box.
As far as I know, theres no way around this. At the login screen, theres no user logged in, and the system is in a different state. I wasn't aware that FindWindow() needed a dekstop however...

What do you need to read dialogs at the login screen for anyway?
The problem comes from another app. The Window generates a warning message when the app dumps (like on a divide by zero). The app was ment to restart itself but will not because the Windows does not allow the app to exit out until the dialog message is acknowledged by clicking OK. The app does not generate the dialog itself on purpose, but windows detects a problem inside it and brings it down. I thought about detecting the problem inside the app itself but it's in an unstable state when the error happens. Besides, there could be more problems which forces windows to create a dialog message. I want the app to be constantly running. If an error internally causes a Window dialog, I want the app to make a note of it and restart itself. The app is always running regardless of user login. Detecting it from a service seemed the easiest way.
Can't you just fix the bug in this other program?
Here is an example of how to walk through existing window stations, desktops, and windows within those desktops.

Hope it helps.

#include <windows.h>/* Enumerator Functions */BOOL WINAPI WindowStationEnumerator(LPTSTR, LPARAM);BOOL WINAPI DesktopEnumerator(LPTSTR, LPARAM);BOOL WINAPI DesktopWindowEnumerator(HWND, LPARAM);intmain(int argc, char *argv[]){		EnumWindowStations(&WindowStationEnumerator, NULL);}BOOL WINAPI WindowStationEnumerator(LPTSTR lpszWindowStation, LPARAM lParam){	HWINSTA hStation;	hStation = OpenWindowStation(lpszWindowStation, 0, GENERIC_ALL);	if (hStation) {		EnumDesktops(hStation, &DesktopEnumerator, NULL);		CloseWindowStation(hStation);		return TRUE;	}	return TRUE;}BOOL WINAPI DesktopEnumerator(LPTSTR lpszDesktop, LPARAM lParam){	HDESK hDesktop;	hDesktop = OpenDesktop(lpszDesktop, 0, 0, GENERIC_ALL);	if (hDesktop) {		EnumDesktopWindows(hDesktop, &DesktopWindowEnumerator, NULL);		CloseDesktop(hDesktop);		return TRUE;	}	return TRUE;}BOOL WINAPI DesktopWindowEnumerator(HWND hWnd, LPARAM lParam){	// Do something interesting with windows found here!	return TRUE;	}


This topic is closed to new replies.

Advertisement