1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Public Class Form1
' Get a handle to an application window.
Declare Auto Function FindWindow Lib "USER32.DLL" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As IntPtr
' Activate an application window.
Declare Auto Function SetForegroundWindow Lib "USER32.DLL" _
(ByVal hWnd As IntPtr) As Boolean
Public proc As New Process()
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
proc = New Process()
proc.StartInfo = New ProcessStartInfo("application_tiers\DIAPORAMA\DIAPORAMA.exe")
proc.Start()
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim proc_is_on As IntPtr = FindWindow("DIAPORAMA", "DIAPORAMA.exe")
If proc_is_on = IntPtr.Zero Then
MsgBox("L'application tiers n'est pas démarrée.")
Return
End If
SetForegroundWindow(proc_is_on)
SendKeys.Send("{ENTER}")
End Sub
End Class |
Partager