Modify

#3627 closed Feature Request (Rejected)

Feature Request: AutoItWinGetHandle()

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: AutoItWinGetTitle AutoItWinSetTitle Cc:

Description

As simple as it sounds, can we get a function that just gives the handle to that hidden AutoIt window?
Then we can all stop using functions like this:

Func _AutoItWinGetHandle()
	Local $sOld = AutoItWinGetTitle()
	Local $sTmp = 'au3win' & Random()
	AutoItWinSetTitle($sTmp)
	Local $hWnd = WinGetHandle($sTmp)
	AutoItWinSetTitle($sOld)
	Return $hWnd
EndFunc;==>_AutoItWinGetHandle

Attachments (0)

Change History (6)

comment:1 by Melba23, on May 5, 2018 at 7:00:58 PM

Why so complicated? Why not simply:

$hWnd = WinGetHandle(AutoItWinGetTitle())

M23

comment:2 by therks, on May 14, 2018 at 1:43:47 PM

If you have more than one AutoIt process running you could end up with the handle for another process. Also because the default title is just "AutoIt v3" it's possible another (non-AutoIt) window with that title could be open as well.

comment:3 by Melba23, on May 16, 2018 at 8:43:19 AM

Did you try to see if this was the case? When I run several concurrent instances of the same script I get a different handle returned for each instance, so it appears that the code will only return the handle associated with that instance, which is what I would expect.

M23

comment:4 by therks, on Jul 17, 2018 at 1:47:57 PM

I suppose if that variable is set and used like a constant (at the beginning of a script launch), there would probably be no problems. But if the lookup for the window handle happens some time after launch (eg: from a UDF) when the calling process is not focused, it could return the incorrect handle.

For example, if you have a folder open titled "AutoIt v3" and your script calls WinGetHandle(AutoItWinGetTitle()) a few minutes after it was first launched, it will return the Explorer window.

Maybe it would even be more appropriate as a macro, like @AutoItWinHandle.

I guess it doesn't matter though as it seems I'm the only one interested.

comment:5 by BrewManNH, on Jul 20, 2018 at 7:04:42 PM

What exactly do you need the handle of the hidden window for? In 8 years of using AutoIt, I don't think I've ever seen anyone that ever needed that information, so I'm curious as to why you think this is necessary.

comment:6 by Melba23, on May 15, 2020 at 9:19:47 PM

Resolution: Rejected
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.