[Solved] Resize and move window before unhiding?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

[Solved] Resize and move window before unhiding?

Post by Michael Vogel »

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.
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Resize and move window before unhiding?

Post by RSBasic »

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
Image
Image
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Resize and move window before unhiding?

Post by Michael Vogel »

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 :wink:

Now back home, I checked your example, it works fine :shock:
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)
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: [Solved] Resize and move window before unhiding?

Post by VB6_to_PBx »

Code: Select all

;SetWindowPos_(WnidowID(0),#HWND_NOTOPMOST,100,100,200,200,#SWP_NOREDRAW)
you had WnidowID misspelled ...WindowID

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
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: [Solved] Resize and move window before unhiding?

Post by Michael Vogel »

Yes, that happens, when you don't do copy and paste - in the original code there was no typo :lol:
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Resize and move window before unhiding?

Post by Dude »

Michael Vogel wrote:I will add [Solved] the topic name even when this miracle will never be solved.
You can definitely resize and move a window before unhiding it, yes. I've been doing it for years.
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: [Solved] Resize and move window before unhiding?

Post by Michael Vogel »

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... :oops:
Post Reply