Jump to content

Is this a bug with WinMove and Vista?


ChrisL
 Share

Recommended Posts

In Vista if you create a child GUI and use WinMove with a Width and Height set to -1 the control dissapear, it's fine in XP though.

Width and Height are supposed to be optional, in XP I have always set them to -1 to leave the gui the same size as it was before, but in Vista you have to specify the Width and Height if you are using the last parameter of Speed. If no 5th, 6th and 7th parameter are specified it moves OK and the controls remain

Is this a bug in Vista or an anomaly of XP? Not tried in Win7 as I don't have it.

If Width and Height are optional what are you supposed to use to leave the values the same?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Parent = GuiCreate("Parent",800,600)
GUISetState(@SW_SHOW)
$Child = GuiCreate("",200,400,0,0, $WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$Parent)
GuiCtrlCreatePic(@desktopdir & "\cropped.jpg",0,0,100,100)
GuisetState(@SW_SHOW)


Sleep(2000)
WinMove($Child,"",400,400,-1,-1,5) ;Any controls drawn on the child will vanish when width and height are set to -1 but only in Vista but W&H are supposed to be optional
Sleep(2000)
WinMove($Child,"",400,400,200,400,5);Reset a W & H and the controls come back

Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

Instead of -1, you could try using "Default" in its place. This will set the the parameters to whatever the default is supposed to be.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Link to comment
Share on other sites

Glad I could help.;)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...