在VB.NET中,您可以設置對焦點採用設置外部應用程序集中
AppActivate("Windows Name")
或
AppActivate(processID As Integer)
現在,如果你比如做這個工作正常,外部應用程序:
Dim intNotePad As Integer = Shell("C:\WINNT\Notepad.exe",
AppWinStyle.MinimizedNoFocus)
AppActivate(intNotePad)
但是當我這樣做:
For Each theprocess As Process In processlist
If InStr(theprocess.ProcessName, "DWG") Then
strProcessList += String.Format("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id) + vbCrLf
AppActivate(theprocess.ID)
End If
Next
那麼即使它是開放的,即使它使用窗口標題找到窗口,它也不會找到該窗口。
但我需要它的進程ID。
我該怎麼做?
我需要它在Windows安裝程序安裝項目中的第三方安裝程序的重點。
爲什麼這個標籤爲「asp.net」? – AUSteve 2010-01-08 00:10:23
請不要使用'InStr'。 'process.ProcessName.Contains(「DWG」)'是「正確的」.NET方法。 – Ryan 2012-06-06 03:23:28