Jump to content

Winhandle for indentical windows?


Recommended Posts

Im trying to do a WinFlash on a window.

I got 2 empty notepads open both with the name "Untitled - Notepad"

I use WinList to get a list of active windows and filter our the ones from notepad.exe

i then feed the processID into

Func _WinGetByPID($iPID)
    Local $aWList = WinList()
    For $iCC = 1 To $aWList[0][0]
        If WinGetProcess($aWList[$iCC][1]) = $iPID And _
            BitAND(WinGetState($aWList[$iCC][1]), 2) Then
            Return $aWList[$iCC][0]
        EndIf
    Next
    Return SetError(1, 0, 0)
EndFunc

And try do a WinFlash on both handels.

However only one of them will flash (the one that was last active).

I guess it is a problem with the WinGetByPID function, can someone help me out here?

[center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center]

Link to comment
Share on other sites

Think about this:

Return $aWList[$iCC][0]

You return the window TITLE not the handle. Doing WinFlash two times on the same title will obviously flash the same window twice.

Link to comment
Share on other sites

Think about this:

Return $aWList[$iCC][0]

You return the window TITLE not the handle. Doing WinFlash two times on the same title will obviously flash the same window twice.

Yes i realised but how can you get the Winhandle from the PID then?

[center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center]

Link to comment
Share on other sites

The array from WinList has Title in [$n][0] and Handle in [$n][1] :D

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Yes i realised but how can you get the Winhandle from the PID then?

You use the handle in WinGetProcess() and WinGetState() and still asks how to get it? You're joking right? :D Edited by AdmiralAlkex
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...