Article View: borland.public.cppbuilder.nativeapi
Article #14469Re: Capture Running Applications !!
From: Remy Lebeau (TeamB)
Date: Mon, 11 Aug 2003 18:02
Date: Mon, 11 Aug 2003 18:02
65 lines
2594 bytes
2594 bytes
"Stan" <thewatcher@email.com> wrote in message
news:3f3771bd@newsgroups.borland.com...
> my problem comes with the Hook procedure which I do
> not know how to manipulate, I don't know how send the
> appropriate message that will contain these desired info.
> for my applications, I don't know what parameters should
> I pass to the SendMessage() api, and what should I receive
> from it ??
Have a look at the WM_COPYDATA message. You can use it to send any
arbitrary data to a window. Simply create a struct that contains your
desired info, then send a pointer of the struct to your application. For
example:
--- DLL ---
struct MyInfo
{
...
};
MyInfo info;
// fill info as needed
COPYDATASTRUCT cds = {0};
cds.dwData = 0x12345678;
cds.cbData = sizeof(info);
cds.lpData = &info.
SendMessage(hMyApp, WM_COPYDATA, 0, (LPARAM)&cds);
--- Application ---
struct MyInfo
{
...
};
class TMyForm : public TForm
{
private:
void __fastcall WMCopyData(TMessage &Msg);
public:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_COPYDATA, TMessage, WMCopyData)
END_MESSAGE_MAP(TForm)
};
void __fastcall TMyForm::WMCopyData(TMessage &Msg)
{
COPYDATASTRUCT *cds = (COPYDATASTRUCT*)Msgg.LParam;
if( cds->dwData == 0x12345678 )
{
MyInfo *info = (MyInfo*)cds->lpData;
// use info as needed
Message.Result = TRUE;
}
else
TForm::Dispatch(&Msg);
}
Gambit
Technical Details
Message-ID:
<3f37de49$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f3771bd@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,f52c4c114e4bddc2 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-11 11:26:54 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f3771bd@newsgroups.borland.com> Subject: Re: Capture Running Applications !! Date: Mon, 11 Aug 2003 11:02:37 -0700 Lines: 67 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3f37de49$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1060625993 207.175.226.26 (11 Aug 2003 11:19:53 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail