打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
查找窗体名称及句柄
var
 szText: array[0..254] of char;
 hCurrentWindow :hwnd;
begin
  hCurrentWindow := GetWindow(Handle,GW_HWNDFIRST);
  while hCurrentWindow <> 0 do
  begin
    if GetWindowText(hCurrentWindow ,@szText,255) > 0 then

    if  pos('H3C',  StrPas(@szText))<>0 then  //这里指定某一窗口,可能有多个
    begin
      memo1.lines.Add(StrPas(@szText));  //窗口名称全称
      memo1.lines.Add(IntToStr(hCurrentWindow)); //句柄
    end;
    hCurrentWindow := GetWindow(hCurrentWindow,GW_HWNDNEXT);
  end;

StrPas(@szText)  //窗口名称全称
IntToStr(hCurrentWindow); //句柄
=====================
//获取所有窗体名称
procedure TForm1.btn1Click(Sender: TObject);
var
 szText: array[0..254] of char;
 hCurrentWindow :hwnd;
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;
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
获得MDI子窗体句柄
VB 遍历窗口所有子窗体句柄
在桌面中嵌入窗体
delphi中玩转keybd
GetWindow、GetTopWindow和GetNextWindow(转)
Window中窗口的层次关系以及窗口的属性
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服