JeanMarc Posted September 18, 2009 Posted September 18, 2009 Hello all, This is my first post to the AutoIt forums so please be kind I am trying to use the ProcessExists() function but this returns 0 even though the process is up and running! Could it be because the running process is a 16-bit process? Likewise ProcessList() fails to list this process even though it appears in Task Manager (underneath wowexec.exe). I've used ProcessExists() for other purposes before so this is not a user issue Any idea what to do? I want to be able to detect that the process is closed before doing other things. Thanks! Jean-Marc
Minikori Posted September 18, 2009 Posted September 18, 2009 Might I ask what the name of the process is? For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com
PsaltyDS Posted September 18, 2009 Posted September 18, 2009 (edited) Use the forum search. This has come up before (as in a couple of years ago), and is related to trying to get WoW (Win-On-Win, not Warcraft) to enumerate the 16-bit processes running under it. I don't remember if there was a resolution or not, but it was discussed here a LOOOONG time ago. Edited September 18, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
marc0v Posted September 18, 2009 Posted September 18, 2009 If you have a window associated with this 16bit app and can get the title of this windoweven only a constant substring of the title, if the title changeseven if this window is hidden or minimizedyou can use the following code...(I tested it with a 16bit app running under wowexec, which is under ntvdm)(Tested with WinXP SP3, AutoIt v3.2.0.1)(To explore existing windows you can use WinExplorer, freeware at http://www.nirsoft.net/utils/winexp.html)expandcollapse popupLocal $wintitle, $winmatchmode, $reswin $wintitle = "TheWindowTitle" ; 16 bits app window title, case sensitive ;Here choose the match mode for the 16 bits app window ;$winmatchmode = 1 ; Match the title from the start for the 16 bits app window title, case sensitive ;$winmatchmode = 2 ; Match any substring in the title for the 16 bits app window title, case sensitive $winmatchmode = 3 ; Exact title match for the 16 bits app window title, case sensitive $reswin = WOWAPPEXISTS($wintitle, $winmatchmode) MsgBox(0, "Result", "Does '" & $wintitle & "' exist? : " & $reswin) ;Tested with WinXP SP3, AutoIt v3.2.0.1 ;This will check if an app with a window title = $strtitle is hosted by wowexec ;Return 1 if exists, 0 if not exists ;Not all 16 bits apps seem to be hosted by wowexec and wowexec is itself hosted by ntvdm ;I have an old game running in a DOS console which is hosted by ntvdm without wowexec Func WOWAPPEXISTS($strtitle, $winmatchmode) Local $arrwow, $arrapp, $i, $j AutoItSetOption("WinTitleMatchMode", 4) $arrwow = WinList("classname=WOWExecClass") If $arrwow[0][0] = 0 Then Return 0 AutoItSetOption("WinTitleMatchMode", $winmatchmode) $arrapp = WinList($strtitle) If $arrapp[0][0] = 0 Then Return 0 For $i = 1 To UBound($arrapp, 1) - 1 For $j = 1 To UBound($arrwow, 1) - 1 If WinGetProcess($arrapp[$i][1]) = WinGetProcess($arrwow[$j][1]) Then Return 1 EndIf Next Next Return 0 EndFunc
marc0v Posted September 19, 2009 Posted September 19, 2009 A more complete solution (always using a window of the 16bits app) expandcollapse popupAutoItSetOption("MustDeclareVars", 1) Local $sWinId1, $sWinText1, $iWinMatchMode1, $iWinSearchChildren1, $iTextMatchMode1, $iReswin ;Here choose the title (or a part of the title, or the classname, or the handle) of the 16 bits app window, CASE SENSITIVE $sWinId1 = "My_16_Bits_App_Window_Title" ;Here choose the match mode for the 16 bits app window ;$iWinMatchMode1 = 1 ; Match the title from the start for the 16 bits app window title, CASE SENSITIVE ;$iWinMatchMode1 = 2 ; Match any substring in the title for the 16 bits app window title, CASE SENSITIVE $iWinMatchMode1 = 3 ; Exact title match for the 16 bits app window title, CASE SENSITIVE ;$iWinMatchMode1 = 4 ; Advanced mode (required for classname or handle) for the 16 bits app window, CASE SENSITIVE ;Here choose if the 16 bits app window should also be searched through children windows $iWinSearchChildren1 = 0 ; No (quicker) ;$iWinSearchChildren1 = 1 ; Yes (slower, but can be needed if the 16bits app window is not a top level window) ;Here choose the text of the 16 bits app window if you can get it and if it does not change, otherwise leave empty, CASE SENSITIVE $sWinText1 = "" ;Here choose the text match mode for the 16 bits app window $iTextMatchMode1 = 1 ; Complete / Slow mode (normal) ;$iTextMatchMode1 = 2 ; Quick mode (less text can be seen) $iReswin = _WinsAreInSameProcess( _ $sWinId1, $sWinText1, $iWinMatchMode1, $iWinSearchChildren1, $iTextMatchMode1, _ "classname=WOWExecClass", "", 4, 0, 1) MsgBox(0, "Result", "Is '" & $sWinId1 & "' hosted by" & @CR & "wowexec process ?" & @CR & $iReswin) ;Function checks if 2 windows identified by $sWinId1 and $sWinId2 are part of the same process ;Return value is 1 if YES, 0 if NO Func _WinsAreInSameProcess( _ $sWinId1, $sWinText1, $iWinMatchMode1, $iWinSearchChildren1, $iTextMatchMode1, _ $sWinId2, $sWinText2, $iWinMatchMode2, $iWinSearchChildren2, $iTextMatchMode2) Local $arrWin1, $arrWin2, $i, $j AutoItSetOption("WinTitleMatchMode", $iWinMatchMode1) AutoItSetOption("WinSearchChildren", $iWinSearchChildren1) AutoItSetOption("WinTextMatchMode", $iTextMatchMode1) $arrWin1 = WinList($sWinId1, $sWinText1) If $arrWin1[0][0] = 0 Then Return 0 AutoItSetOption("WinTitleMatchMode", $iWinMatchMode2) AutoItSetOption("WinSearchChildren", $iWinSearchChildren2) AutoItSetOption("WinTextMatchMode", $iTextMatchMode2) $arrWin2 = WinList($sWinId2, $sWinText2) If $arrWin2[0][0] = 0 Then Return 0 AutoItSetOption("WinSearchChildren", BitOR($iWinSearchChildren1, $iWinSearchChildren2)) AutoItSetOption("WinTitleMatchMode", 4) For $i = 1 To UBound($arrWin1, 1) - 1 For $j = 1 To UBound($arrWin2, 1) - 1 If WinGetProcess($arrWin1[$i][1]) = WinGetProcess($arrWin2[$j][1]) Then Return 1 Next Next Return 0 EndFunc ; => _WinsAreInSameProcess
JeanMarc Posted September 21, 2009 Author Posted September 21, 2009 Might I ask what the name of the process is?Yes, the process name is Tpsfix.exeIt's a utility that repairs corrupted data files in Topspeed format.Jean-Marc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now