|
From: Scott Seligman on 9 Apr 2008 16:41 "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote: >I'm certain they worked as I had them working in managed code and >Mike Salamone told me he had them working in native. Send me an email >directly and I'll see what I can find and ship back to you. You might have been using QASetWindowsJournalHook and QAUnhookWindowsJournalHook. But these functions aren't perfect, but I suppose they might work for some uses. -- --------- Scott Seligman <scott at <firstname> and michelle dot net> --------- The trouble with computers, of course, is that they're very sophisticated idiots. -- The Doctor in Doctor Who:"The Robot"
From: Robert Burdick on 10 Apr 2008 13:50 Doesn't seem to work. The hook gets set, but the callback never gets called. Any real sample code would be very helpful. "Scott Seligman" wrote: > "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote: > >I'm certain they worked as I had them working in managed code and > >Mike Salamone told me he had them working in native. Send me an email > >directly and I'll see what I can find and ship back to you. > > You might have been using QASetWindowsJournalHook and > QAUnhookWindowsJournalHook. But these functions aren't perfect, but I > suppose they might work for some uses. > > > -- > --------- Scott Seligman <scott at <firstname> and michelle dot net> --------- > The trouble with computers, of course, is that they're very > sophisticated idiots. > -- The Doctor in Doctor Who:"The Robot" >
From: Scott Seligman on 10 Apr 2008 14:30 =?Utf-8?B?Um9iZXJ0IEJ1cmRpY2s=?= <RobertBurdick(a)discussions.microsoft.com> wrote: > >Doesn't seem to work. The hook gets set, but the callback never gets called. > >Any real sample code would be very helpful. Here you go. Mostly untested code, without any error handling, follows: typedef struct tagEVENTMSG { UINT message; UINT paramL; UINT paramH; DWORD time; HWND hwnd; } EVENTMSG; typedef HHOOK PQASetWindowsJournalHook(int, LPVOID, EVENTMSG*); typedef HHOOK PQAUnhookWindowsJournalHook(int); typedef LRESULT PCallNextHookEx(HHOOK, int, WPARAM, LPARAM); #define WH_JOURNALRECORD 0 HHOOK g_hook; EVENTMSG g_eventmsg; HMODULE hCoreDLL; PQASetWindowsJournalHook* fnQASetWindowsJournalHook; PQAUnhookWindowsJournalHook* fnQAUnhookWindowsJournalHook; PCallNextHookEx* fnCallNextHookEx; LRESULT CALLBACK QASetWindowsJournalHookProc( int code, WPARAM wParam, LPARAM lParam) { if (code < 0) { return fnCallNextHookEx(g_hook, code, wParam, lParam); } else { EVENTMSG * eventmsg = (EVENTMSG*) lParam; // Do something with eventmsg return fnCallNextHookEx(g_hook, code, wParam, lParam); } } void BeginHook() { hCoreDLL = LoadLibrary(_T("coredll.dll")); fnQASetWindowsJournalHook = (PQASetWindowsJournalHook*) GetProcAddress(hCoreDLL, _T("QASetWindowsJournalHook")); fnQAUnhookWindowsJournalHook = (PQAUnhookWindowsJournalHook*) GetProcAddress(hCoreDLL, _T("QAUnhookWindowsJournalHook")); fnCallNextHookEx = (PCallNextHookEx*) GetProcAddress(hCoreDLL, _T("CallNextHookEx")); g_hook = fnQASetWindowsJournalHook(WH_JOURNALRECORD, QASetWindowsJournalHookProc, &g_eventmsg); } // If this isn't called, the device will hard-lock when // the hook procedure is no longer in memory void EndHook() { fnQAUnhookWindowsJournalHook(WH_JOURNALRECORD); } -- --------- Scott Seligman <scott at <firstname> and michelle dot net> --------- The avalanche has already started. It is too late for the pebbles to vote. -- Ambassador Kosh Naranek in Babylon 5:"Believers"
From: Robert Burdick on 10 Apr 2008 14:43 Thanks for the code. But just like the code I wrote, this sets the hook, but the hook callback never gets called. I'm trying to run this on a Windows Mobile 6 device. Perhaps the undocumented journal hook support is different on WinMob6. "Scott Seligman" wrote: > =?Utf-8?B?Um9iZXJ0IEJ1cmRpY2s=?= <RobertBurdick(a)discussions.microsoft.com> wrote: > > > >Doesn't seem to work. The hook gets set, but the callback never gets called. > > > >Any real sample code would be very helpful. > > Here you go. Mostly untested code, without any error handling, > follows: > > typedef struct tagEVENTMSG { > UINT message; > UINT paramL; > UINT paramH; > DWORD time; > HWND hwnd; > } EVENTMSG; > > typedef HHOOK PQASetWindowsJournalHook(int, LPVOID, EVENTMSG*); > typedef HHOOK PQAUnhookWindowsJournalHook(int); > typedef LRESULT PCallNextHookEx(HHOOK, int, WPARAM, LPARAM); > > #define WH_JOURNALRECORD 0 > > HHOOK g_hook; > EVENTMSG g_eventmsg; > HMODULE hCoreDLL; > PQASetWindowsJournalHook* fnQASetWindowsJournalHook; > PQAUnhookWindowsJournalHook* fnQAUnhookWindowsJournalHook; > PCallNextHookEx* fnCallNextHookEx; > > LRESULT CALLBACK QASetWindowsJournalHookProc( > int code, > WPARAM wParam, > LPARAM lParam) > { > if (code < 0) > { > return fnCallNextHookEx(g_hook, code, wParam, lParam); > } > else > { > EVENTMSG * eventmsg = (EVENTMSG*) lParam; > // Do something with eventmsg > return fnCallNextHookEx(g_hook, code, wParam, lParam); > } > } > > void BeginHook() > { > hCoreDLL = LoadLibrary(_T("coredll.dll")); > fnQASetWindowsJournalHook = (PQASetWindowsJournalHook*) > GetProcAddress(hCoreDLL, _T("QASetWindowsJournalHook")); > fnQAUnhookWindowsJournalHook = (PQAUnhookWindowsJournalHook*) > GetProcAddress(hCoreDLL, _T("QAUnhookWindowsJournalHook")); > fnCallNextHookEx = (PCallNextHookEx*) > GetProcAddress(hCoreDLL, _T("CallNextHookEx")); > > g_hook = fnQASetWindowsJournalHook(WH_JOURNALRECORD, > QASetWindowsJournalHookProc, &g_eventmsg); > } > > // If this isn't called, the device will hard-lock when > // the hook procedure is no longer in memory > void EndHook() > { > fnQAUnhookWindowsJournalHook(WH_JOURNALRECORD); > } > > -- > --------- Scott Seligman <scott at <firstname> and michelle dot net> --------- > The avalanche has already started. It is too late for the pebbles to > vote. -- Ambassador Kosh Naranek in Babylon 5:"Believers" >
From: Scott Seligman on 10 Apr 2008 15:10 =?Utf-8?B?Um9iZXJ0IEJ1cmRpY2s=?= <RobertBurdick(a)discussions.microsoft.com> wrote: > >Thanks for the code. But just like the code I wrote, this sets the hook, but >the hook callback never gets called. I'm trying to run this on a Windows >Mobile 6 device. Perhaps the undocumented journal hook support is different >on WinMob6. The one device I tested on was a WM6 device. As it is, it is undocumented, so it's probably fragile, and IIRC, it doesn't play well with some things like Transcriber. -- --------- Scott Seligman <scott at <firstname> and michelle dot net> --------- They who would give up an essential liberty for temporary security, deserve neither liberty or security. -- Ben Franklin
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Detecting when the stylus is present, perhaps using S&N broker Next: GPRS Monitor |