Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Poor Man's Fullscreen


  • Please log in to reply
7 replies to this topic
q445
  • Guests
  • Last active:
  • Joined: --
Posted Image

- Removes the menu bars with by overlaying a black window for a poor man's fullscreen
- Good for those applications that you have to sit and think in front of.
- Autohides on mouse over.
- To exit, hold down the CONTROL key and mouse over.



#SingleInstance force
#NoEnv
CoordMode, mouse, screen

SCREEN_X = %A_ScreenWidth%
SCREEN_Y = %A_ScreenHeight%
if 0 = 4
{
	TOP = %1%
	BOT = %2%
	LEFT = %3%
	RIGHT = %4%
}
else
{
	TOP = 40
	BOT = 17
	LEFT= 17
	RIGHT = 15
}

Gui, Color, Black
Gui +LastFound +AlwaysOnTop +ToolWindow -Caption
WinSet, Region, % "0-0 " . SCREEN_X . "-0 " . SCREEN_X . "-" . SCREEN_Y . " 0-" . SCREEN_Y . " 0-0 " . LEFT . "-" . TOP . " " . SCREEN_X-RIGHT . "-" . TOP . " " . SCREEN_X-RIGHT . "-" . SCREEN_Y-BOT . " " . LEFT . "-" . SCREEN_Y-BOT . " " . LEFT . "-" . TOP
Gui, show,  % "W" . SCREEN_X . " H" . SCREEN_Y . " X0 Y0"
OnMessage(0x200, "WM_MOUSEMOVE")
Return

WM_MOUSEMOVE()
{
	global SCREEN_X, SCREEN_Y, TOP, BOT, LEFT, RIGHT

	GetKeyState, CtrlDwn, Ctrl
	if CtrlDwn = D
		ExitApp
	Gui, hide
	Loop
	{
		MouseGetPos, X, Y
		if (X>LEFT && X<SCREEN_X-RIGHT && Y>TOP && Y<SCREEN_Y-BOT)
			break
		Sleep, 1000
	}
	Gui, show, NA
    	return
}


not logged in crash23000
  • Guests
  • Last active:
  • Joined: --
thats pretty useful, nice job.

Raccoon
  • Members
  • 178 posts
  • Last active: Oct 06 2014 05:58 PM
  • Joined: 02 Jan 2008
What text editor are you using there, q445? "TED..." something?

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Here's my attempt at a generic full-screen hotkey.
!Enter::
    ifWinExist, ahk_id %FullscreenWindow%
    {
        if PMenu                    ; Restore the menu.
            DllCall("SetMenu", "UInt", FullscreenWindow, "UInt", PMenu)
        WinSet, Style, +0xC40000    ; Restore WS_CAPTION|WS_SIZEBOX.
        WinMove,,, PX, PY, PW, PH   ; Restore position and size.
        FullscreenWindow =
        return
    }

    WinGet, Style, Style, A
    if (Style & 0xC40000) != 0xC40000 ; WS_CAPTION|WS_SIZEBOX
        return

    FullscreenWindow := WinExist("A")
    
    WinGetPos, PX, PY, PW, PH
    
    ; Remove WS_CAPTION|WS_SIZEBOX.
    WinSet, Style, -0xC40000
    
    PMenu := DllCall("GetMenu", "UInt", FullscreenWindow)
    ; Remove the window's menu.
    if PMenu
        DllCall("SetMenu", "UInt", FullscreenWindow, "UInt", 0)
    
    ; Get the area of whichever monitor the window is on.
    SysGet, m, Monitor, % ClosestMonitorTo(PX + PW//2, PY + PH//2)
    
    ; Size the window to fill the entire screen.
    WinMove,,, mLeft, mTop, mRight-mLeft, mBottom-mTop
return

ClosestMonitorTo(X, Y)
{
    SysGet, MonitorCount, MonitorCount
    mD = a ; All numbers are < a.
    Loop %MonitorCount%
    {
        SysGet, m, Monitor, %A_Index%
        mX := mLeft + (mRight-mLeft)//2 - X
        mY := mTop + (mBottom-mTop)//2 - Y
        if (D := Sqrt(mX*mX + mY*mY)) < mD
        {
            m := A_Index
            mD := D
        }
    }
    return m
}
If the active window has a caption (title bar) and sizable border, they are removed and the window is sized to fit the screen. If the window has a standard menu, it is also removed. Pressing the hotkey again restores the window to the way it was.

It has multi-monitor support, though it can handle only one full-screen window at a time...

q455
  • Guests
  • Last active:
  • Joined: --
Yeah, I'm using TED editor -- it's not good, lacks infinite undo. I've just switched to that HIEditor that everyone here seems to like.
lexiKos -- I haven't even thought of that, it seems so obvious. There are obviously pros and cons of course -- but I like the idea: nice and simple.

These scripts always get more and more elaborate, once you have a nice little way to use autohotkey, you can add onto it forever. This version lets you determine the border by drawing on the screen (if you don't pass it 4 arguments) so you can black out the background on the fly.

Next step: customizable colors, background images, music player, hamster animations (in that order)

#SingleInstance force
#NoEnv
CoordMode, mouse, screen

SCREEN_X = %A_ScreenWidth%
SCREEN_Y = %A_ScreenHeight%
if 0 = 4
{
	TOP = %1%
	BOT = %2%
	LEFT = %3%
	RIGHT = %4%
	
	Gui, Color, Black
	Gui +LastFound +AlwaysOnTop +ToolWindow -Caption
	WinSet, Region, % "0-0 " . SCREEN_X . "-0 " . SCREEN_X . "-" . SCREEN_Y . " 0-" . SCREEN_Y . " 0-0 " . LEFT . "-" . TOP . " " . SCREEN_X-RIGHT . "-" . TOP . " " . SCREEN_X-RIGHT . "-" . SCREEN_Y-BOT . " " . LEFT . "-" . SCREEN_Y-BOT . " " . LEFT . "-" . TOP
	Gui, show,  % "W" . SCREEN_X . " H" . SCREEN_Y . " X0 Y0"
}
else
{	
	Gui, Color, Black
	Gui +LastFound +AlwaysOnTop +ToolWindow -Caption
	Winset, Transparent, 200
	Gui, show,  % "W" . SCREEN_X . " H" . SCREEN_Y . " X0 Y0"
	
	Loop ;Wait for first mouse click
	{
		GetKeyState, MouseDown, LButton, P
		if MouseDown = D
			Break
		MouseGetPos, AX, AY
		Sleep 100
	}
	TOP := AY
	LEFT := AX
	Loop ;Wait for release
	{
		MouseGetPos, BX, BY
		BOT := SCREEN_Y-BY
		RIGHT := SCREEN_X-BX
		WinSet, Region, % "0-0 " . SCREEN_X . "-0 " . SCREEN_X . "-" . SCREEN_Y . " 0-" . SCREEN_Y . " 0-0 " . LEFT . "-" . TOP . " " . SCREEN_X-RIGHT . "-" . TOP . " " . SCREEN_X-RIGHT . "-" . SCREEN_Y-BOT . " " . LEFT . "-" . SCREEN_Y-BOT . " " . LEFT . "-" . TOP
		GetKeyState, MouseDown, LButton, P
		if MouseDown != D
			Break
		Sleep 500
	}
	Winset, Transparent, 255
	
	If (TOP + BOT > SCREEN_Y)
	{
		TOP := SCREEN_Y-BOT
		BOT := SCREENY_Y-TOP
	}
	If (LEFT + RIGHT > SCREEN_X)
	{
		LEFT := SCREEN_Y-RIGHT
		RIGHT := SCREENY_Y-LEFT
	}
}
OnMessage(0x200, "WM_MOUSEMOVE")
Return
	
WM_MOUSEMOVE()
{
	global SCREEN_X, SCREEN_Y, TOP, BOT, LEFT, RIGHT

	GetKeyState, CtrlDwn, Ctrl
	if CtrlDwn = D
		ExitApp
	Gui, hide
	Loop
	{
		MouseGetPos, X, Y
		if (X>LEFT && X<SCREEN_X-RIGHT && Y>TOP && Y<SCREEN_Y-BOT)
			break
		Sleep, 1000
	}
	Gui, show, NA
    	return
}


Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006
Nice!
Joyce Jamce

NoobyGuest
  • Guests
  • Last active:
  • Joined: --

It has multi-monitor support, though it can handle only one full-screen window at a time...


Would very much like to see a multi-window version! I can't seem to make the right modifications, it must be getting a window reference and sticking to that but can't find where to change that method when it's activated.

To be honest it took me a few minutes to figure out that the ifWinExist was to undo fullscreen...

q335r49
  • Members
  • 28 posts
  • Last active: Mar 30 2010 04:05 AM
  • Joined: 26 Oct 2005
Hey, I'm surprised this is still up here. I've actually found it quite useful, as I write my paper. Try the new version "Distraction Elimination / Full Screen Script", which is basically the same thing, with a few bonuses or variations. (But still no dual screen).

<!-- m -->http://www.autohotke...pic.php?t=51664<!-- m -->