PureBasic Forum
https://www.purebasic.fr/english/

Remove Title Bar completely or be able to color Title Bar
https://www.purebasic.fr/english/viewtopic.php?f=5&t=72577
Page 1 of 1

Author:  Mike Yurgalavage [ Wed Apr 03, 2019 3:49 pm ]
Post subject:  Remove Title Bar completely or be able to color Title Bar

Or both?

Look at this code:

Code:
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

Author:  RASHAD [ Wed Apr 03, 2019 5:35 pm ]
Post subject:  Re: Remove Title Bar completely or be able to color Title Ba

Hi
Code:
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

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/