GetMonitorInfo

MinLeft:=DllCall("GetSystemMetrics", "Int", 76)
MinTop:=DllCall("GetSystemMetrics", "Int", 77)
MaxRight:=DllCall("GetSystemMetrics", "Int", 78)
MaxBottom:=DllCall("GetSystemMetrics", "Int", 79)

MDMF_FromPoint(X := "", Y := "") {
	If (X = "") || (Y = "") {
		VarSetCapacity(PT, 8, 0)
		DllCall("User32.dll\GetCursorPos", "Ptr", &PT)
		If (X = "")
			X := NumGet(PT, 0, "Int")
		If (Y = "")
			Y := NumGet(PT, 4, "Int")
	}
	Return DllCall("User32.dll\MonitorFromPoint", "Int64", (X & 0xFFFFFFFF) | (Y << 32), "UInt", 0, "UPtr")
}

MDMF_GetInfo(HMON) {
	NumPut(VarSetCapacity(MIEX, 40 + (32 << !!A_IsUnicode)), MIEX, 0, "UInt")
	If DllCall("User32.dll\GetMonitorInfo", "Ptr", HMON, "Ptr", &MIEX) {
		MonName := StrGet(&MIEX + 40, 32)	; CCHDEVICENAME = 32
		MonNum := RegExReplace(MonName, ".*(\d+)$", "$1")
		Return {	Name:		(Name := StrGet(&MIEX + 40, 32))
				,	Num:		RegExReplace(Name, ".*(\d+)$", "$1")
				,	Left:		NumGet(MIEX, 4, "Int")		; display rectangle
				,	Top:		NumGet(MIEX, 8, "Int")		; "
				,	Right:		NumGet(MIEX, 12, "Int")		; "
				,	Bottom:		NumGet(MIEX, 16, "Int")		; "
				,	WALeft:		NumGet(MIEX, 20, "Int")		; work area
				,	WATop:		NumGet(MIEX, 24, "Int")		; "
				,	WARight:	NumGet(MIEX, 28, "Int")		; "
				,	WABottom:	NumGet(MIEX, 32, "Int")		; "
				,	Primary:	NumGet(MIEX, 36, "UInt")}	; contains a non-zero value for the primary monitor.
	}
	Return False
}
SysGet, MonCount, MonitorCount
SysGet, Mon, Monitor

if objcount(MonInfo:=MDMF_GetInfo(MDMF_FromPoint())){
	MsgBox % "MonCount:" MonCount "`nTop:" MonInfo.Top "`nBottom:" MonInfo.Bottom "`nLeft:" MonInfo.Left "`nRight:" MonInfo.Right "`nNum:" MonInfo.Num
}

给TA捐赠
共{{data.count}}人
人已捐赠
其他

GB2312中文拼音排序

2021-12-2 15:23:04

其他

GUI设置热键的例子

2021-12-2 15:23:16

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索