Sign in to follow this  
Followers 0
AutoitMike

WinSetTitle not working Win7

10 posts in this topic

I saw a post dated 2013 about WinSetTitle not working in Win7 64bit. No answer there for me.

I am trying to set the title of a window, the function returns success and the title is changed for about 50 ms and then reverts back to its original value.

#RequireAdmin makes no difference in operation.

I have tried using the handle, the title and the class to define the window. Operation is the same for all three ways.

EG:

WinSetTitle("Old Title", "", "New Title")

WinSetTitle("[Class:Class name]","","New Title")

WinSetTitle(handle,"","New Title")

;=======================================================================================

All functions report success.

WinActivate("PxxCXpbHG", "Text")
WinSetTitle("PxxCXpbHG ", "Text","New title")

$M1=WinGetTitle("[ACTIVE]","")
sleep (100)
$M2=WinGetTitle("[ACTIVE]","")

MsgBox(0,"", $M1 & "  " & $M2) ;------------------> "New Title"  "PxxCXpbHG"

If I change Sleep to 50 , then it is "New Title", "New Title" so somewhere between 50 and 100 ms it gets changed back,but by what??

Thanks for any help in this matter.

 

 

 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Works for me, what program are you trying to rename?

del.PNG

del.PNG

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

Its a propitiatory inspection reporting program called HomeGauge.

You can download a trial version.

Share this post


Link to post
Share on other sites
10 minutes ago, AutoitMike said:

Its a propitiatory inspection reporting program called HomeGauge.

You can download a trial version.

 

Work PC won't let me install it, I'll take a look at it tonight and see what's up.


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

Thanks a Billion

Share this post


Link to post
Share on other sites

After installing , Put the attached file under C:------------------>\HMA-HomeGauge\Templates.

Then open HomeGauge, select the template you installed and enter a first and last name for Client.

You will see in the title bar "PCXpbHG - Smith, Bob" as the title bar name.

 

Thanks again :)

JC Edits of Master Ver 2014-11-06.ht5

Share this post


Link to post
Share on other sites

rcmaehl,

I think it might be futile to change the title bar text.

The title bar gets reset every time a new section is selected. I am going to have to get the authors of the program to put the value I need in the title bar.

Otherwise, I would have to have a program running in the background monitoring multiple instances of this program keeping the respective title bars updated.

What i am looking to do is to put the report number as an addition to the existing text or to replace what is in the title bar so that 2 or more reports for the same client produce unique window titles.

 

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Seems, this is a behaviour from the app you want to automate, which also uses a feature to change titlebar text. Use a adlib func with short time (maybe 50 ms) to set the text you need.

But title changing don't change the Hwnd returned from WinActivate. So i suggest read about:

  • Window Titles and Text (Basic)

  • Window Titles and Text (Advanced)

in helpfile. The Hwnd can be used for (all?) most Win* functions for example WinWaitActive. And each from your instances have his own Hwnd.

Edited by AutoBert

Share this post


Link to post
Share on other sites

Interesting function, Adlib. However, I just got a brainstorm.

Once ANY window is created in windows, under no circumstance, the window handle is duplicated, right ?

Once an instance of the application is opened, I can grab its handle, store it in my automation app. and use it to select the correct window when needed?

 

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

Both correct!

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

  • Similar Content

    • imitto
      Script not working if run from shortcut
      By imitto
      Hello all!
      I was in read-only until today, started to use Autoit 3 weeks ago. It can really make things easy, I really love it
      I have some script now that works and make our job effective, but I have problems with the latest. It works if I open the script's folder and run the exe directly. If I use the shortcut that I created on the desktop, it's not working properly. Activates the window, but not opening/exporting my files, just opens the last msgbox. I use ftp becouse the PC and the destination PC is not on the same network.
      Here's the script:
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\microsoft_excel.ico #AutoIt3Wrapper_Res_Comment=send file over ftp #AutoIt3Wrapper_Res_Description=send file over ftp for process #AutoIt3Wrapper_Res_Language=1038 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: imitto Script Function: Rename and put playlist file on ftp #ce ---------------------------------------------------------------------------- #RequireAdmin #include <File.au3> #include <FileConstants.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <FTPEx.au3> ; Script Start Global $playlistname=@YEAR&@MON&@MDAY&"-playlist.pll" BlockInput($BI_DISABLE) Opt ("WinTitleMatchMode", 2) WinActivate("MAIN SCHED") WinWaitActive("MAIN SCHED") ;Opt ("WinTitleMatchMode", 1) Send("!fo") WinWaitActive("Open") Send("Z:\playlist\"&$playlistname&"{ENTER}") Sleep(2000) Send("!fe") WinWaitActive("MCon") Send("{ENTER}") WinWaitActive("Save") Send("C:\sendFileForXLS\lista.txt{ENTER}") Sleep(500) Send("!fc") BlockInput($BI_ENABLE) Sleep(50) Opt ("WinTitleMatchMode", 1) Local $hOpen = _FTP_Open('MyFTP Control') $ftp=_FTP_Connect($hOpen, "**********", "******", "******") If @error Then MsgBox($MB_SYSTEMMODAL, '_FTP_Connect', 'ERROR=' & @error) Else _FTP_FilePut($ftp, @ScriptDir&"\lista.txt", "/lista.txt") EndIf Local $iFtpc = _FTP_Close($hOpen) FileDelete(@ScriptDir&"\lista.txt") MsgBox(0, "", "Playlist exported", 2) Exit  
    • meows
      Is there a issue With filesettime/filegettime and win7 fileproperties time? all are different
      By meows
      no web server atm. so the win7 file properties images I can't show you but they are totally different from the variables I am getting..But then I am just guesstamating the code needed from any and all sources i can find to just get the Minutes difference between 2 files.
      I can touch the files to change anything, but can't get the value to use it and using FilesetTime/ only works with the Help code. and it is way over my head. I have searched the web looking for a step by step but it's all in arrays that array me.
      The FileSetTime
      ;Modified help file #include <FileConstants.au3> #include <MsgBoxConstants.au3> $sFilePath=("C:\file1.txt") Local $iFileSetTime = FileSetTime($sFilePath, "20031101121101"  )     ; Display the modified timestamp of the file and return as a string in the format YYYYMMDDHHMMSS.     If $iFileSetTime Then        ; MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, $FT_ACCESSED, 2  ))  RETURNS Timestamp:     ;   MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, 2  ))                  RETURNS Timestamp:       ; MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, "YYYYMMDDHHMMSS"  ))  RETURNS Timestamp:       ; MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, $FT_MODIFIED, 1))       RETURNS Timestamp:       The only one that returns Anything is the last one and it returns the whole string..Timestamp:20031101121101  ; RETURNS  Timestamp:20031101121101      File Properties accessed time and date ?Saturday, ?November ?01, ?2003, ??1:01:00 AM File EndIf changed created date but displays YYYYMMDDHHMMSS"
      So I got creative and after /////..... and more of that got this to work.. "Kinda"
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=TimeCK.exe #AutoIt3Wrapper_Res_Fileversion=21 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include<File.au3> #include <FileConstants.au3> #include <Constants.au3> #include <MsgBoxConstants.au3> #Include <Date.au3> ;change file.au3's "modified" timestamp to 1st Nov 2003 and current time ;Local $var = FileSetTime("file.au3", "20031101") ;Local $iFileSetTime = FileSetTime($sFilePath, "20031101", $FT_MODIFIED) ;Local $iFileSetTime = FileSetTime("c:\2a.jpg", "20031101", 1) ;change file.au3's "modified" timestamp to 1st Nov 2003 and current time ;Local $v = FileSetTime(@ScriptDir &"\00\2a.jpg", "20031101", 1) Local $v = FileSetTime(@ScriptDir &"\00\2a.jpg", "2003110120031101121101", 1) If Not @error Then    ; Local $HHMMSS =  $v[0] & "/" &  $v[1] & "/" &  $v[2]      Local $MMss =  ($v )     MsgBox(0, "Creation date of 2a", $MMss) EndIf Local $t = FileGetTime(@ScriptDir & "\00\Files\core\2a.jpg", 1) ;HH:MM:SS If Not @error Then ;      Local $hhmms = $t[0] & "/" & $t[1] & "/" & $t[2]     Local $mm = $t[1]     MsgBox(0, "time change", $mm) ;Local $t = FileGetTime("c:\2a.jpg", 1) ;HH:MM:SS ;If Not @error Then ;      Local $hhmms = $t[0] & "/" & $t[1] & "/" & $t[2]  ;   Local $mm = $t[2]   ;  MsgBox(0, "Creation date of notepad.exe", $mm) EndIf The issue is it gives 3 totally different times for the Minute.. I only want the minute difference.
      the "Creation date of 2a" tag gives a 0 minute value==and in 3 hours now it still gives the 0 minute value
      the "time change" tag gives a 28 minute value ==== and in 3 hours now it still gives the 28 minute value
      Win7 "File Properties" tag gives
      ?Sunday, ?June ?22, ?2014, ??1:11:42 PM   ------------FileSetTime(@ScriptDir &"002a.jpg", "2003110120031101121101", 1)
      Saturday, ?June ?28, ?2014, ??3:05:36 PM
      Sunday, ?June ?22, ?2014, ??1:11:42 PM



      Saturday, ?November ?01, ?2003, ??7:03:11 PM --------------------FileGetTime(@ScriptDir & "00Filescore2a.jpg", 1)
      Saturday, ?June ?28, ?2014, ??3:05:36 PM
      ?Today, ?June ?30, ?2014, ??5 minutes ago   
       
      U know I think I learned more in the two hours it took to write this very bad dissertation of the issue. Researching everything I wanted to say and try to explain the steps took to get the results.
    • Kovacic
      Windows 7 Auto Login with credentials
      By Kovacic
      Simple script that took me about 15 minutes. I built it for a friend but thought someone else could use it..
      Just make sure you compile it as 64bit if you have a 64bit system which most of you using windows 7 do.
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=HWandHank.ico #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.10.2 Author: Mike Kovacic Script Function: Set windows 7 to auto login using provided credentials. * This must be compiled as x64 to work. #ce ---------------------------------------------------------------------------- #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $MuhApp = GUICreate("Set Autologon", 309, 127, 212, 132) $Username = GUICtrlCreateInput("", 8, 16, 153, 21) $Password = GUICtrlCreateInput("", 8, 48, 153, 21) $Domain = GUICtrlCreateInput(@ComputerName, 8, 80, 153, 21) $Set = GUICtrlCreateButton("Set Autologon", 176, 24, 123, 25) $REmove = GUICtrlCreateButton("Remove Autologin", 176, 56, 123, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $set setautoadminlogin() Case $remove removeautologin() EndSwitch WEnd Func setautoadminlogin() $a = 0 If RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa", "LmCompatabilityLevel", "REG_DWORD", "2") then $a += 1 If RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", "1") then $a += 1 If RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "ForceAutoLogon", "REG_SZ", "1") then $a += 1 If RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "REG_SZ", guictrlread($username)) then $a += 1 If RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", guictrlread($Password)) then $a += 1 If RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName", "REG_SZ", guictrlread($Domain)) then $a += 1 If $a = 6 then MsgBox(64,"Success!","Autologon has been set.") else MsgBox(16,"Oops!","Autologon could not be set. Make sure you are a local Admin.") endif EndFunc ;==>setautoadminlogin Func removeautologin() $b = 0 If RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", "0") then $b += 1 If RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "ForceAutoLogon", "REG_SZ", "0") then $b += 1 If RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName") then $b += 1 If RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword") then $b += 1 If RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName") then $b += 1 If RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa", "LmCompatabilityLevel") then $b += 1 If $b = 6 then MsgBox(64,"Success!","Autologon has been removed.") else MsgBox(16,"Oops!","Autologon could not be removed. Either Autologin was not set or you are not a local Admin.") endif EndFunc ;==>removeautologin Enjoy.
    • DatMCEyeBall
      _WinAPI_DrawShadowText
      By DatMCEyeBall
      I'm trying to make a "sheet of glass" with shadow text drawn on it, the problem is that the shadow isn't transparent at all. I have absolutely no idea what I am doing wrong -  being a noob with the WinAPI stuff.   Screen-shot:   Here's the script: ; Requires AutoIT beta 3.3.9.21 or newer #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Misc.au3> #include <WinAPIGdi.au3> If Not _WinAPI_DwmIsCompositionEnabled() Then MsgBox(BitOR(16, 4096), 'Error', 'Script requires Windows Vista or later with enabled Aero theme.') Exit EndIf Global Const $STM_SETIMAGE = 0x0172 Global Const $STM_GETIMAGE = 0x0173 Global $hDarkBK = GUICreate("Dark background", 400, 40, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) GUISetBkColor(0) GUISetState(@SW_SHOW) Global $hGUI = GUICreate("DWM Test", 300, 20, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST)) GUISetBkColor(0) _WinAPI_DwmExtendFrameIntoClientArea($hGUI) Global $Pic = GUICtrlCreatePic('', 0, 0, 300, 20) Global $hPic = GUICtrlGetHandle($Pic) Global $tRECT = _WinAPI_GetClientRect($hPic) Global $Width = DllStructGetData($tRECT, 3) - DllStructGetData($tRECT, 1) Global $Height = DllStructGetData($tRECT, 4) - DllStructGetData($tRECT, 2) Global $hDC = _WinAPI_GetDC($hPic) Global $hDestDC = _WinAPI_CreateCompatibleDC($hDC) Global $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $Width, $Height) Global $hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap) Global $hSrcDC = _WinAPI_CreateCompatibleDC($hDC) Global $hSource = _WinAPI_CreateCompatibleBitmapEx($hDC, $Width, $Height, _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE))) Global $hSrcSv = _WinAPI_SelectObject($hSrcDC, $hSource) Global $hFont = _WinAPI_CreateFont(20, 0, 0, 0, $FW_NORMAL, 0, 0, 0, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $ANTIALIASED_QUALITY, $DEFAULT_PITCH, 'Arial') _WinAPI_SelectObject($hSrcDC, $hFont) _WinAPI_DrawShadowText($hSrcDC, "Why is the shadow not transparent?", 0xFFFFFF, 0x000000, 3, 3, $tRECT) _WinAPI_BitBlt($hDestDC, 0, 0, $Width, $Height, $hSrcDC, 0, 0, $MERGECOPY) _WinAPI_ReleaseDC($hPic, $hDC) _WinAPI_SelectObject($hDestDC, $hDestSv) _WinAPI_DeleteDC($hDestDC) _WinAPI_SelectObject($hSrcDC, $hSrcSv) _WinAPI_DeleteDC($hSrcDC) _WinAPI_DeleteObject($hSource) _WinAPI_DeleteObject($hFont) ; Set bitmap to control _SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap) Global $hObj = _SendMessage($hPic, $STM_GETIMAGE) If $hObj <> $hBitmap Then _WinAPI_DeleteObject($hBitmap) EndIf GUISetState(@SW_SHOW) Global $nMsg While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit WEnd  
    • odexed
      HotkeySet & Windows 7
      By odexed
      Hello, why this code doesn't work in some versions of windows 7?
      HotkeySet(Chr(0x27),"func1") Func func1() MsgBox(0,"test","hello") EndFunc While True Sleep(10) WEnd When I press ' i should get a messagebox window but i don't.