Sign in to follow this  
Followers 0
cannondale

WinSetTitle failing under Win7 64

4 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Artisan

Share this post


Link to post
Share on other sites

My guess is a security problem. What window are you trying to change? Does it work if you specify #RequireAdmin?

Share this post


Link to post
Share on other sites

Thanks for the tips guys. The #RequireAdmin fixed the issue in Win7. Documenting here for future reference.

Thanks

Share this post


Link to post
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
Sign in to follow this  
Followers 0