The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Zap on May 23, 2010, 06:32:39 AM

Title: Problems with Windows hooks
Post by: Zap on May 23, 2010, 06:32:39 AM
Hi,I`m a newbie &  working on Iczelion`s tutorial on hooks.My hook doesn`t work though everything seems to be correct.
The hook is very simple, i just want to make sure i understand the way they work,but i don`t seem to,yet.
1.From the main program 3 procs from my dll are invoked:
.IF uMsg==WM_CREATE   
        INVOKE   _InsertMenuItem        ;inserts a menu item to the Notepad menubar
        INVOKE   _SetHook
.ELSEIF uMsg==WM_DESTROY
        INVOKE   _Unhook           
        invoke PostQuitMessage,NULL

2.CallWndProc in my dll just sends me a message when my menu item is chosen.
Please,help,as i`ve been trying & changing stuff for a couple of days but to no avail.
Thanx in advance.
Title: Re: Problems with Windows hooks
Post by: qWord on May 23, 2010, 04:18:39 PM
the code is not complete!
Have you marked the dll's data section as shared?
Title: Re: Problems with Windows hooks
Post by: Zap on May 24, 2010, 01:15:23 PM
it`s complete now,it`s just a simple window.
yes,i did,i put "/section:.bss,S  /section:.data,S" to link,but the problem is
CallWndProc is invoked but the 2 data sections are still invisible to it