Remove window title bar on run-time

Just starting out? Need help? Post your questions and find answers here.
User avatar
silvercover
User
User
Posts: 86
Joined: Sat Aug 04, 2007 6:57 pm

Remove window title bar on run-time

Post by silvercover »

Hi,

I need to remove window title bar on run-time as shown below:

Normal mode:
Image

After removing:

Image

How can I do this?

Thanks.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Windows only :

Code: Select all

If OpenWindow(0, 0, 0, 222, 200, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
  hWnd = WindowID(0)
  ButtonGadget(0, 10, 10, 200, 20, "Click")
  Repeat
    eventID = WaitWindowEvent()
    If eventID = #PB_Event_Gadget
      SetWindowLong_(hWnd, #GWL_STYLE, GetWindowLong_(hWnd, #GWL_STYLE)&~#WS_CAPTION&~#WS_SIZEBOX)
      SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_NOMOVE|#SWP_NOSIZE|#SWP_NOZORDER|#SWP_FRAMECHANGED|#SWP_DRAWFRAME)
    EndIf
  Until eventID = #PB_Event_CloseWindow
EndIf
I may look like a mule, but I'm not a complete ass.
User avatar
Michael Vogel
Addict
Addict
Posts: 2808
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

Code: Select all

i=OpenWindow(0,0,0,100,100,"*",#PB_Window_ScreenCentered)
;imagegadget...
Delay(1000)
SetWindowLong_(i,#GWL_STYLE,GetWindowLong_(i,#GWL_STYLE)&~#WS_CAPTION)

Repeat
Until WindowEvent()=#WM_CHAR
Too late :cry:
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

You could try knocking it off...

http://www.lloydsplace.com/resize.exe
BERESHEIT
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

hehe, that gets my vote! :)
I may look like a mule, but I'm not a complete ass.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

Saw that quite a while back and still laugh at it:)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

I thought it was possible with SetWindowState....

just tried it now and was very dissappointed!
oh... and have a nice day.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

netmaestro wrote:You could try knocking it off...

http://www.lloydsplace.com/resize.exe
Triggers a virus / trojan warning here. False perhaps, but nevertheless.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Code is here:

http://www.purebasic.fr/english/viewtop ... 9&start=25

See for yourself there's no viruses in it.
BERESHEIT
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Just FYI :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
silvercover
User
User
Posts: 86
Joined: Sat Aug 04, 2007 6:57 pm

Post by silvercover »

Thank you very much guys. your help guided me through window manipulations which I feel I like it.

I have another simple question. how can I revert back the window style to normal mode? I tried to remove NOT operand and did some test but nothing happened.

Thanks.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Did you remember to use SetWindowPos? Using srod's example, and typing fast to try and beat him,

Code: Select all

If OpenWindow(0, 0, 0, 222, 200, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget) 
  hWnd = WindowID(0) 
  ButtonGadget(0, 10, 10, 200, 20, "Click") 
  borderless = 0
  Repeat 
    eventID = WaitWindowEvent() 
    If eventID = #PB_Event_Gadget 
      If Not borderless
        SetWindowLong_(hWnd, #GWL_STYLE, GetWindowLong_(hWnd, #GWL_STYLE)&~#WS_CAPTION&~#WS_SIZEBOX) 
        SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_NOMOVE|#SWP_NOSIZE|#SWP_NOZORDER|#SWP_FRAMECHANGED|#SWP_DRAWFRAME)
      Else 
        SetWindowLong_(hWnd, #GWL_STYLE, GetWindowLong_(hWnd, #GWL_STYLE)|#WS_CAPTION|#WS_SIZEBOX) 
        SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_NOMOVE|#SWP_NOSIZE|#SWP_NOZORDER|#SWP_FRAMECHANGED|#SWP_DRAWFRAME)
      EndIf  
      borderless = 1-borderless
    EndIf 
  Until eventID = #PB_Event_CloseWindow 
EndIf 
BERESHEIT
User avatar
silvercover
User
User
Posts: 86
Joined: Sat Aug 04, 2007 6:57 pm

Post by silvercover »

Thank you netmaestro. you are winner! :D
Post Reply