在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