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
}
暂无讨论,说说你的看法吧