码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2018-02-20 11:52:29      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:外部   name   bsp   sub   this   event   body   shared   else   

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

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

标签:外部   name   bsp   sub   this   event   body   shared   else   

原文地址:https://www.cnblogs.com/wujiangling/p/8454931.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!