1
A
回答
6
这应该是很简单的:
Process.GetProcessById(processId).MainWindowTitle;
,如果你喜欢它作为一个功能,你要求:
public string GetWindowTitle(int processId){
return Process.GetProcessById(processId).MainWindowTitle;
}
+3
只是为了,这需要使用'从System.Diagnostics'不必看它节省未来的Google。 – rojo 2013-04-21 02:45:05
3
中的AutoIt这已经做过很多次之前,与选项返回属于该进程的所有窗口,而不仅仅是主窗口。
This post提供了标准的解决方案。如果腐烂蔓延:
;0 will return 1 base array; leaving it 1 will return the first visible window it finds
Func _WinGetByPID($iPID, $nArray = 1)
If IsString($iPID) Then $iPID = ProcessExists($iPID)
Local $aWList = WinList(), $sHold
For $iCC = 1 To $aWList[0][0]
If WinGetProcess($aWList[$iCC][1]) = $iPID And _
BitAND(WinGetState($aWList[$iCC][1]), 2) = 0 Then
If $nArray Then Return $aWList[$iCC][0]
$sHold &= $aWList[$iCC][0] & Chr(1)
EndIf
Next
If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
Return SetError(1, 0, 0)
EndFunc
相关问题
- 1. Linux通过pid获取窗口图标
- 2. 从进程ID获取窗口标题
- 3. 获取窗口标题从进程名
- 4. 获取窗口标题?
- 5. Autoit - 通过PID获取窗口类
- 6. 从PID获取X11窗口 - 正确访问数组?崩溃
- 7. 使用python获取窗口标题?
- 8. 获取X11窗口标题高度
- 9. c# - 获取当前窗口标题
- 10. 使用WM_GETTEXT获取窗口标题
- 11. c#获取进程窗口标题
- 12. 使用XCB获取窗口标题
- 13. 获取谷歌铬窗口标题
- 14. 获取IE窗口对象的窗口标题用VBA
- 15. 从标签获取窗口对象
- 16. 从窗口获取唯一标识
- 17. 从ShellExecute获取PID
- 18. 获取标题打开窗口并关闭特定标题?
- 19. 如何从它的进程路径获取窗口标题
- 20. PYQT5从窗口标题中获取文本?
- 21. 从PID设置活动/前景窗口
- 22. 通过鼠标光标在Powershell/wasp中获取窗口标题?
- 23. 从窗口获取数据
- 24. 获取System.Windows.Forms.IWin32Window从WPF窗口
- 25. 从项目获取窗口
- 26. 获取顶部窗口的pid和细节
- 27. 获取MacOS上所有打开的窗口的PID
- 28. 如何通过PID在autohotkey中获取窗口句柄?
- 29. 获取VB.NET中PID进程的所有子窗口的句柄
- 30. 从MS-Word ApplicationClass获取PID?
我tryied它和它没有工作 – MoShe 2012-04-03 06:54:22