Re: WM_INITMENU and GetSystemMenu different, why ?




"Xavier" <me@xxxxxxxxxxx> wrote in message
news:Xns96858D959366harkofreefr@xxxxxxxxxxxxxxxxxx
> "Gary Chanson" <gchanson@xxxxxxxxxxxxxxxxxxxx> wrote in
> news:uGp7P9VfFHA.3940@xxxxxxxxxxxxxxxxxxxx:
>
> >
> > Any kind but WH_CALLWNDPROC is probably the best choice since it's
> > so
> > general. You can do your menu modifying (and restoring) in dllmain.
> > All that you care about from the point of view of the hook itself is
> > that it get called so that your dllmain gets run.
> >
>
> OK, but what message I have to intercept ? And what do you mean by "All
> that you care about from the point of view of the hook itself is that it
> get called so that your dllmain gets run."
>
> (sorry, I discovered hooks a few days ago :) )

In this case, it simply means that your DLL will get loaded when any
message is sent to a window procedure in the target thread. You can be
reasonably sure this will happen very often and it's not critical exactly when
your DLL gets loaded. In other cases, it might take sending a private message
to the thread to insure that the hook DLL gets loaded when it's needed.

--
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-gchanson@xxxxxxxx

.



Relevant Pages

  • Re: System-wide hooking, VB+ASM
    ... The CallNextHookEx function needs the handle to the current hook, ... When the DLL is injected into the other address spaces, ... > I just wonder whether that DllMain that he talks about is a red ... DWORD fdwReason, ...
    (microsoft.public.vb.winapi)
  • Re: System-wide hooking, VB+ASM
    ... >returned by the SetWindowsHookEx function used to set the hook. ... The reason is that only the /first/ instance of the DLL ... >Look up DllMain in the SDK documentation. ... standard entry point. ...
    (microsoft.public.vb.winapi)
  • Re: global hook dll unload clarification
    ... -GJC [MS Windows SDK MVP] ... >>> this function does not free the DLL containing the hook procedure. ... >>> unloading of the global hook dll. ...
    (microsoft.public.win32.programmer.ui)
  • Re: computer-based training (CBT) window?
    ... he passes NULL as dwThreadId in order to associate his hook with all threads within the current desktop ... So most likely he does not need to pass dwThreadId to DLL ... ... Gary Chanson (Windows SDK MVP) ...
    (microsoft.public.win32.programmer.kernel)
  • RE: Capturing login/logoff events
    ... Write a DLL and add it to AppInit_DLL's registry key at ... SetWindowsHookExand write a hooking DLL with a launcher that runs on login. ... write a custom DllMain that records process attach and detach ... Create a hook routine in your DLL and hook Explorer's message pump to ...
    (microsoft.public.vstudio.development)

Loading