cannondale Posted July 16, 2013 Posted July 16, 2013 Guys, I'm running the following uncompiled code under Win7 64: msgbox(0, "WinExists", WinExists("ABC")) ;Returns 1 msgbox(0, "WinGetState", WinGetState("ABC")) ;Returns 15 $EC = WinSetTitle("ABC", "", "XYZ") msgbox(0, "WinSetTitle", $EC) ;Returns 0 The WinSetTitle function fails to change the title and returns 0 under Win7. However, the code works correctly under XP. What am I missing?
Artisan Posted July 16, 2013 Posted July 16, 2013 (edited) I tested with the following code on both Win7 x32 and Win7 x64 (I don't have a WinXP copy to test with): $OldTitle = "AutoIt Help" $NewTitle = "This is a test." msgbox(0, "WinExists", WinExists($OldTitle)) ; Returns 1 msgbox(0, "WinGetState", WinGetState($OldTitle)) ; Returns 39 (32 + 4 + 2 + 1) msgbox(0, "WinSetTitle", WinSetTitle($OldTitle, "", $NewTitle)) ; Returns 1 WinSetTitle($NewTitle, "", $OldTitle) It worked as expected on both systems. I looked at the helpfile while the 3rd message box was up, and the title did indeed change. If it's not working for you still, check what you're using for "ABC" and "XYZ". I can't say more without knowing your existing window titles and what your actual strings. Edited July 16, 2013 by Artisan
Solution wraithdu Posted July 16, 2013 Solution Posted July 16, 2013 My guess is a security problem. What window are you trying to change? Does it work if you specify #RequireAdmin?
cannondale Posted July 16, 2013 Author Posted July 16, 2013 Thanks for the tips guys. The #RequireAdmin fixed the issue in Win7. Documenting here for future reference. Thanks
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now