Remove Title Bar completely or be able to color Title Bar

Windows specific forum
Mike Yurgalavage
Enthusiast
Enthusiast
Posts: 118
Joined: Thu May 17, 2007 8:35 pm
Location: USA

Remove Title Bar completely or be able to color Title Bar

Post by Mike Yurgalavage »

Or both?

Look at this code:

Code: Select all

Global MainWindow = OpenWindow(#PB_Any, 0, 0, 800, 800, "",   #WS_SIZEBOX | #PB_Window_BorderLess |#PB_Window_ScreenCentered )
WindowBounds(MainWindow, 800, 800, 10000, 10000) 
SetWindowColor(MainWindow, RGB(1,200,200)) 

MainLoop:

Repeat
    Event = WindowEvent()
    If Event And EventWindow()=MainWindow
      Debug Event
    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf
    EndIf
  Until Quit = 1
  
 End
I need:

1) the titlebar gone COMPLETELY. A simple solution is best, if possible. Using #WS_SIZEBOX and #PB_Window_BorderLess as a combo almost does it, but on Windows 10, there is a small white bar still present, why? Is there another combo that removes it? I don't mind the black line at the border, just want it resizeable and no titlebar.

2) or if this 'has' to be this way, a way to color the white bar (titlebar) so that it's matching the rest of the window background.

3) the window needs to be resizable! So it's needing resizable ability, no titlebar, or the white bar gone completely.

It seems Windows should have some sort of combo already that does this. I mean, many people like apps with ability to resize, but maybe no title bar...

The platform is modern windows OS (windows 7 and up), but looking mostly for Windows 10 and beyond solution.

Any help is appreciated!

best,
Mike
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4637
Joined: Sun Apr 12, 2009 6:27 am

Re: Remove Title Bar completely or be able to color Title Ba

Post by RASHAD »

Hi

Code: Select all

Procedure WndProc(hwnd, uMsg, wParam, lParam)
  result = #PB_ProcessPureBasicEvents
  Select uMsg          
    Case #WM_NCCALCSIZE
      If OSVersion() >= #PB_OS_Windows_10
        *rc.RECT=lParam
        *rc\top - 5
      EndIf 
     
    Case #WM_NCACTIVATE
      result = 1      
     
    Case #WM_EXITSIZEMOVE
      InvalidateRect_(hwnd,0,#True)
    
   EndSelect   
  ProcedureReturn result
EndProcedure

Global MainWindow = OpenWindow(#PB_Any, 0, 0, 800, 800, "",   #WS_SIZEBOX | #PB_Window_BorderLess |#PB_Window_ScreenCentered)
WindowBounds(MainWindow, 800, 800, 10000, 10000)
SetWindowColor(MainWindow, RGB(1,200,200))
SetWindowCallback(@WndProc())
MainLoop:

Repeat
    Event = WindowEvent()
    If Event And EventWindow()=MainWindow
      Debug Event
    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf
    EndIf
  Until Quit = 1
 
 End
Egypt my love
Post Reply