BCB如何获得当前所有可视窗口的窗口标题和窗口句柄?
BCB如何获得当前所有可视窗口的窗口标题和窗口句柄?
[解决办法]
BOOL CALLBACK EnumWindowsProc(
HWND hwnd, // handle to parent window
LPARAM lParam // application-defined value
)
{
if (IsWindowVisible(hwnd))
{
char s[260];
GetWindowText(hwnd, s, 260);
Form1-> Memo1-> Lines-> Add( "hwnd= " + IntToHex((int)hwnd, 2) + ",Caption: " + s);
}
return TRUE;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
EnumWindows((WNDENUMPROC)EnumWindowsProc, NULL);
}