16,553
社区成员
发帖
与我相关
我的任务
分享
Module Module1
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As Integer
Public Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Integer) As Integer
Public Const WM_SYSCOMMAND = &H112
Public Const SC_RESTORE = &HF120&
Sub Main()
Dim cur As Process = Process.GetCurrentProcess()
For Each p As Process In Process.GetProcesses
If p.Id = cur.Id Then Continue For
If p.ProcessName = cur.ProcessName Then
SetForegroundWindow(p.MainWindowHandle)
SendMessage(p.MainWindowHandle, WM_SYSCOMMAND, SC_RESTORE, IntPtr.Zero)
Return
End If
Next
Application.Run(New Form9)
End Sub
End Module
Module Module1
Public Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Integer) As Integer
Sub Main()
Dim cur As Process = Process.GetCurrentProcess()
For Each p As Process In Process.GetProcesses
If p.Id = cur.Id Then Continue For
If p.ProcessName = cur.ProcessName Then
SetForegroundWindow(p.MainWindowHandle)
Return
End If
Next
Application.Run(New Form9)
End Sub
End Module