🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7266

Re: Global window hook

#7266
From: roger
Date: Thu, 24 Feb 2005 21:59
41 lines
2314 bytes
Thanks again... no problem now...

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:421e1b91$1@newsgroups.borland.com...
>
> "roger" <rogersmail@ntlworld.com> wrote in message
> news:421dc13d$1@newsgroups.borland.com...
>
> > extern "C" {
> >     bool __stdcall __declspec(dllexport) InstallHook(void);
> >     bool __stdcall __declspec(dllexport) RemoveHook(void);
> > }
>
> The form should be importing the functions, not exporting them.
>
> >         char *buffer = new char[cds->cbData];
> >         memcpy(buffer, cds->lpData, cds->cbData);
> >         Memo1->Lines->Add(buffer);
>
> You are leaking the memory you allocated as you are never freeing it.  You
> don't need to allocate a new buffer anyway, just use the existing buffer
in
> the message:
>
>     Memo1->Lines->Add(AnsiString(cds->lpData, cds->cbData));
>
> > void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
> > {
> >     RemoveHook();
> > }
>
> I would suggest moving the call to RemoveHook() into the form's destructor
> instead.  You used the constructor to install the hook, so the destructor
is
> logical to remove it.  Also, OnClose is not guaranteed to always be called
> in all situations, but the destructor is.
>
>
> Gambit
>
>
Technical Details
Message-ID: <421e4e37$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <421d76a8@newsgroups.borland.com> <421d81d6@newsgroups.borland.com> <421d891c@newsgroups.borland.com> <421dc13d$1@newsgroups.borland.com> <421e1b91$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9b9eac270d6034d6
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "roger" <rogersmail@ntlworld.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <421d76a8@newsgroups.borland.com> <421d81d6@newsgroups.borland.com> <421d891c@newsgroups.borland.com> <421dc13d$1@newsgroups.borland.com> <421e1b91$1@newsgroups.borland.com>
Subject: Re: Global window hook
Date: Thu, 24 Feb 2005 21:59:46 -0000
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2739.300
NNTP-Posting-Host: 81.103.71.81
Message-ID: <421e4e37$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1109282359 81.103.71.81 (24 Feb 2005 13:59:19 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail