HELP: Big Pb with modeless app and global kbd hook DLL... 
Author Message
 HELP: Big Pb with modeless app and global kbd hook DLL...

Hi,
I am using MSVC++6.0
I've created a global keyboard hook I have embedded in a DLL.
This DLL works fine with a dialog based application (modal) and I am
able to retrieve in real-time all keys strokes.
But here is my problem. I want to use this dll in a modeless
application.

In fact, I created an application hidden in the system tray, and when I
want to use this dll, i am unable to get the keys strokes... The dll
never sends to my application the keys the users typed in on the
keyboard!!! And did it at the perfection when i was using it a dialog
based app.

It appears the dll never call the ON_WM_COMMAND() procedure of my
MainFrame...
With this modeless app I am unable to retrieve on-the-fly all key
pressed even with a global keyboard hook (which should catch all keys,
even if the user types in another application like Word isn't it?).
If I override the PreTranslateMessage(), it works _only_ if my
application got the focus. If my app doesn't have focus (e.g. if I work
under a text editor), it is unable to hook keys...

Thank you for your help...I really don't know how to deal with this
problem.

Best Regards,
David Excoffier.



Sun, 16 Jun 2002 03:00:00 GMT  
 HELP: Big Pb with modeless app and global kbd hook DLL...

Quote:

> Hi,
> I am using MSVC++6.0
> I've created a global keyboard hook I have embedded in a DLL.
> This DLL works fine with a dialog based application (modal) and I am
> able to retrieve in real-time all keys strokes.
> But here is my problem. I want to use this dll in a modeless
> application.

> In fact, I created an application hidden in the system tray, and when I
> want to use this dll, i am unable to get the keys strokes... The dll
> never sends to my application the keys the users typed in on the
> keyboard!!! And did it at the perfection when i was using it a dialog
> based app.

> It appears the dll never call the ON_WM_COMMAND() procedure of my
> MainFrame...
> With this modeless app I am unable to retrieve on-the-fly all key
> pressed even with a global keyboard hook (which should catch all keys,
> even if the user types in another application like Word isn't it?).
> If I override the PreTranslateMessage(), it works _only_ if my
> application got the focus. If my app doesn't have focus (e.g. if I work
> under a text editor), it is unable to hook keys...

> Thank you for your help...I really don't know how to deal with this
> problem.

> Best Regards,
> David Excoffier.


Does your DLL hook still see all the keystrokes?  Put a MessageBeep()
into the KeyHookFunc() callback to see.

If so, the problem is that the DLL is not notifying your MainFrame of
these events, or the Mainframe isn't receiving the notification!  In my
hooks, I've defined a custom Windows message (like WM_APP) that the DLL
posts to the MainFrame; I've never tried posting WM_COMMAND messages.
Are you sure the MainFrame has a valid HWND for the DLL to post messages
to?

Hope this helps,
David

--
David Ching, Windows Consultant
DC Software Design, Inc.
http://www.dcsoft.com



Sun, 16 Jun 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. PB with modeless app and global DLL keyboard hook

2. HLP: Kbd Hook dll and MFC modeless app ???

3. help pls on MFC DLLs and Global WH_SHELL hook

4. Help - Global hook in DLL

5. Global Keyboard hook without DLL

6. CFile in a dll with global hook??

7. Interfacing VC++ dll and PB app.

8. Modeless Dialog in DLL, trying to pass calling APP as parent

9. FindWindow, dll and MFC modeless app?

10. Help: Stuffing kbd input

11. Help: App hangs when minimized with modeless CPropertySheet object on dialog

12. More issues with global hooks and .NET :-(

 

 
Powered by phpBB® Forum Software