delphi GetWindowHandle


本文整理自网络,侵删。

 
function GetWindowHandle(ProcessId: Cardinal): THandle;
var
  hFound: THandle;

function EnumWindowsProcMy(_hwnd: HWND; ProcessId: Cardinal): BOOL; stdcall;
var
  dwPid: Cardinal;
begin
  GetWindowThreadProcessId(_hwnd, @dwPid);

  if ProcessId = dwPid then
  begin
    hFound := _hwnd;
    Result := False;
  end
  else
    Result := True;
end;

begin
  EnumWindows(@EnumWindowsProcMy, LPARAM(ProcessId));
  Result := hFound;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
form1.Caption:=inttostr(GetWindowHandle(2888));
end;

相关阅读 >>

Delphi tdirectory.tfilterpredicate

Delphi10.2.3解决的一个json问题

Delphi抓取qq聊天窗口实例

Delphi 加载图像并压缩,旋转图像角度

Delphi获取优盘的id

Delphi 写一个可拖动的 tshape

Delphi allocmem

Delphi获取本机的ip地址

Delphi xe android 程序切换到后台及从后台切换到前台实现

Delphi treeview �c 自动给标题上加图片

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    暂无评论...