firemonkey 得到屏幕信息

本文介绍了一种使用Delphi枚举显示监视器的方法,并通过创建一个监视器类来捕获所有连接到系统的显示器。展示了如何在 TFormVedio 的 FormShow 事件中调用 EnumDisplayMonitors 函数来获取所有显示器的信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 type
  TO_MONITOR = class hm: HMONITOR; end; function EnumMonitorsProc(hm: HMONITOR; dc: HDC; r: PRect; Data: Pointer): Boolean; stdcall; var L: TList; M: TO_MONITOR; begin L := TList(Data); M := TO_MONITOR.Create; M.hm:= hm; L.Add(M); Result := True; end; procedure TFormVedio.FormShow(Sender: TObject); var FMonitors: Tlist; l_Handle: HMONITOR; rect: trect; MonInfo: TMonitorInfo; begin FMonitors := TList.Create; EnumDisplayMonitors(0, nil, @EnumMonitorsProc, LongInt(FMonitors)); MonInfo.cbSize := SizeOf(MonInfo); GetMonitorInfo(1, @MonInfo); rect := MonInfo.rcMonitor; if FMonitors.Count > 1 then self.SetBounds(rect.Left, rect.Top, rect.Width, rect.Height); FMonitors.Free; end; //从D7的VCL源码中提取的

 

转载于:https://www.cnblogs.com/tk-del/p/3372612.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值