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 }
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)