HWND window;
char name[MAX_PATH];
while(1)
{
window =
GetForegroundWindow();
GetWindowText(window,name,sizeof(name));
strcat(name
, "\n");
printf("%s\n",name);
Sleep(1000);
}
//end of test
Some definition:
GetForegroundWindow Function
Retrieves a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.Syntax
HWND
WINAPI GetForegroundWindow(void);
ParametersThis function has no parameters.Return Value
HWND
The return value is a handle to the foreground
window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation.Source: http://msdn.microsoft.com/en-us/library/ms633505(VS.85).aspx
2. Better to find another efficient way other than Polling to detect the Foreground Process. Also have to get the process name from the handel.
3. Agree to write the device driver first on a linux device, and next to the Android device using their SDK suite
4. Start exploring WinUSB API, to find if it will be possible to write the USB device driver on Windows using this API
5. Next Meeting date: August 5, 2010
No comments:
Post a Comment