Jump to content
Sign in to follow this  

How to detect that switching to FullScreen is done?

Recommended Posts

Hi all,

I've been watching AutoItScript.com for a long time now and I learned much about AutoIt from this community! Thanks to everybody posting his scripts!

I thought its time to set up an account because there is one thing bugging me for hours now and I can't find a solution.


If I "Send("!{ENTER}")" to a window and it switches to fullscreen how can I detect when this switching is done?

The Scenario:

I want to benchmark an application using FRAPS. Unfortunately most applications don't allow "PixelGetColor" in fullscreen mode. Therefore I'm starting the application windowed and having a while loop running which is detecting a color change from black to any color using this loop:

$dimensions = WinGetPos("The Window Title")
$color = PixelGetColor($dimensions[0] + 100, $dimensions[1] + 100)
While $color = 0
    $color = PixelGetColor($dimensions[0] + 100, $dimensions[1] + 100)

When the script exits this loop I know that I can "Send" the Hotkey for FRAPS to start measuring. But before I do that I have to "Send" ALT+ENTER to go fullscreen.

The Problem:

If I send ALT+ENTER followed by the Hotkey I mostly get a minimum value of 0 frames in the log because FRAPS started measuring to early as the switching was not finished yet. Sleeping for 1 or 2 seconds is not a solution as I have to make sure that I start measuring on multiple systems at the same point. The time taken to switch to fullscreen varies based on system speed.

Any help is appreciated!

So long,


Edited by MemphiZ

Share this post

Link to post
Share on other sites


I would just check if the active window fills the screen like this: :)

While 1

    ; Resolution might be changed so check each time
    $iW = @DesktopWidth
    $iH = @DesktopHeight

    ; Get GUI size
    $aPos = WinGetPos("[ACTIVE]")

    ; Just for testing
    ConsoleWrite($aPos[2] & " - " & @DesktopWidth & @CRLF)
    ConsoleWrite($aPos[3] & " - " & @DesktopHeight & @CRLF)

    ; Does the active GUI fill the screen
    If $aPos[2] >= $iW And $aPos[3] >= $iH Then
        SplashTextOn("Active", "FullScreen")
        ConsoleWrite("FullScreen" & @CRLF)
        SplashTextOn("Active", "Not FullScreen")
        ConsoleWrite("Not FullScreen" & @CRLF)

    ; Allow splash to be seen

    ; Set this to a suitable value to check at intervals


I hope this helps. :)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites


I thought about this option already but (to be honest) I didn't try it because I thought the window might have the size already even if its not really re-initialized and/or drawing already but luckily I was wrong.

Thank you very much for your help!

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...