WoodGrain

Can't move HW Monitor but can move other programs using WinMove()

10 posts in this topic

#1 ·  Posted (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 by WoodGrain
additional information

Share this post


Link to post
Share on other sites



#2 ·  Posted

If I hover my mouse over the title bar this is the information the info windows gives me:

>>>> 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:

>>>> 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:

>>>> 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 <<<<

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

#RequireAdmin didn't work either

Share this post


Link to post
Share on other sites

#5 ·  Posted

Share this post


Link to post
Share on other sites

#6 ·  Posted

Interesting, unfortunately that didn't work either :(

Share this post


Link to post
Share on other sites

#7 ·  Posted

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

 


Regards,
 

Share this post


Link to post
Share on other sites

#8 ·  Posted

Well spotted, unfort it still doesn't work.

That being said, ur 2nd code did work.. examining code..

Share this post


Link to post
Share on other sites

#9 ·  Posted

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!


Regards,
 

Share this post


Link to post
Share on other sites

#10 ·  Posted

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?

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

  • Similar Content

    • Shirdish_chakravarthi
      By Shirdish_chakravarthi
      Hello Friends i am new to autoit and i am stuck in middle of automation of flashing tool..
      my requirement is i have a window and i have to get the value present in that window (below is the picture)

      in the above window i need to get the value of the highlighted field.the value of this filed keeps on changing...ii need to get the current value present in the field..below are the details of the window and field..

       
      CAN it be done?
       
      thanks

    • Shirdish_chakravarthi
      By Shirdish_chakravarthi
      Hello Guys i am working on automating a flashing tool..When flashing is started if there is any error in connection it pops's up a error window...(as shown below)

       whenever this popup appears i need a msgbox to appear saying "error occured" how can i do this?
      Thanks

    • keelaji
      By keelaji
      Hello,
      first of all i searched in the forum but i didn't found any solution to my problem.
      I am using windows 10.
      I made a script that is supposed to change the title to the active window, resize it to the smallest size possible (should be around 800 x 600) and move to (0, 0).
      I can change the title but i fail to do the other 2 tasks.
      i use wingettitle [active] copied from the F1 help tool (and this works), i i put the title in a variable and than i use
      winsettitle ($variable, "one") (this works too)
      winmove ("one", 0, 0, 800, 600) (doesn't do anything)
      i also tried
      local $x = winget ( "one")
      msgbox (0, "", $x) (i get a completely white box so i suppose winget can't have any data about my window ??)
      any suggestion ?
    • Jibberish
      By Jibberish
      Hi,
      I am maybe an intermediate AutoIt script writer, but have no experience creating GUIs.
      I have a script with two functions. One for Checkboxes and another with radio buttons. Each function creates it's own window.
      I'd like to use one window with both checkboxes and radio buttons.
      I pulled samples from AutoIt Help and other places and worked it into this: (RadioCheck still uses the example Case and MsgBoxes. I will clean this up soon)
      Func CheckOptions() ; Create a GUI with various controls. Local $hGUI = GUICreate("SGX4CP Options", 275, 250) ; Create a checkbox control. Local $iLoopCheckbox = GUICtrlCreateCheckbox("Loop", 10, 10, 185, 25) Local $iFullScreenCheckbox = GUICtrlCreateCheckbox("Fullscreen", 10, 40, 185, 25) Local $iRestartPlaybackCheckbox = GUICtrlCreateCheckbox("Restart Playback from Sleep", 10, 70, 185, 25) GUICtrlSetState($iRestartPlaybackCheckbox, $GUI_CHECKED) Local $iDisableSleepCheckbox = GUICtrlCreateCheckbox("Disable Sleep", 10, 100, 185, 25) Local $iLogCheckbox = GUICtrlCreateCheckbox("Show Log", 10, 130, 185, 25) GUICtrlSetState($iLogCheckbox, $GUI_CHECKED) Local $idClose = GUICtrlCreateButton("Next", 110, 220, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $iLoopCheckbox If _IsChecked($iLoopCheckbox) Then $bLoopChecked = True Else $bLoopChecked = False EndIf Case $iFullScreenCheckbox if _IsChecked($iFullScreenCheckbox) Then $bFullScreenChecked = True Else $bFullScreenChecked = False EndIf Case $iRestartPlaybackCheckbox if _IsChecked($iRestartPlaybackCheckbox) Then $bRestartPlaybackChecked = True Else $bRestartPlaybackChecked = False EndIf Case $iDisableSleepCheckbox if _IsChecked($iDisableSleepCheckbox) Then $bDisableSleepChecked = True Else $bDisableSleepChecked = False EndIf Case $iLogCheckbox if _IsChecked($iLogCheckbox) Then $bLogChecked = True Else $bLogChecked = False EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc Func RadioCheck() GUICreate("Select Test",300,180) ; will create a dialog box that when displayed is centered Local $idRadio1 = GUICtrlCreateRadio("Loop Forever", 10, 10) Local $idRadio2 = GUICtrlCreateRadio("Play each video 3 times", 10, 40) Local $idRadio3 = GUICtrlCreateRadio("Play each video separately", 10, 70) GUICtrlSetState($idRadio1, $GUI_CHECKED) Local $idClose = GUICtrlCreateButton("Start Test", 120,100) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE ExitLoop Case $idMsg = $idRadio1 And BitAND(GUICtrlRead($idRadio1), $GUI_CHECKED) = $GUI_CHECKED MsgBox($MB_SYSTEMMODAL, 'Info:', 'The app will run forever, playing each video once, then looping back to the first video.') $bTestSelectForever = True Case $idMsg = $idRadio2 And BitAND(GUICtrlRead($idRadio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox($MB_SYSTEMMODAL, 'Info:', 'Each video will loop 3 times then move to the next video.') $bTestSelect3Times = True Case $idMsg = $idRadio3 And BitAND(GUICtrlRead($idRadio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox($MB_SYSTEMMODAL, 'Info:', 'Player opens, first video plays, player closes. Player opens, second video plays, player closes, etc.') $bTestSelectSingleVideo = True EndSelect WEnd EndFunc I would like to combine the checkbox "Loop" and the radio button $idRadio2. Radio2 requires Loop to be checked.
      I planned to remove the Loop checkbox and only enable it if Radio2 is selected.
      Can I combine these two functions into one with one window with both Checkboxes and Radio Buttons?
      Thanks
      Jibberish
    • nacerbaaziz
      By nacerbaaziz
      Hi friends, I have a question, please.
      I have created a window containing a edit box
      I need to know how to change the keyboard language,
      e.g :
      if a user open the  script  it will be change the keyBord language   in window automatically into English
      I found more examples but didn't work with me .
      Note:  
       I use the windows 10 os
      Please help me .
      thanks in advance to all
      with my Greetings and my appreciation for all users and admins