Article View: borland.public.cppbuilder.nativeapi
Article #686Re: How to use traditional Windows message and API function ?
From: Luka Gabri�
Date: Sat, 23 Feb 2008 01:54
Date: Sat, 23 Feb 2008 01:54
34 lines
2410 bytes
2410 bytes
SendMessage works from my application using it's handle, but HWND_BROADCAST
for handle doesn't work in application nor from other applications. When I
try to Send something from DLL it works only when application is in focus,
if not in focus send message is not working. When I use a timer in app to
send a message to itself it works even if focus is not set on a form. I
think everything would work fine if this SendMessage would work with
HWND_BROADCAST! What is the problem with code below?
> Message receiving code:
>
> // application header
>
> MESSAGE void __fastcall func_name(TMessage &Message);
> BEGIN_MESSAGE_MAP
> VCL_MESSAGE_HANDLER(xxxx,TMessage,func_name); //xxxx - message
> identifier,
> > 1024
> END_MESSAGE_MAP(TForm);
>
> // application cpp file
>
> MESSAGE void __fastcall TFormX::func_name(TMessage &Message)
> {
> ShowMessage("Message received, parameter1 = " + IntToStr(Message.LParam) +
> ", parameter2 = " + IntToStr(Message.WParam));
> }
>
> Code to send a message
>
> SendMessageA(hinst,xxxx,5,7);
>
> //hinst - app form handle, xxxx - message identifier (same as in main
> application), parameter1=5, parameter2=7.
Technical Details
Message-ID:
<47bf7c96$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<47b02ecf$1@newsgroups.borland.com> <MPG.221a525c60a3d10c989a5f@newsgroups.borland.com> <47b0d385$1@newsgroups.borland.com> <47b0d5c9$1@newsgroups.borland.com> <47be2fa2$1@newsgroups.borland.com> <47be52e0$1@newsgroups.borland.com> <47bf296d@newsgroups.borland.com> <47bf6340$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,985e142ee2266c4 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Luka Gabri�" <luka.gabric@gmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <47b02ecf$1@newsgroups.borland.com> <MPG.221a525c60a3d10c989a5f@newsgroups.borland.com> <47b0d385$1@newsgroups.borland.com> <47b0d5c9$1@newsgroups.borland.com> <47be2fa2$1@newsgroups.borland.com> <47be52e0$1@newsgroups.borland.com> <47bf296d@newsgroups.borland.com> <47bf6340$1@newsgroups.borland.com> Subject: Re: How to use traditional Windows message and API function ? Date: Sat, 23 Feb 2008 02:54:51 +0100 Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 89.201.137.50 Message-ID: <47bf7c96$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1203731606 89.201.137.50 (22 Feb 2008 17:53:26 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail