Howto hide window hide titlebar

Just starting out? Need help? Post your questions and find answers here.
karu
Enthusiast
Enthusiast
Posts: 255
Joined: Fri Jan 13, 2006 12:14 am

Howto hide window hide titlebar

Post by karu »

Is there somehow possible to make window borderless and back again after creating window?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Howto hide window hide titlebar

Post 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
BERESHEIT
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: Howto hide window hide titlebar

Post 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
Egypt my love
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Howto hide window hide titlebar

Post by netmaestro »

Well,NM posted some fine code faster than me
For a change! :lol: All the best in the new year RASHAD :mrgreen:
BERESHEIT
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: Howto hide window hide titlebar

Post by RASHAD »

Happy new year NM
I am glad that you are still here
Egypt my love
karu
Enthusiast
Enthusiast
Posts: 255
Joined: Fri Jan 13, 2006 12:14 am

Re: Howto hide window hide titlebar

Post by karu »

Thanks to all
Post Reply