Re: CBT hook and Subclassing

Tech-Archive recommends: Speed Up your PC by fixing your registry



If you don't want some apps run with your hook, you can return FALSE in your
hook DllMain, but if that not suit you the only way I see is to inject hook
code in each app you want to behave in such manner
Arkady

"MSB" <MSB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AA9AF7EB-F5E6-4499-90E0-05C05E54D528@xxxxxxxxxxxxxxxx
Yes. Thats how I setup CBT hook. I tried the AppInit_DLLs key to check if
its
solves the problem. It does partially solves the issue but it gives other
side effects like mmc windows do not come up.


"Arkady Frenkel" wrote:

Just a hint, didn't you tried SetWindowsHookEx() instead of AppInit_DLLs
key ?
Arkady

"MSB" <MSB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:93771D01-B48C-4562-832D-2EF28C637DFA@xxxxxxxxxxxxxxxx
Hi,

I have developed an application which sets up a global CBT hook to
restrict
the resizing and movement of window within the monitor on which they
are
created ,on a multimonitor system. When this application exits, it
unhooks
the CBT hook.

Inside hook DLL, I have a logic of listening to HCBT_CREATEWND and
subsclass
windows. In NCDESTROY message of windows, subclassing is removed.

This Application is working fine. But I am having certain issues when I
shut
down the application.

If i launch MMC.exe ( ex. Services.msc ) , TaskMgr.exe( TaskManager ) ,
MsTsc.exe ( Remote desktop window ) etc. when the application is
running
AND
when I shutdown the application, these windows crash !!

I am having no clue why they are crashing. I digged documentation for
subclassing and found that when I set my hook DLL in following key :

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\
CurrentVersion\Windows\APPINIT_DLLS

TaskMgr and MsTsc doesn't crash. But MMC.exe never comes up when
application
is running ! and this approach doesnt sound very good.

Any ideas how can I prevent these applications from crashing when my
application shuts down ?

Thanks,
MSB





.



Relevant Pages

  • Re: Detect Application Launch
    ... > do it more elegantly via a hook if such a method were available. ... 'Register this form with Windows to receive the ShellHook message ... Private Declare Function RegisterShellHookWindow Lib "user32" (ByVal hwnd As ...
    (microsoft.public.vb.winapi)
  • Re: Hooks
    ... Now I have set the hook I am getting those messages. ... Gary Chanson (Windows SDK MVP) ... Is that thread id is possible for these concept (all child windows ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Hooks
    ... Gary Chanson (Windows SDK MVP) ... Which type hook I need to use for this? ... Is that thread id is possible for these concept (all child windows ...
    (microsoft.public.win32.programmer.gdi)
  • Re: MOUSEHOOKSTRUCTEX.mouseData contains garbage on Windows 7 64 bit on 32 bit application
    ... Lucky that Windows loader seems to ignore it. ... FILE HEADER VALUES ... 32 bit word machine ... I had utility which set global WH_MOUSE hook using SetWindowsHookEx. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Hooks
    ... I Implemented Windows HOOKs for WH_CALLWNDPROC and WH_CALLWNDPROCRET ... I am able to hook the messages related to control using this. ... Gary Chanson ... Is that thread id is possible for these concept (all child ...
    (microsoft.public.win32.programmer.gdi)