Jump to content

Restore FullScreen Program


 Share

Recommended Posts

Hi,

I have been unable to get a fullscreen program to restore (maximise from taskbar) without it making the windows default ding sound when ever I press a button after it restores.

The basic code is:

While 1
    If (ProcessExists("program.exe")) Then
        If BitAND(WinGetState("Program Title", ""), 16) Then
            WinSetState("Program Title", "", @SW_RESTORE)
        Else
            Sleep(500)
        EndIf
    Else
        Exit
    EndIf
WEnd

Also tried @SW_MAXIMIZE, and WINACTIVATE.

Sadly I have to minimize and maximize the "program" if I use this script, using the mouse to stop the windows ding sound from happening each time I try to move etc (i.e. press any key).

The reason I want an auto script is because I have 2 multiple monitors and if I accidentally click outside the "program" it minimizes it, and stops the "program", and makes the computer think for ages, so I am trying to avoid it if possible.

Also tried to click the "program" from the taskbar (Windows 10) but I have no idea how to find which button/icon I need to click (move the mouse to).

So what is a simple way to restore my "program", or what are the taskbar command names to find the position to send the mouse to click on it to restore?

Edited by Gambler71
Link to comment
Share on other sites

23 hours ago, j0kky said:

EDIT: wait, maybe

_winapi_setforegroundwindow

could help!

#include <WinAPISys.au3>
$hTray = WinGetHandle("Program Name", "")
WinSetState("Program Name", "", @SW_RESTORE)
WinActivate("Program Name", "")
_winapi_setforegroundwindow($hTray)

 

Sadly still makes the default ding sound. Tried without WinSetState, and then without WinActivate, same sound.

 

The only solution I could think of is:

Local $aPos = MouseGetPos()
MouseClick("main", 178, 1063, 1, 1)
MouseMove($aPos[0], $aPos[1], 1)

which gets the current mouse position, clicks on where the first program should be on the windows taskbar, and then moves the mouse back to where is was.

Problem is sometimes after I save within the program, it moves the taskbar button to the end.

 

So, I thought that I could use "_GUICtrlToolbar_ButtonCount" but it always results in nil (0) finds. The test code was:

#include <GuiToolbar.au3>
$hTray = WinGetHandle("[CLASS:Shell_TrayWnd]")
$hToolbar = ControlGetHandle($hTray, "", "[CLASSNN:MSTaskListWClass]")
$iCnt = _GUICtrlToolbar_ButtonCount($hToolbar)
MsgBox(0,'',$iCnt)

I thought that this would find the number of buttons on the Win10 taskbar (main screen). From internet search I think it is impossible to see what the windows taskbar list is on Win10. Even the following script returns only in the answer of "running applications":

For $i = 1 To 10
    $sText = ControlGetText("[CLASS:Shell_TrayWnd]", "", "[CLASS:MSTaskListWClass; INSTANCE:" & $i & "]")
    If $sText = "" Then ExitLoop
    ConsoleWrite($i & " : " &$sText & @CRLF)
Next

Thanks for the help @j0kky

Edited by Gambler71
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...