Article View: borland.public.cppbuilder.nativeapi
Article #6486Re: [Remy] SendMessage() from a DLL to APP
From: Remy Lebeau (TeamB)
Date: Tue, 03 May 2005 18:26
Date: Tue, 03 May 2005 18:26
30 lines
1980 bytes
1980 bytes
"Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote in message
news:427748eb@newsgroups.borland.com...
> HWND hAppWnd;
You should always initialize your variables, especially when used globally:
HWND hAppWnd = NULL;;
> ghhookKB = SetWindowsHookEx( WH_KEYBOARD, (HOOKPROC)CheckKey, ghInst,
NULL)
You did not specify whether the HHOOK was in shared memory or not. It must
be. Otherwise, the hook will only work in your own application and not in
others. When you place your icon in the System Tray and hide your window,
your window won't be focused anymore, and won't be the window receiving
keyboard input. If you do not set up your hook properly to begin with, then
you will not be hooking the keyboard input of other applications properly.
> // Send key information to the main window
> SendMessage( hAppWnd, WM_KEYHOOK, 0, lParam );
Check the HWND for NULL before calling SendMessage():
if( hAppWnd )
SendMessage( hAppWnd, WM_KEYHOOK, 0, lParam );
Gambit
Technical Details
Message-ID:
<4277c28c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<427748eb@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,94b1d46dd644a85c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <427748eb@newsgroups.borland.com> Subject: Re: [Remy] SendMessage() from a DLL to APP Date: Tue, 3 May 2005 11:26:52 -0700 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <4277c28c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1115144844 68.69.17.41 (3 May 2005 11:27:24 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail