我试图通过名称或PID尝试隐藏/取消隐藏窗口过程
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As ShowWindowCommands) As Boolean
结束功能
但ShowWindowCommands
是什么以及如何找到它?
谢谢!
答案 0 :(得分:1)
有很多方法可以做到这一点,最简单的方法应该是:
'一般进口
Imports System.Runtime.InteropServices
'FORM CLASS DECLARATION
<DllImport("user32.dll")> _
Private Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
End Function
'然后,如果你想隐藏firefox's
window
:
Dim mywindow As Integer
Dim processRunning As Process() = Process.GetProcesses()
For Each pr As Process In processRunning
If pr.ProcessName = "Firefox" Then
mywindow = pr.MainWindowHandle.ToInt32()
ShowWindow(mywindow , 0)
End If
Next
答案 1 :(得分:0)
你可以这样做:
Form.FromHandle(Process.GetProcessById(PID).MainWindowHandle).Show()