BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

get Caption of window inside an WH_CBT hook ??

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WinAPI
View previous topic :: View next topic  
Author Message
David
Guest





PostPosted: Tue Oct 12, 2004 4:01 pm    Post subject: get Caption of window inside an WH_CBT hook ?? Reply with quote



Hi,

ive successfully written a DLL for my global hook, and also the main
code
to turn-on and turn-off the hook.

but i'm having problems getting the Caption of the window inside the
DLL hook procedure..basically i want to do a...

if Caption = "something" then close/destroy that window;



function DemoHookProc(Code, wParam, lParam: LongInt): LongInt;
stdcall;
{var
s:string;
i: integer;

begin
case Code of
HCBT_CREATEWND:
begin
i := SendMessage(wParam, WM_GETTEXTLENGTH, 0, 0);
SetLength(s, i + 1);
SendMessage(wParam, WM_GETTEXT, i + 1, Integer(PChar(s)));

if ( pos('The Window that i am after', s) >0 ) then
begin
Result := 1; // close the window
exit;
end;
end;
end;
Result := CallNextHookEx(HookHandle, Code, wParam, lParam);

end;

anybody see where im going wrong??
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.