var
wnd: hwnd;
begin
wnd:= GetForegroundWindow;
PostMessage(wnd, WM_KEYDOWN, VK_ESCAPE, 0);
end;


//取得最上層視窗
wnd:= GetForegroundWindow;
//取得特定window-class視窗
wnd:= FindWindow(pchar(classname'),nil);
//取得特定caption視窗
wnd:= FindWindow(nil,pchar('caption');


//設定焦點
SetForegroundWindow(wnd);


//送出訊息
PostMessage(hWnd, WM_CLOSE, 0, 0);
PostMessage(hWnd, WM_DESTROY, 0, 0);
創作者介紹

神鵰蝦

jck11 發表在 痞客邦 PIXNET 留言(0) 人氣()