全屏检测怎么解决在桌面时也有效
我这有几个可以判断是否有全屏窗体的代码,但是都把桌面也当成全屏了,请问怎么才能在桌面时不判定成全屏,例如:#include <WinAPI.au3>Global $Struct = DllStructCreate($tagPoint)
Global $WindowsWidth = _WinAPI_GetSystemMetrics(0)
Global $WindowsHeight = _WinAPI_GetSystemMetrics(1)
While 1
Sleep(100)
If IsFullWindow() Then ;全屏
MsgBox(0, "", "有全屏")
EndIf
WEnd
Func IsFullWindow() ;检测当前窗口是否全屏,是:返回1,否则返回0
Pos()
$hwnd = _WinAPI_WindowFromPoint($Struct)
If $hwnd = _WinAPI_GetDesktopWindow() Then Return 0 ;不检测资源管理器
$tRect = _WinAPI_GetWindowRect($hwnd)
$iLeft = DllStructGetData($tRect, "Left")
$iTop = DllStructGetData($tRect, "Top")
$iRight = DllStructGetData($tRect, "Right")
$iBottom = DllStructGetData($tRect, "Bottom")
If $WindowsWidth <= $iRight - $iLeft And $WindowsHeight <= $iBottom - $iTop Then Return 1
Return 0
EndFunc ;==>IsFullWindow
Func Pos()
DllStructSetData($Struct, "x", MouseGetPos(0))
DllStructSetData($Struct, "y", MouseGetPos(1))
EndFunc ;==>Pos 没有人遇到过吗?自己顶 回复 2# sh1536
怎麼用啊我執行後沒反應?? 里面那不是有排除桌面的语句么 #include <WinAPI.au3>
Global $Struct = DllStructCreate($tagPoint)
Global $WindowsWidth = _WinAPI_GetSystemMetrics(0)
Global $WindowsHeight = _WinAPI_GetSystemMetrics(1)
Local $array = _WinAPI_EnumWindows(True), $hDesktop
For $i = 1 To $array
If _WinAPI_GetClassName(_WinAPI_GetParent($array[$i])) = 'SHELLDLL_DefView' Then
$hDesktop = _WinAPI_GetParent(_WinAPI_GetParent($array[$i]))
ExitLoop
EndIf
Next
While 1
Sleep(100)
If IsFullWindow() Then ;全屏
MsgBox(0, "", "有全屏")
EndIf
WEnd
Func IsFullWindow() ;检测当前窗口是否全屏,是:返回1,否则返回0
Pos()
$hwnd = _WinAPI_WindowFromPoint($Struct)
;~ If $hwnd = _WinAPI_GetDesktopWindow() Then Return 0 ;不检测资源管理器
If $hwnd = $hDesktop Then Return 0 ;不检测资源管理器
$tRect = _WinAPI_GetWindowRect($hwnd)
$iLeft = DllStructGetData($tRect, "Left")
$iTop = DllStructGetData($tRect, "Top")
$iRight = DllStructGetData($tRect, "Right")
$iBottom = DllStructGetData($tRect, "Bottom")
If $WindowsWidth < $iRight - $iLeft And $WindowsHeight < $iBottom - $iTop Then Return 1
Return 0
EndFunc ;==>IsFullWindow
Func Pos()
DllStructSetData($Struct, "x", MouseGetPos(0))
DllStructSetData($Struct, "y", MouseGetPos(1))
EndFunc ;==>Pos
回复 5# haijie1223
怎麼我執行後 都沒反應??作業系統問題嗎?? 回复 6# kk_lee69
你把任务栏隐藏,然后把窗口最大化就有反应了。 回复 7# haijie1223
哈哈~~ 果然ㄟ
我從不 隱藏任務攔的 難怪沒反應呵呵 回复 5# haijie1223
感谢版主的回复,一般情况下用户的任务栏都不隐藏啊
页:
[1]