WoodGrain Posted June 29, 2017 Posted June 29, 2017 (edited) Hi guys, I'm trying to move and resize a program call CPUID HWMonitor (http://www.cpuid.com/softwares/hwmonitor.html) but WinMove() doesn't work. Can someone tell me how to get this to work for this program? I've successfully moved other programs using WinMove(), and I've used WinGetTitle ("[ACTIVE]") to confirm the title is correct. WinActivate("CPUID HWMonitor") does work. If I run the following code nothing happens, doesn't move or resize, but AutoIt doesn't complain about the code either: WinMove("CPUID HWMonitor", 0, 0, 475, 715) The class changes every time the program opens (and I've nevery had a lot of success with classes tbh, bit hit and miss for me). Thanks all! Edited June 29, 2017 by WoodGrain additional information
WoodGrain Posted June 29, 2017 Author Posted June 29, 2017 If I hover my mouse over the title bar this is the information the info windows gives me: expandcollapse popup>>>> Window <<<< Title: CPUID HWMonitor Class: Afx:0000000140000000:b:0000000000010003:0000000000000006:00000000007D069B Position: 104, 104 Size: 650, 800 Style: 0x14CF4000 ExStyle: 0x00000100 Handle: 0x00000000000605A2 >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 595, 126 Cursor ID: 13 Color: 0x91B3D9 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Ready >>>> Hidden Text <<<< If I hover my mouse over the column headers this is the information the info windows gives me: expandcollapse popup>>>> Window <<<< Title: CPUID HWMonitor Class: Afx:0000000140000000:b:0000000000010003:0000000000000006:00000000007D069B Position: 104, 104 Size: 650, 800 Style: 0x14CF4000 ExStyle: 0x00000100 Handle: 0x00000000000605A2 >>>> Control <<<< Class: SysHeader32 Instance: 1 ClassnameNN: SysHeader321 Name: Advanced (Class): [CLASS:SysHeader32; INSTANCE:1] ID: 1 Text: Position: 2, 2 Size: 630, 19 ControlClick Coords: 510, 11 Style: 0x50000080 ExStyle: 0x00000000 Handle: 0x00000000000C05E4 >>>> Mouse <<<< Position: 624, 168 Cursor ID: 2 Color: 0xF0F0F0 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Ready >>>> Hidden Text <<<< If I hover my mouse over the tree list area this is the information the info windows gives me: expandcollapse popup>>>> Window <<<< Title: CPUID HWMonitor Class: Afx:0000000140000000:b:0000000000010003:0000000000000006:00000000007D069B Position: 104, 104 Size: 650, 800 Style: 0x14CF4000 ExStyle: 0x00000100 Handle: 0x00000000000605A2 >>>> Control <<<< Class: SysTreeView32 Instance: 1 ClassnameNN: SysTreeView321 Name: Advanced (Class): [CLASS:SysTreeView32; INSTANCE:1] ID: 2 Text: Position: 2, 21 Size: 630, 699 ControlClick Coords: 522, 25 Style: 0x50209097 ExStyle: 0x00000000 Handle: 0x00000000000C058C >>>> Mouse <<<< Position: 636, 201 Cursor ID: 13 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Ready >>>> Hidden Text <<<<
InnI Posted June 29, 2017 Posted June 29, 2017 #RequireAdmin WinMove("CPUID HWMonitor", "", 0, 0, 475, 715)
LarsJ Posted July 6, 2017 Posted July 6, 2017 I usually do it this way: $hWindow = WinGetHandle( "CPUID HWMonitor" ) If $hWindow Then WinMove( $hWindow, "", 0, 0, 475, 715 ) Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
WoodGrain Posted July 7, 2017 Author Posted July 7, 2017 Interesting, unfortunately that didn't work either
Trong Posted July 7, 2017 Posted July 7, 2017 Your code is Wrong!: On 29/6/2017 at 8:28 PM, WoodGrain said: WinMove("CPUID HWMonitor", 0, 0, 475, 715) True code: ; WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) WinMove("CPUID HWMonitor", "", 0, 0, 475, 715) Try it ! or: #RequireAdmin Local $aList = WinList(). For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then If StringInStr($aList[$i][0], "CPUID Hardware Monitor PRO") Or StringInStr($aList[$i][0], "CPUID Hardware Monitor") Or StringInStr($aList[$i][0], "CPUID HWMonitor") Or StringInStr($aList[$i][0], "Hardware Monitor") Or StringInStr($aList[$i][0], "HWMonitor") Then WinMove($aList[$i][0], "", 0, 0, 475, 715) ConsoleWrite("Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1] & @CRLF) EndIf EndIf Next Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
WoodGrain Posted July 7, 2017 Author Posted July 7, 2017 Well spotted, unfort it still doesn't work. That being said, ur 2nd code did work.. examining code..
Trong Posted July 7, 2017 Posted July 7, 2017 I tested the actual code and software on my computer! Windows7 x64, Windows 10x64, Windows Server 2016 x64 with Autoit 32bit and x64 It works. That is all! Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
WoodGrain Posted July 7, 2017 Author Posted July 7, 2017 Why does your second code work, but your 1st code and LarsJ's code not work..? From what I can see your 2nd code just looks up the WinList() array for any of the matching strings, retrieves the handle of the program and then applies the move to the handle. How is that different to what LarsJ posted?
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