Click here to Skip to main content
15,915,600 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Coloured button Pin
User 98854-Oct-02 10:35
User 98854-Oct-02 10:35 
GeneralRe: Coloured button Pin
User 98854-Oct-02 10:37
User 98854-Oct-02 10:37 
GeneralMixing MSVCRT and MSVCRTD Pin
Aaron Schaefer4-Oct-02 9:36
Aaron Schaefer4-Oct-02 9:36 
Questionsorting CMenu items ? Pin
Anonymous4-Oct-02 9:09
Anonymous4-Oct-02 9:09 
GeneralCPropertyPage and modeless dialog Pin
Gero Gerber4-Oct-02 9:02
Gero Gerber4-Oct-02 9:02 
GeneralRe: I have the same problem in my program Pin
lucy29-Oct-02 3:05
lucy29-Oct-02 3:05 
GeneralRe: I found the solution Pin
lucy29-Oct-02 3:38
lucy29-Oct-02 3:38 
GeneralA simple hooking problem Pin
generic_user_id4-Oct-02 8:50
generic_user_id4-Oct-02 8:50 
I'm trying to hook up to another program, using SetWindowsHookEx.

I need to hook to a specific application (ie: calc.exe) so a global hook shouldn't be neccecary.
HHOOK hook = SetWindowsHookEx(WH_MOUSE,
                             (HOOKPROC) MouseHookProc,
		             AfxGetInstanceHandle(),               
                             tID // Thread ID of Calc.exe
                             );

SetWindowsHookEx returns 0, the hook is set succesfully. Yet, when I move with my mouse over the calc dialog, the calculator crashes.

I think I need to use the Process instance of calc.exe instead of the instance of the program that hooks to it. If that is the case, how can I get the HINSTANCE of a process?

If that's not the case, what am I doing wrong?

Thanks in advance and kind regards,

Griffith



Everything you say will be misquoted, ripped out of context and used against you.
GeneralRe: A simple hooking problem Pin
Scott H. Settlemier4-Oct-02 10:22
Scott H. Settlemier4-Oct-02 10:22 
GeneralRe: A simple hooking problem Pin
generic_user_id4-Oct-02 11:11
generic_user_id4-Oct-02 11:11 
GeneralRe: A simple hooking problem Pin
Joel Lucsy6-Oct-02 7:41
Joel Lucsy6-Oct-02 7:41 
GeneralRe: A simple hooking problem Pin
generic_user_id7-Oct-02 4:06
generic_user_id7-Oct-02 4:06 
Generalclass not accessible in class wizard... Pin
nss4-Oct-02 8:40
nss4-Oct-02 8:40 
GeneralRe: class not accessible in class wizard... Pin
Carlos Antollini4-Oct-02 8:53
Carlos Antollini4-Oct-02 8:53 
Generalwow! Thanks! Pin
nss4-Oct-02 9:17
nss4-Oct-02 9:17 
Generalretain focus on modeless dlg, once Pin
brianwelsch4-Oct-02 8:33
brianwelsch4-Oct-02 8:33 
GeneralRe: retain focus on modeless dlg, once Pin
Anonymous4-Oct-02 11:06
Anonymous4-Oct-02 11:06 
GeneralInline and optimisations Pin
krisn4-Oct-02 8:28
krisn4-Oct-02 8:28 
GeneralRe: Inline and optimisations Pin
alex.barylski4-Oct-02 10:52
alex.barylski4-Oct-02 10:52 
GeneralRe: Inline and optimisations Pin
Joe Woodbury7-Oct-02 21:18
professionalJoe Woodbury7-Oct-02 21:18 
GeneralRe: Inline and optimisations Pin
l a u r e n4-Oct-02 11:14
l a u r e n4-Oct-02 11:14 
GeneralRe: Inline and optimisations Pin
alex.barylski4-Oct-02 14:51
alex.barylski4-Oct-02 14:51 
GeneralRe: Inline and optimisations Pin
krisn6-Oct-02 23:21
krisn6-Oct-02 23:21 
GeneralRe: Inline and optimisations Pin
Mike Nordell4-Oct-02 23:04
Mike Nordell4-Oct-02 23:04 
GeneralRe: Inline and optimisations Pin
krisn6-Oct-02 23:22
krisn6-Oct-02 23:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.