启动程序时激活窗口,如何激活一个外部程序进程并显示在最前

2018/02/20 11:21
阅读数 25
Imports System.Diagnostics
Imports System.Runtime.InteropServices

<DllImport("user32.dll")>
Public Shared Sub SwitchToThisWindow(ByVal hWnd As IntPtr, ByVal fAltTab As Boolean)
End Sub

Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim pName As String = "dvdplay"
    Dim temp As Process() = Process.GetProcessesByName(pName)
    If temp.Length > 0 Then
        Dim handle As IntPtr = temp(0).MainWindowHandle
        SwitchToThisWindow(handle, True)
    Else
        Process.Start(pName & ".exe")
    End If
End Sub

 

 

引用:http://blog.csdn.net/baidu_27474941/article/details/53161697

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部