David Guest
|
Posted: Tue Oct 12, 2004 4:01 pm Post subject: get Caption of window inside an WH_CBT hook ?? |
|
|
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??
|
|