ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Removed Areas > AutoHotkey

Preventing fullscreen and getting back when that's failed

<< < (2/3) > >>

oblivion:
I am not sure if this is a solution or not, but can't you just Alt-Tab to minimize the window and work as normal?
-steeladept (July 27, 2011, 12:04 PM)
--- End quote ---

It gets you back to the desktop, but it doesn't re-window the fullscreen app. Not quite what I want to achieve.

There's a side-query to this: is there a better way to resize the display font in said DOS window than use a set of mouse- and keyboard macros to do "right-click on title bar, select Properties, select Font tab"... and so on? It works (and reasonably well) but feels inelegant...

-- bests, Tim

MilesAhead:
From AHK Forum search:
http://www.autohotkey.com/forum/topic42313.html&highlight=detect+full+screen+mode

animeaime's post in the thread

Ok. This should. I remember how NiftyWindows would always suspend on a full screen program. So, this should do the job. Use WinExist (or some other means) to get the Unique ID (HWND) of the desired window.


--- ---isWindowFullScreen(WinID)
{
    ;checks if the specified window is full screen
    ;code from NiftyWindows source
    ;(with only slight modification)

    ;use WinExist of another means to get the Unique ID (HWND) of the desired window

    if ( !WinID )
        return

    WinGet, WinMinMax, MinMax, ahk_id %WinID%
    WinGetPos, WinX, WinY, WinW, WinH, ahk_id %WinID%

    if (WinMinMax = 0) && (WinX = 0) && (WinY = 0) && (WinW = A_ScreenWidth) && (WinH = A_ScreenHeight)
    {
        WinGetClass, WinClass, ahk_id %WinID%
        WinGet, WinProcessName, ProcessName, ahk_id %WinID%
        SplitPath, WinProcessName, , , WinProcessExt

        if (WinClass != "Progman") && (WinProcessExt != "scr")
        {
            ;program is full-screen
            return true
        }
    }
}


edit: I haven't tried it but according to the help you can get the handle of the active window like this:  WinExist("A")

so isWindowFullScreen(WinExist("A")) should return true if the active "window" is in full screen mode.  At least for single monitor systems anyway.

If it returns true just Send the !{Enter}.  If not just eat the key combo.


--- ---!Enter::
  If isWindowFullScreen(WinExist("A"))
    Send, !{Enter}
  else
    ; send something else or just eat the keys
return

 

oblivion:
edit: I haven't tried it but according to the help you can get the handle of the active window like this:  WinExist("A")

so isWindowFullScreen(WinExist("A")) should return true if the active "window" is in full screen mode.  At least for single monitor systems anyway.

If it returns true just Send the !{Enter}.  If not just eat the key combo.
-MilesAhead (July 27, 2011, 04:42 PM)
--- End quote ---

Thanks, but...

 :( I can't make this work.

The dos app is running in a window with title "Joe System."

I'm using the code pretty much as you've given it, except that I'm using it after a


--- ---#IfWinActive, Joe System

directive.

It certainly blocks !{enter} as it should, but it continues to block it when the program's full screen.

I've tried to find variants on the WinExist("A") function to return the correct process in case the NTVDM doesn't react the way a fullscreen Windows program would -- which is what I suspect the issue is -- but I've had no success at all.

So still the only thing I can do is deactivate the script (I've set ^!x::ExitApp up at the top) and then use !{Enter}.

Can I check my understanding of this is right? The isWindowFullScreen function goes at the bottom of the script, after a return that ensures the code is only executed when called, WinID is the variable into which the value returned by WinExist("A") is stuffed, and the true returned by the function is the boolean state not a variable I need to initialise elsewhere?

If I have that right and I'm not missing something else I should be doing, then a fullscreen 16-bit DOS app can't be detected in the same way as a fullscreen Windows prog.  :(

-- bests, Tim

MilesAhead:
I would try commenting out the IfWinActive.  The hotkey should be global.

You are right about the function.  I'm on Win7 and if I do Alt Enter in a command prompt it tells me it's not supported. So I can't test the script.

Commenting out IfWinActive would be the first thing to try.
Also posting on AHK forum would get programmers with a lot more AHK experience than I have. I mainly use it if I need mouse hotkey support. I'm still a novice afa AHK goes. :)

MilesAhead:
Generally speaking it's a good practice to create a test stub.  Or in this case it may be suitable for a separate app.  Just create a script with

isWindowFullScreen(WinID)

function at the bottom and the
!Enter::

hotkey at the top,
until you get the feel of it, rather than sticking it into another script.
Get the simplest case working first before adapting it.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version