[Solved] Resize and move window before unhiding?
- Michael Vogel
- Addict
- Posts: 2807
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
[Solved] Resize and move window before unhiding?
I'd like to set the position of a window before unhiding it, but this doesn't seem to be possible. Is this correct?
Last edited by Michael Vogel on Tue Apr 10, 2018 12:05 pm, edited 1 time in total.
- RSBasic
- Moderator
- Posts: 1228
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: Resize and move window before unhiding?
What do you mean exactly?
Code: Select all
EnableExplicit
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_Invisible)
ResizeWindow(0, 100, 100, #PB_Ignore, #PB_Ignore)
HideWindow(0, 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
- Michael Vogel
- Addict
- Posts: 2807
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Resize and move window before unhiding?
Good question, I've updated a source code* yesterday and saw, that the - more or less - empty window will be displayed immediate after the WinResize command and it takes some moments (my program fills some gadgets with contents etc.) before the window should be seen (by the command HideWindow).
I tried a lot of things (SetWindowPos,...) but nothing has changed. Implemented some other ideas today in the morning, no change. I took my notebook to my work, another try, same result - so I had to ask the experts
Now back home, I checked your example, it works fine
My source code from yesterday? The compiled exe from yesterday? Everything works as expected.
I did not make any reboot nor I opened or closed any programs on my notebook, I have no idea why it didn't work for many hours and now everything has changed. I will add [Solved] the topic name even when this miracle will never be solved.
___
*) if you are curious, here's the program I was working on: SpeedRename (german only)
I tried a lot of things (SetWindowPos,...) but nothing has changed. Implemented some other ideas today in the morning, no change. I took my notebook to my work, another try, same result - so I had to ask the experts

Now back home, I checked your example, it works fine

My source code from yesterday? The compiled exe from yesterday? Everything works as expected.
I did not make any reboot nor I opened or closed any programs on my notebook, I have no idea why it didn't work for many hours and now everything has changed. I will add [Solved] the topic name even when this miracle will never be solved.
Code: Select all
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_Invisible)
ResizeWindow(0, 100, 100, 200,200)
;SetWindowPos_(WnidowID(0),#HWND_NOTOPMOST,100,100,200,200,#SWP_NOREDRAW)
Debug "hidden ?"
Delay(1000)
HideWindow(0, 0)
Debug "visible"
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
*) if you are curious, here's the program I was working on: SpeedRename (german only)
- VB6_to_PBx
- Enthusiast
- Posts: 627
- Joined: Mon May 09, 2011 9:36 am
Re: [Solved] Resize and move window before unhiding?
Code: Select all
;SetWindowPos_(WnidowID(0),#HWND_NOTOPMOST,100,100,200,200,#SWP_NOREDRAW)
Code: Select all
SetWindowPos_(WindowID(0),#HWND_NOTOPMOST,100,100,200,200,#SWP_NOREDRAW)
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
- Michael Vogel
- Addict
- Posts: 2807
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: [Solved] Resize and move window before unhiding?
Yes, that happens, when you don't do copy and paste - in the original code there was no typo 

Re: Resize and move window before unhiding?
You can definitely resize and move a window before unhiding it, yes. I've been doing it for years.Michael Vogel wrote:I will add [Solved] the topic name even when this miracle will never be solved.
- Michael Vogel
- Addict
- Posts: 2807
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: [Solved] Resize and move window before unhiding?
Yes, indeed.
Still have no idea, why windows has changed it's behaviour for some hours?! The result was a really ugly effect and made me extremly nervous. In my panik I even thought to create a thread to do the resizing with a delay...
Still have no idea, why windows has changed it's behaviour for some hours?! The result was a really ugly effect and made me extremly nervous. In my panik I even thought to create a thread to do the resizing with a delay...
