Innovative Posted November 6, 2008 Share Posted November 6, 2008 Is it possible to detect if a process is full screen ? Just like how MSN Messenger does, it set your status to AWAY when it detects a full screen application .. Link to comment Share on other sites More sharing options...
BrettF Posted November 6, 2008 Share Posted November 6, 2008 Possibly something like this? MsgBox (0, "", _IsFullScreen ()) Func _IsFullScreen () Local $hwnd = WinGetHandle ("[ACTIVE]") Local $aWinRect = WinGetPos ($hwnd) If ($aWinRect[2] >= @DesktopWidth) Or ($aWinRect[3] >= @DesktopHeight) Then Return True Return False EndFunc Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted November 6, 2008 Share Posted November 6, 2008 This might be another option too. expandcollapse popupSleep (3000) MsgBox (0, "", _IsFullScreen (ProcessExists ("firefox.exe"))) Func _IsFullScreen ($pid) Local $array = _ProcessGetHWnd ($pid, 2) If @error Then Return -1 For $i = 1 to $array[0][0] $aWinRect = WinGetPos ($array[0][1]) If ($aWinRect[2] >= @DesktopWidth) Or ($aWinRect[3] >= @DesktopHeight) Then Return True Next Return False EndFunc ;=============================================================================== ; ; Function Name: _ProcessGetHWnd ; Description: Returns the HWND(s) owned by the specified process (PID only !). ; ; Parameter(s): $iPid - the owner-PID. ; $iOption - Optional : return/search methods : ; 0 - returns the HWND for the first non-titleless window. ; 1 - returns the HWND for the first found window (default). ; 2 - returns all HWNDs for all matches. ; ; $sTitle - Optional : the title to match (see notes). ; $iTimeout - Optional : timeout in msec (see notes) ; ; Return Value(s): On Success - returns the HWND (see below for method 2). ; $array[0][0] - number of HWNDs ; $array[x][0] - title ; $array[x][1] - HWND ; ; On Failure - returns 0 and sets @error to 1. ; ; Note(s): When a title is specified it will then only return the HWND to the titles ; matching that specific string. If no title is specified it will return as ; described by the option used. ; ; When using a timeout it's possible to use WinWaitDelay (Opt) to specify how ; often it should wait before attempting another time to get the HWND. ; ; ; Author(s): Helge ; ;=============================================================================== Func _ProcessGetHWnd($iPid, $iOption = 1, $sTitle = "", $iTimeout = 2000) Local $aReturn[1][1] = [[0]], $aWin, $hTimer = TimerInit() While 1 ; Get list of windows $aWin = WinList($sTitle) ; Searches thru all windows For $i = 1 To $aWin[0][0] ; Found a window owned by the given PID If $iPid = WinGetProcess($aWin[$i][1]) Then ; Option 0 or 1 used If $iOption = 1 OR ($iOption = 0 And $aWin[$i][0] <> "") Then Return $aWin[$i][1] ; Option 2 is used ElseIf $iOption = 2 Then ReDim $aReturn[UBound($aReturn) + 1][2] $aReturn[0][0] += 1 $aReturn[$aReturn[0][0]][0] = $aWin[$i][0] $aReturn[$aReturn[0][0]][1] = $aWin[$i][1] EndIf EndIf Next ; If option 2 is used and there was matches then the list is returned If $iOption = 2 And $aReturn[0][0] > 0 Then Return $aReturn ; If timed out then give up If TimerDiff($hTimer) > $iTimeout Then ExitLoop ; Waits before new attempt Sleep(Opt("WinWaitDelay")) WEnd ; No matches SetError(1) Return 0 EndFunc ;==>_ProcessGetHWnd Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Innovative Posted November 6, 2008 Author Share Posted November 6, 2008 Thanks ;D Problem resolved. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 6, 2008 Share Posted November 6, 2008 Dang, Brett... all about the hard way! If BitAND(WinGetState(WinGetHandle("[ACTIVE]")), 32) Then ConsoleWrite("Maximized" & @LF) Else ConsoleWrite("Not Maximized" & @LF) EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
BrettF Posted November 6, 2008 Share Posted November 6, 2008 Dang, Brett... all about the hard way! If BitAND(WinGetState(WinGetHandle("[ACTIVE]")), 32) Then ConsoleWrite("Maximized" & @LF) Else ConsoleWrite("Not Maximized" & @LF) EndIf Of course! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
spudw2k Posted November 6, 2008 Share Posted November 6, 2008 But couldn't you also technically have a window that is not "maximized" but takes the full screen? just for argument sake. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 6, 2008 Share Posted November 6, 2008 But couldn't you also technically have a window that is not "maximized" but takes the full screen? just for argument sake.Yes, but then WinGetState() would not have bit 5 set, which is why that is a better test of if it is maximized. Now, if you just want to know if it covers all or most of the screen, your definitions get fuzzy. What if it's 1 pixel width smaller that the screen? Want to call that maximized, or not? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
youknowwho4eva Posted November 6, 2008 Share Posted November 6, 2008 For that you could detect the monitor size and see if the the window size is as big or larger right? Giggity Link to comment Share on other sites More sharing options...
spudw2k Posted November 6, 2008 Share Posted November 6, 2008 (edited) For that you could detect the monitor size and see if the the window size is as big or larger right? Yea, I think that's what BrettF's script does.Now, if you just want to know if it covers all or most of the screen, your definitions get fuzzy. What if it's 1 pixel width smaller that the screen? Want to call that maximized, or not?I guess my question is can a window/app be Full Screen (which I am defining as 0,0 to DesktopWidth,DesktopHeigth of a monitor) without being in the state of Maximized? Seems to be it can. For example, I have a transparent gui that changes color and fills the screen, yet it is not maximized; and thus would fail to be determined as Full Screen by PsaltyDS' method. Perhaps both can be incorporated into each other. If IsMaximized or IsFullscreen.I think, (maybe) MSN Messenger is defining a Full Screen app as an app that fills the entire desktop space and does not have a titlebar. Edited November 7, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 7, 2008 Share Posted November 7, 2008 I guess my question is can a window/app be Full Screen (which I am defining as 0,0 to DesktopWidth,DesktopHeigth of a monitor) without being in the state of Maximized? Seems to be it can. For example, I have a transparent gui that changes color and fills the screen, yet it is not maximized; and thus would fail to be determined as Full Screen by PsaltyDS' method. Perhaps both can be incorporated into each other. If IsMaximized or IsFullscreen.Part of the problem with your definition is that the true maximized state for a window changes things you are not accounting for. The window control icon changes at the top/right of the window, the window will dynamically resize if the desktop size changes, and it will also resize if the taskbar changes size. All the drag handles at the edges and corners go away.None of those things are true of window that is only the same size as the desktop, but not truly maximized. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
spudw2k Posted November 7, 2008 Share Posted November 7, 2008 (edited) Part of the problem with your definition is that the true maximized state for a window changes things you are not accounting for. The window control icon changes at the top/right of the window, the window will dynamically resize if the desktop size changes, and it will also resize if the taskbar changes size. All the drag handles at the edges and corners go away.None of those things are true of window that is only the same size as the desktop, but not truly maximized. Nevermind, I think we're just going in circles. thanksedit:Final thoughtIs it possible to detect if a process is full screen ? Just like how MSN Messenger does, it set your status to AWAY when it detects a full screen application .. I don't believe MSN Messenger sets your status away when you, let's say, browse the web with a maximized window. Edited November 7, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
BrettF Posted November 7, 2008 Share Posted November 7, 2008 Doesn't MSN use a DX hook or something? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
spudw2k Posted November 8, 2008 Share Posted November 8, 2008 Doesn't MSN use a DX hook or something?That very well could be, or perhaps is looks for specific controls that are typically full screen. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 8, 2008 Share Posted November 8, 2008 That very well could be, or perhaps is looks for specific controls that are typically full screen. All MSN has to do is the equivalent of: ; Get handle to MSN window $hMSN = WinGetHandle("MSN - Messenger") ; Get handle of currently active window $hActive = WinGetHandle("[ACTIVE]") ; Test if different window is active and maximized If ($hActive <> $hMSN) And BitAND(WinGetState($hActive), 32) Then ; Set 'away' condition... EndIf I don't see why it would be any more complicated than that. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
spudw2k Posted November 8, 2008 Share Posted November 8, 2008 All MSN has to do is the equivalent of: ; Get handle to MSN window $hMSN = WinGetHandle("MSN - Messenger") ; Get handle of currently active window $hActive = WinGetHandle("[ACTIVE]") ; Test if different window is active and maximized If ($hActive <> $hMSN) And BitAND(WinGetState($hActive), 32) Then ; Set 'away' condition... EndIf I don't see why it would be any more complicated than that. Going back to the start of the post. He wants to know how MSN messenger detects a fullscreen app and sets his status to busy/away. This does not get set just because another window is active and Maximized, but only for certain fullscreen scenarios. For example. By your method, having a IE browser (or app for that manner) in a maximized state will trigger the "away condition" which is not what MSN does. Does that make sense? Not every maximized window sets the messenger state to busy/away. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 8, 2008 Share Posted November 8, 2008 Going back to the start of the post. He wants to know how MSN messenger detects a fullscreen app and sets his status to busy/away. This does not get set just because another window is active and Maximized, but only for certain fullscreen scenarios. For example. By your method, having a IE browser (or app for that manner) in a maximized state will trigger the "away condition" which is not what MSN does. Does that make sense? Not every maximized window sets the messenger state to busy/away. It does what I understood the description by the OP to be: ...it set your status to AWAY when it detects a full screen application .. I don't use MSN so the details are lost on me. You didn't give an example of when it does set 'AWAY' for a full screen app. Whatever the other conditions are, I'll wager they are just as easily implemented as what I posted. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now