September 26, 2020, 06:01:56 pm

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Hidden Window

Started by aurelCB, February 11, 2009, 02:58:22 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aurelCB

Hi ...

I tried to open the window as hidden with SW_HIDE but without success.
-------------------------------------------------------
CONST SW_HIDE = 0
Window win,0,0,400,300,@minbox|SW_HIDE,0,"Hidden",main
----------------------------------------------------------------
Then I tried to take the flag from hidden button, and I managed.
----------------------------------------------------------------
0x40080001
Window win,0,0,400,300,@minbox|0x40080001,0,"Hidden",main
----------------------------------------------------------------
Does someone maybe some better idea?
So,How to create a new window as hidden without the flashing?
forum for hobby programming:<br />https://aurelsoft.ucoz.com

LarryMc

create the window offscreen with something like:

Window win,-1000,0,400,300,@minbox|0x40080001,0,"Hidden",main
then use

SETSIZE win,0, 0, 400, 300

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

aurelCB

Larry...

I dont want create window out off screen.
I want create window as hidden like in Emergance with flag @hide.

My second example work.
Code Select
Window win,0,0,400,300,@minbox|0x40080001,0,"Hidden",main

But I dont uderstand how work SW_HIDE ???
forum for hobby programming:<br />https://aurelsoft.ucoz.com

sapero

Zlatko, SW_HIDE and other SW_* are reserved for use in ShowWindow and a few other api's like ShellExecute, CreateProcess.
You cound try to hide the window while processing @IDCREATE by calling ShowWindow win, @SWHIDE.
Code Select
def win:window
Window win,0,0,400,300,@minbox|0x40080001,0,"Hidden",main
waituntil win=0
end
sub main
select @class
case @idcreate
showwindow win, @SWHIDE
starttimer win, 2000
case @IDTIMER
stoptimer win, 1
showwindow win, @SWRESTORE
case @IDCLOSEWINDOW
closewindow win
endselect
return
But it does not work, because the runtime forces the window to be visible.

There is a 'advanced' message WM_WINDOWPOSCHANGING where you can deny or update any changes to window position, size or z-order, by manipulating members of WINDOWPOS structure pointed by @LPARAM (it should work, but I'm unhappy to compile this snippet, I'm getting errors like WINDOWPOS is undefined)
Code Select
def win:window
forcehide = 1
Window win,0,0,400,300,@minbox|0x40080001,0,"Hidden",main
waituntil win=0
end

CONST WM_WINDOWPOSCHANGING = 0x46
const SWP_SHOWWINDOW = 0x40

type WINDOWPOS
    def hwnd:int
    def hwndInsertAfter:int
    def x:int
    def y:int
    def cx:int
    def cy:int
    def flags:int
endtype


sub main
def wp:WINDOWPOS
def mem:memory

select @CLASS
case @IDCREATE
' show the window with 2 second delay
starttimer win, 2000

case WM_WINDOWPOSCHANGING
if forcehide
mem = @QUAL
readmem mem, 1, wp
wp.flags = wp.flags & (0xffffffff - SWP_SHOWWINDOW): ' remove SWP_SHOWWINDOW flag
writemem mem, 1, wp
forcehide = 0
endif

case @IDTIMER
stoptimer win, 1
forcehide = 0
showwindow win, @SWRESTORE

case @IDCLOSEWINDOW
closewindow win
endselect
return

aurelCB

Hi Sapero...

Hmm this is very tricky...
I dont know how this work but work.
And only work when is :
Code Select
case @idcreate
centerwindow win

Really weird.
I try this hiding with Abasic runtime.exe where is main window hidden and work. ::)

Here is last try:
Code Select
' main hidden
def win,win2:window
def hide:int
'const SW_HIDE=0
CONST WS_VISIBLE = 0x10000000

Window win,0,0,550,400,@minbox|0x40080001,0,"Main Window",main
Setwindowcolor win,rgb(200,200,210)
CONTROL win,"B,Show Hidden,450,50,90,20,0,1"
'hidden in start
hide=1
Window win2,10,10,400,300,@minbox,0,"Hidden",hmain
'showwindow win2,@swhide
CONTROL win2,"B,Show Hidden,300,50,90,20,0,2"
'showwindow win2,@swrestore
move win2,10,10:print win2,"Window 2"

waituntil win2=0
'IF win2<>0 then closewindow win2
END
'----------------------------
SUB main
select @class
case @IDclosewindow
closewindow win
case @idcreate
centerwindow win
case @idcontrol
IF @controlid=1
IF win2=0
closewindow win
end
ENDIF
ENDIF

endselect
RETURN
'-------------------------
SUB hmain
select @class
case @IDclosewindow
closewindow win2
case @idcreate
centerwindow win2
case @idcontrol
IF @controlid=2
IF (hide=1)
'showwindow win,@swrestore
SENDMESSAGE win,0x10000000,0,0
messagebox win,"Window 1 unable to open","Error"
Endif
ENDIF

endselect
RETURN
forum for hobby programming:<br />https://aurelsoft.ucoz.com

aurelCB

Just one interesting thing ...
all controls which is created with turn off checkbox "Visible" in gui builder have
flag 0x40080001.
Is this flag universal or not?
forum for hobby programming:<br />https://aurelsoft.ucoz.com

sapero

The high part 4008 (16 bits) describes system wide window styles (WS_*** constants: visible, caption, border, tabstop, minbox, maxbox) and has same meaning for any type of window. The low part 0001 (16 bits) describes individual styles for single control type or class. For buttons and checkboxes you use BS_ constants. For listview LVS_ ...

aurelCB

Thanks Sapero...
I dont know that, interesting...
So catch is in first part.
ok
forum for hobby programming:<br />https://aurelsoft.ucoz.com