Jump to content

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.

Question:

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)
    Sleep(250)
WEnd

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,

MemphiZ

Edited by MemphiZ
Link to comment
Share on other sites

  • Moderators

MemphiZ,

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)
    Else
        SplashTextOn("Active", "Not FullScreen")
        ConsoleWrite("Not FullScreen" & @CRLF)
    EndIf

    ; Allow splash to be seen
    Sleep(2000)
    SplashOff()

    ; Set this to a suitable value to check at intervals
    Sleep(5000)

WEnd

I hope this helps. :)

M23

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:

Spoiler

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

 

Link to comment
Share on other sites

Melba32,

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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...