SetWindowState unhides - Bug or Feature?

Windows specific forum
dige
Addict
Addict
Posts: 1417
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

SetWindowState unhides - Bug or Feature?

Post by dige »

I'm not sure. Should it be possible to maximize an hidden window?

I'd like to create a window with lot of gadgets and restore it with
the styles and dimensions from a saved session.
And only wants to show if everything is ready..

Code: Select all

OpenWindow(0, 0, 0, 800, 600, "SetWindowStateBug", #PB_Window_SystemMenu|#PB_Window_Invisible)
MessageRequester( "", "Windows is unvisible", 0 )
; Window should stay unvisible..
SetWindowState( 0, #PB_Window_Maximize )
MessageRequester( "", "Windows is still unvisible??", 0 )
HideWindow(0, #False)
MessageRequester( "", "Windows is now visible", 0 )
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Last edited by dige on Thu May 08, 2008 11:16 am, edited 1 time in total.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4792
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

HideWindow(#Window_Icat, 0) ; Unhide the window now

Didn't unhide it!!

SetWindowState(#Window_Icat, #PB_Window_Normal)

Now it did.

Found this for a couple of pb versions to 4.10. Haven't tried it with 4.2 yet. Even with the maximize flag, same problem.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

dige:
Its a Windows feature i guess. SetWindowState simply calls ShowWindow(x, SW_MAXIMIZE),
and it seems this cannot be combined with SW_HIDE:

Code: Select all

OpenWindow(0, 0, 0, 800, 600, "SetWindowStateBug", #PB_Window_SystemMenu|#PB_Window_Invisible)
MessageRequester( "", "Windows is unvisible", 0 )
; Window should stay unvisible..
;SetWindowState( 0, #PB_Window_Maximize )
ShowWindow_(WindowID(0), #SW_MAXIMIZE|#SW_HIDE)
MessageRequester( "", "Windows is still unvisible??", 0 )
HideWindow(0, #False)
MessageRequester( "", "Windows is now visible", 0 )
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
Fangbeast: show some code please.

Maybe you just have the window in the minimized state and then showing it will of course not make
it appear on screen.
quidquid Latine dictum sit altum videtur
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

As a solution, it seems to work if you create the window invisible and maximised, so you would have to get the sizes from your session and apply them at the point you create the Window.

Code: Select all

OpenWindow(0, 0, 0, 0, 0, "SetWindowStateBug", #PB_Window_SystemMenu|#PB_Window_Invisible|#PB_Window_Maximize)
MessageRequester( "", "Windows is unvisible", 0 )
; Window should stay unvisible..
;SetWindowState( 0, #PB_Window_Maximize )
;MessageRequester( "", "Windows is still unvisible??", 0 )
HideWindow(0, #False)
MessageRequester( "", "Windows is now visible", 0 )
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
dige
Addict
Addict
Posts: 1417
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

@Tinman: good idea! thanks
Post Reply