Hooking
-
Hi all, i found this example on MSDN. Im trying to find out how i can accomplish what im trying to do, and thats monitor the events of a application. So here's the code...
#include int main(){ HOOKPROC hkprcSysMsg; static HINSTANCE hinstDLL; static HHOOK hhookSysMsg; hinstDLL = LoadLibrary((LPCTSTR) "c:\\windows\\notepad.dll"); hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, "SysMessageProc"); hhookSysMsg = SetWindowsHookEx(WH_SYSMSGFILTER,hkprcSysMsg,hinstDLL,0); return 0; }
I've noticed that i dont have notepad.dll - It may not be new to some but it is to me seeing how i've never had to look for it. So what would i have to do to monitor notepads events? Also, what char would i dump the messages from to a fstream .txt file? Thanx in advance! -
Hi all, i found this example on MSDN. Im trying to find out how i can accomplish what im trying to do, and thats monitor the events of a application. So here's the code...
#include int main(){ HOOKPROC hkprcSysMsg; static HINSTANCE hinstDLL; static HHOOK hhookSysMsg; hinstDLL = LoadLibrary((LPCTSTR) "c:\\windows\\notepad.dll"); hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, "SysMessageProc"); hhookSysMsg = SetWindowsHookEx(WH_SYSMSGFILTER,hkprcSysMsg,hinstDLL,0); return 0; }
I've noticed that i dont have notepad.dll - It may not be new to some but it is to me seeing how i've never had to look for it. So what would i have to do to monitor notepads events? Also, what char would i dump the messages from to a fstream .txt file? Thanx in advance!dellthinker wrote:
I've noticed that i dont have notepad.dll
You have to build it (of course you don't need to call it notepad.dll): if you need a global hook (and you need a global one to hook another process like notepad) the you have to create a DLL hosting your hook procedure. I strongly suggest you to read MSDN documentation about hooks [^]. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles] -
dellthinker wrote:
I've noticed that i dont have notepad.dll
You have to build it (of course you don't need to call it notepad.dll): if you need a global hook (and you need a global one to hook another process like notepad) the you have to create a DLL hosting your hook procedure. I strongly suggest you to read MSDN documentation about hooks [^]. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles]Hi CPallini, I developing an application that hooks the Open/Save dialog for getting the selected file path. currently am able to hook the common dialog but it's not working on office Open/Save dialog. On Searching i found that Office is using separate Open/Save dialog. Can anyone help me to identify the Office Open/Save dialog messags equivalent that of common dialog's CDN_INITDONE CDN_FILEOK CDM_GETFILEPATH CDM_GETFOLDERIDLIST CDM_GETFOLDERPATH CDM_GETSPEC CDM_HIDECONTROL CDM_SETCONTROLTEXT CDM_SETDEFEXT . I think you can help me to solve this out. thanks Nitheesh
-
Hi CPallini, I developing an application that hooks the Open/Save dialog for getting the selected file path. currently am able to hook the common dialog but it's not working on office Open/Save dialog. On Searching i found that Office is using separate Open/Save dialog. Can anyone help me to identify the Office Open/Save dialog messags equivalent that of common dialog's CDN_INITDONE CDN_FILEOK CDM_GETFILEPATH CDM_GETFOLDERIDLIST CDM_GETFOLDERPATH CDM_GETSPEC CDM_HIDECONTROL CDM_SETCONTROLTEXT CDM_SETDEFEXT . I think you can help me to solve this out. thanks Nitheesh
Well I'm not an expert, but I read some time ago that Office rolls its own controls and maybe the controls themselveles don't even use messages as communication mechanism (but I maybe wrong). :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles] -
Well I'm not an expert, but I read some time ago that Office rolls its own controls and maybe the controls themselveles don't even use messages as communication mechanism (but I maybe wrong). :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles]Hi CPallini, thank you for you reply. Nitheesh