鏌ラ槄鍙绐楀彛鏍囬
鍙戝竷: 2008-6-26 20:33 | 浣滆: admin | 鏌ョ湅: 8娆
width="84%">鏌ラ槄鍙绐楀彛鏍囬
涓嬮潰鍙槸涓惧嚭涓涓緥瀛愭彁渚涘弬鑰:
杩愮敤API鍑芥暟GetWindow()閰嶅悎GetWindowText()閫愪竴鏌ュ嚭鍚勮绐楃殑鏍囬
1. File | New Project 寮濮嬩竴涓柊鐨勫伐绋
2. 鍦 Form1 涓畨鎺 Button 涓 Memo 鍚勪竴
3. 鍦 Button1 鐨 OnClick 浜嬩欢涓挵鍐欑▼寮忓涓:
procedure TForm1.Button1Click(Sender: TObject);
var
銆hCurrentWindow: HWnd;
銆szText: array[0..254] of char;
begin
銆hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
銆while hCurrentWindow <> 0 do
銆begin
銆if GetWindowText(hCurrentWindow, @szText, 255)>0 then
銆Memo1.Lines.Add(StrPas(@szText));
銆hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);
銆end;
end;




发表于 2009-1-5 19:48
| 











