Jump to content

Recommended Posts

Posted (edited)

@Nine,

Func FindTrueApp($sTitle, $iPID, ByRef $sProcess)
  Local Static $aList = _WinAPI_EnumWindows(True)
  Local $iTruePID
  For $i = 1 To $aList[0][0]
    If WinGetTitle($aList[$i][0]) = $sTitle Then
      $iTruePID = WinGetProcess($aList[$i][0])
      If $iPID <> $iTruePID Then
        $sProcess = _WinAPI_GetProcessName($iTruePID)
        Return $iTruePID
      EndIf
    EndIf
  Next
  Return 0
EndFunc   ;==>FindTrueApp

Is there any particular reason why you used _WinAPI_EnumWindows instead of WinList?

Also, why you used

if WinGetTitle($aList[$i][0]) = $sTitle then

instead of 

if $aList[$i][1] = $sTitle then

Is there something else ?

PS. I am still getting ApplicationFrameHost.exe if the process is Calculator.exe...

Dan

 

Edited by Burgaud
Posted (edited)
On 5/18/2021 at 12:35 AM, Burgaud said:

Is there any particular reason why you used _WinAPI_EnumWindows instead of WinList?

I don't want to work with hidden windows and non apps windows.

On 5/18/2021 at 12:35 AM, Burgaud said:

Also, why you used

if WinGetTitle($aList[$i][0]) = $sTitle then

Because it is handle, better to search with it.

On 5/18/2021 at 12:35 AM, Burgaud said:

I am still getting ApplicationFrameHost.exe if the process is Calculator.exe...

Working for me.

 

Edited by Nine

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
  • Recently Browsing   0 members

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