
Code: Select all
Procedure toggleFullScreen() ; toggle FullScreen mode using F11
static w, h, x, y, fs
ExamineDesktops()
If fs=0 ;; not in full screen -> switch to full screen
w = WindowWidth(0 , #PB_Window_FrameCoordinate)
h = WindowHeight(0, #PB_Window_FrameCoordinate)
x = windowX(0)
y = windowY(0)
ResizeWindow(0,0,0,DesktopWidth(0),DesktopHeight(0))
SetWindowLongPtr_(WindowID(0),#GWL_STYLE,GetWindowLongPtr_(WindowID(0),#GWL_STYLE)&~#WS_CAPTION&~#WS_SIZEBOX)
fs = 1
Else ;; and back to normal mode
ResizeWindow(0,x,y,w,h)
SetWindowLongPtr_(WindowID(0),#GWL_STYLE,GetWindowLongPtr_(WindowID(0),#GWL_STYLE)|#WS_CAPTION|#WS_SIZEBOX)
fs = 0
EndIf
EndProcedure
OpenWindow(0,220,220,500,400,"*", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget)
TextGadget(1, 50, 50, 277, 33, "Press F11 for fullscreen mode")
AddKeyboardShortcut(0, #PB_Shortcut_F11, 14) : BindEvent(#PB_Event_Menu, @toggleFullScreen(), 0, 14)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow