careca

WinMove Non Visible Windows

1 post in this topic

Hi, recently i had 2 monitors on this pc, and i had to remove one at one point, but then i noticed that some applications would start in the "ghost/second/removed" monitor, so i cannot interact with them, so i thought about doing a simple app, that on a double click would drag the specified window to coordinates x0 y0.

the problem is that it only works on windows on the monitor 1, applications on 2 just don't come to 1.

Hoping for some hints to solve this.

#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)
Opt("WinSearchChildren", 0)
;=============================================================================

$GUI = GUICreate('BringBack', 605, 335)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

;=============================================================================
#Region ;ListView
$cListView = GUICtrlCreateListView("#|Title|Handle", 8, 10, 585, 250, $LVS_SHOWSELALWAYS, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT)
GUICtrlSetFont($cListView, 9, 600, 0, '', 5)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 40)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 370)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 160)
#EndRegion ;ListView
;=============================================================================
GUISetState()
WinSetOnTop($GUI, '', 1)
WList()

Func WList()
    Local $aList = WinList()
    For $i = 1 To $aList[0][0]
        If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then
            GUICtrlCreateListViewItem($i & '|' & $aList[$i][0] & '|' & $aList[$i][1], $cListView)
        EndIf
    Next
EndFunc   ;==>WList

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

Func Quit()
    GUIDelete($GUI)
    Exit
EndFunc   ;==>Quit

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

While 1
    $CursorInfo = GUIGetCursorInfo($GUI)
    If $CursorInfo[4] = $cListView Then
        If _IsPressed("01") Then
            If _IsPressed("01") Then
                $GetLTLV = _GUICtrlListView_GetNextItem($cListView, -1, 0, 8)
                If $GetLTLV <> -1 Then
                    $GetItemTxtT = _GUICtrlListView_GetItemText($cListView, $GetLTLV, 1)
                    ConsoleWrite('Title - ' & $GetItemTxtT & @CRLF)
                    WinMove($GetItemTxtT, '', 0, 0)
                    WinSetOnTop($GetItemTxtT, '', 1)
                EndIf
            EndIf
        EndIf
    EndIf
    Sleep(100)
WEnd

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

 

Capture.PNG


BeatsPlayer - My Music player

"Know what really grinds my gears? Those people who quote whole posts for no reason." Peter Griffin

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