delphi的代码帮转成VB6
procedure WinEventProc(hWinEventHook_: DWORD; event: DWORD; hwd: HWND; idObject: LONG; idChild: LONG; dwEventThread: DWORD; dwmsEventTime: DWORD); stdcall;var
sbuf: PChar;
begin
GetMem(sbuf, MAX_PATH);
GetWindowText(hwd, sbuf, MAX_PATH);
if Pos('百度', sbuf) > 0 then PostMessage(hwd, WM_CLOSE, 0, 0);
FreeMem(sbuf);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
UnhookWinEvent(hEventHook)
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
hEventHook := SetWinEventHook(EVENT_MIN,
EVENT_MAX,
0,
@WinEventProc,
0,
0,
WINEVENT_OUTOFCONTEXT or WINEVENT_SKIPOWNPROCESS);
end;