1 function  GetActiveWindowText: string;
2
3 var
4 hnd: HWND;
5
6 stlen: Integer;
7
8 begin
9
10 hnd := GetForegroundWindow;
11
12 stlen := GetWindowTextLength(hnd);
13
14 SetLength(Result, stlen);
15
16 GetWindowText(hnd, PChar(Result), stlen);
17
18 end;

  顺便一提,GetActiveWindow只能得到调用进程内的窗体Handle.

posted on 2011-07-21 22:47  solokey  阅读(240)  评论(0编辑  收藏  举报