delphi 如何遍歷Windows桌面上所有視窗
uj5u.com熱心網友回復:
百度一下一大把uj5u.com熱心網友回復:
findwindow查找視窗uj5u.com熱心網友回復:
The EnumWindows function enumerates all top-level windows on the screen by passing the handle of each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.BOOL EnumWindows(
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
Parameters
lpEnumFunc
Points to an application-defined callback function. For more information, see the EnumWindowsProc callback function.
lParam
Specifies a 32-bit, application-defined value to be passed to the callback function.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Remarks
The EnumWindows function does not enumerate child windows.
This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.
See Also
EnumChildWindows, EnumWindowsProc, GetWindow
uj5u.com熱心網友回復:
這個很多例子吧uj5u.com熱心網友回復:
function EnumWndProc(AhWnd:LongInt; AlParam:lParam):boolean;stdcall;var
WndClassName: array[0..254] of Char;
WndCaption: array[0..254] of Char;
begin
GetClassName(AhWnd,wndClassName,254);
GetWindowText(aHwnd,WndCaption,254);
//if WndCaption='FastHelper' then
begin
with form1.memo1 do
begin
Form1.Memo1.Lines.Add(IntToStr(AhWnd)+WndCaption );
end;
end;
result:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@EnumWndProc,LongInt(self));
end;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/11171.html
上一篇:delphi 7 連接mysql 提示internalconnection:dll/shared library nam
