procedure TForm1.Button1Click(Sender: TObject);
var
hCurWindow: HWND;
WinText: array[0..255] of char;
begin
hCurWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurWindow <> 0 do
begin
if GetWindowText(hCurWindow, @WinText, 255) > 0 then
Memo1.Lines.Add(StrPas(@WinText));
hCurWindow := GetWindow(Handle, GW_HWNDNEXT);
end; // while
end;
就是用了上面的代码不过生成exe文件后取得的都是project1。就这样程序陷入死循环了弄了很久。。搞不懂究竟什么地方出错了
var
hCurWindow: HWND;
WinText: array[0..255] of char;
begin
hCurWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurWindow <> 0 do
begin
if GetWindowText(hCurWindow, @WinText, 255) > 0 then
Memo1.Lines.Add(StrPas(@WinText));
hCurWindow := GetWindow(Handle, GW_HWNDNEXT);
end; // while
end;
就是用了上面的代码不过生成exe文件后取得的都是project1。就这样程序陷入死循环了弄了很久。。搞不懂究竟什么地方出错了
var
hCurWindow: HWND;
WinText: array[0..255] of char;
begin
Memo1.clear;
hCurWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurWindow <> 0 do
begin
if GetWindowText(hCurWindow, @WinText, 255) > 0 then
Memo1.Lines.Add(StrPas(@WinText));
hCurWindow := GetWindow(hCurWindow, GW_HWNDNEXT);
end;
end;