Page 1 of 1
Remove window title bar on run-time
Posted: Tue Apr 14, 2009 9:50 am
by silvercover
Hi,
I need to remove window title bar on run-time as shown below:
Normal mode:
After removing:
How can I do this?
Thanks.
Posted: Tue Apr 14, 2009 11:45 am
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
Posted: Tue Apr 14, 2009 11:49 am
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

Posted: Tue Apr 14, 2009 3:23 pm
by netmaestro
Posted: Tue Apr 14, 2009 5:59 pm
by srod
hehe, that gets my vote!

Posted: Tue Apr 14, 2009 10:20 pm
by Fangbeast
Saw that quite a while back and still laugh at it:)
Posted: Wed Apr 15, 2009 1:43 pm
by Kaeru Gaman
I thought it was possible with SetWindowState....
just tried it now and was very dissappointed!
Posted: Wed Apr 15, 2009 3:48 pm
by blueznl
Triggers a virus / trojan warning here. False perhaps, but nevertheless.
Posted: Wed Apr 15, 2009 4:04 pm
by netmaestro
Code is here:
http://www.purebasic.fr/english/viewtop ... 9&start=25
See for yourself there's no viruses in it.
Posted: Wed Apr 15, 2009 6:46 pm
by blueznl
Just FYI

Posted: Fri Apr 17, 2009 6:39 pm
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.
Posted: Fri Apr 17, 2009 6:51 pm
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
Posted: Fri Apr 17, 2009 7:04 pm
by silvercover
Thank you netmaestro. you are winner!
