Page 1 of 1

Howto hide window hide titlebar

Posted: Wed Jan 01, 2014 7:26 pm
by karu
Is there somehow possible to make window borderless and back again after creating window?

Re: Howto hide window hide titlebar

Posted: Wed Jan 01, 2014 7:46 pm
by netmaestro
If you're on Windows it's straightforward enough. On other OS's, I don't know how. Natively it isn't possible.

Code: Select all

OpenWindow(0,0,0,640,480,"",#PB_Window_ScreenCentered|#PB_Window_BorderLess)
AddWindowTimer(0,1,2000)
Repeat
  ev=WaitWindowEvent()
  Select ev
    Case #PB_Event_Timer
      If EventTimer()=1
        SetWindowLongPtr_(WindowID(0),#GWL_STYLE, GetWindowLongPtr_(WindowID(0),#GWL_STYLE) | #WS_CAPTION|#WS_BORDER|#WS_SYSMENU)
        SetWindowPos_(WindowID(0),0,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE|#SWP_NOZORDER|#SWP_FRAMECHANGED)
      EndIf
  EndSelect
Until ev=#PB_Event_CloseWindow

Re: Howto hide window hide titlebar

Posted: Wed Jan 01, 2014 7:48 pm
by RASHAD
F11 for Border - Borderless

Code: Select all

OpenWindow(0,0,0,400,300,"Test",#PB_Window_SystemMenu| #PB_Window_ScreenCentered|#PB_Window_SizeGadget)
SetWindowColor(0,#Gray)

Repeat
  Select WaitWindowEvent()
      
      Case #PB_Event_CloseWindow
            Quit = 1
       
      
      Case #PB_Event_Gadget
            Select EventGadget()
             Case 1            
            EndSelect
             
      Case #WM_KEYDOWN
            Run ! 1
            If Run = 1 And EventwParam() = 122
               SetWindowLongPtr_(WindowID(0), #GWL_STYLE, GetWindowLongPtr_(WindowID(0), #GWL_STYLE)&~ #WS_THICKFRAME &~ #WS_DLGFRAME)
            ElseIf Run = 0 And EventwParam() = 122
               SetWindowLongPtr_(WindowID(0), #GWL_STYLE, GetWindowLongPtr_(WindowID(0), #GWL_STYLE)|#WS_DLGFRAME)
            EndIf
            
      Case #WM_LBUTTONDOWN
            If Run = 1
               SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
            EndIf
             
  EndSelect 

Until Quit = 1
End
Well,NM posted some fine code faster than me

Re: Howto hide window hide titlebar

Posted: Wed Jan 01, 2014 7:53 pm
by netmaestro
Well,NM posted some fine code faster than me
For a change! :lol: All the best in the new year RASHAD :mrgreen:

Re: Howto hide window hide titlebar

Posted: Wed Jan 01, 2014 7:56 pm
by RASHAD
Happy new year NM
I am glad that you are still here

Re: Howto hide window hide titlebar

Posted: Wed Jan 01, 2014 10:22 pm
by karu
Thanks to all