Advertisement
Advertisement
| 05.19.2008 at 05:11PM PDT, ID: 23415574 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: |
DECLDIR LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode == HC_ACTION){
CWPSTRUCT *msg = reinterpret_cast<CWPSTRUCT *>(lParam);
if(msg->message == WM_ACTIVATEAPP){
struct appActiveEvent *notification = (struct appActiveEvent*)malloc(sizeof(appActiveEvent));
if(msg->wParam){
notification->pid = GetCurrentProcessId();
DWORD bufSz = sizeof(notification->appName);
if( GetModuleFileName(NULL, notification->appName, bufSz) >= bufSz)
notification->appName[wcslen(notification->appName)-1] = NULL;
// This gets called about 10x per focus change event
WriteEventToFile(notification);
}
free(notification);
// only care about app being activated, so do nothing in the else case
}
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
|