Fullscreen Switcher

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Fullscreen Switcher

Post by RSBasic »

Hello :)

With this tool you can switch the IDE window to full screen mode and to normal mode with a keyboard shortcut.
There are two full screen variants:
  • /FullscreenType=1: No window border, no title bar, no MenuBar, no ToolBar, no TabBar
  • /FullscreenType=2: No window border, no title bar, no MenuBar
Installation:
Image

Download: https://www.rsbasic.de/downloads/downlo ... itcher.zip
Image

I would be very pleased about feedbacks, improvement suggestions, error messages or wishes. Thanks :)
Image
Image
User avatar
Michael Vogel
Addict
Addict
Posts: 2677
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Fullscreen Switcher

Post by Michael Vogel »

Here's the source to do build your own tool...

Code: Select all

pos.WINDOWPLACEMENT
title.s="xxxxxxxxxx"

CompilerIf #PB_Compiler_Debugger
	win=FindWindow_(0,"PureBasic 5.46 LTS (x86) - Fully.pb")
CompilerElse
	win=GetForegroundWindow_()
CompilerEndIf

Procedure WindowBorder(Window, Flag)
	SetWindowLongPtr_(Window,#GWL_STYLE,Flag)
	SetWindowPos_(Window,0,0,0,0,0,#SWP_NOSIZE|#SWP_NOMOVE|#SWP_NOZORDER|#SWP_FRAMECHANGED)
EndProcedure

#BorderNoCaption=	#WS_CLIPSIBLINGS | #WS_VISIBLE | #WS_POPUP  |#WS_THICKFRAME
#BorderPureBasic=	$14CF0000

If win
	GetWindowText_(win,@title,10)
	If title="PureBasic"
		GetWindowPlacement_(win,pos)
		If pos\showCmd=#SW_SHOWMAXIMIZED
			ShowWindow_(win,#SW_RESTORE)
			WindowBorder(win,#BorderPureBasic)
		Else
			WindowBorder(win,#BorderNoCaption)
			ShowWindow_(win,#SW_SHOWMAXIMIZED)
		EndIf
	EndIf
EndIf

User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Fullscreen Switcher

Post by RSBasic »

@Michael Vogel
Your code would be this:
  • /FullscreenType=1: No window border, no title bar, no MenuBar, no ToolBar, no TabBar
  • /FullscreenType=2: No window border, no title bar, no MenuBar
  • /FullscreenType=3: No window border, no title bar
:lol:
Michael Vogel wrote:

Code: Select all

win=FindWindow_(0,"PureBasic 5.46 LTS (x86) - Fully.pb")
No recommendation. Then you would have to change it with every new PB version. Better would be EnumWindows_() and GetWindowThreadProcessId_() and CreateToolhelp32Snapshot_().
Image
Image
User avatar
Michael Vogel
Addict
Addict
Posts: 2677
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Fullscreen Switcher

Post by Michael Vogel »

Quite sure, you've already seen that the "Fully.pb" line is used to simplify testing the code from the editor... :lol:

Still a simple code (around 50 code lines whithout the declarations) but closer to full screen mode - only the child window containing the source code needs to be updated.

Code: Select all

; Define

	win.i
	menu.i
	bar.i
	tab.i
	
	mode.i
	handle.i
	pos.WINDOWPLACEMENT
	s.s="xxxxxxxxxx"
	
	#NameLength=32
	#PureVersion="5.46 LTS (x86)"

	EnableExplicit
	
	mode=GetKeyState_(#VK_SHIFT)&128

; EndDefine

CompilerIf #PB_Compiler_Debugger
	win=FindWindow_(0,"PureBasic "+#PureVersion) + FindWindow_(0,"PureBasic "+#PureVersion+" - Fully.pb")
CompilerElse
	win=GetForegroundWindow_()
CompilerEndIf


Procedure WindowBorder(Window, Flag)
	SetWindowLongPtr_(Window,#GWL_STYLE,Flag)
	SetWindowPos_(Window,0,0,0,0,0,#SWP_NOSIZE|#SWP_NOMOVE|#SWP_NOZORDER|#SWP_FRAMECHANGED)
EndProcedure

#BorderNoCaption=	#WS_CLIPSIBLINGS | #WS_VISIBLE | #WS_POPUP  |#WS_THICKFRAME
#BorderDefault=		#WS_CLIPSIBLINGS | #WS_VISIBLE | #WS_CAPTION | #WS_SYSMENU| #WS_MAXIMIZEBOX | #WS_MINIMIZEBOX
#BorderPureBasic=	#WS_CLIPSIBLINGS|#WS_VISIBLE|#WS_BORDER|#WS_DLGFRAME|#WS_SYSMENU|#WS_THICKFRAME|#WS_MINIMIZEBOX|#WS_MAXIMIZEBOX

If win
	GetWindowText_(win,@s,10)
	If s="PureBasic"
		GetWindowPlacement_(win,pos)
		menu=GetMenu_(win)

		If mode
			handle=GetWindow_(win,#GW_CHILD)
			While handle
				s=Space(#NameLength)
				;GetWindowText_(Handle,@s,#NameLength)
				GetClassName_(Handle,@s,#NameLength)
				If s="ToolbarWindow32"
					bar=handle
				ElseIf s="PureContainer"
					If tab=#Null
						tab=GetWindow_(handle,#GW_CHILD)
						If tab : tab=GetWindow_(tab,#GW_HWNDLAST) : EndIf
					EndIf
				EndIf
				handle=GetWindow_(handle,#GW_HWNDNEXT)
			Wend
		EndIf
		
		If pos\showCmd=#SW_SHOWMAXIMIZED
			ShowWindow_(win,#SW_RESTORE)
			If mode
				If menu=#Null : menu=GetWindowLong_(win,#GWL_USERDATA) : EndIf
				SetMenu_(win,menu)
				ShowWindow_(tab,#SW_SHOW)
				ShowWindow_(bar,#SW_SHOW)
			EndIf
			WindowBorder(win,#BorderPureBasic)
		Else
			SetWindowLong_(win,#GWL_USERDATA,menu)
			If mode
				SetMenu_(win,#Null)
				ShowWindow_(bar,#SW_HIDE)
				ShowWindow_(tab,#SW_HIDE)
			EndIf
			WindowBorder(win,#BorderNoCaption)
			ShowWindow_(win,#SW_SHOWMAXIMIZED)
		EndIf
	EndIf
EndIf

User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Fullscreen Switcher

Post by RSBasic »

Fullscreen Switcher 1.0.1 has been released.

Changelog:
  • Bugfix: Tool tabs were not visible
Image
Image
Post Reply