반응형
* VBNET 다른 응용 프로그램 실행 및 종료 예제...
전체 소스 코드
Form1.vb
Public Class Form1
Dim pcEXE As System.Diagnostics.Process
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
'파일 열기...
Dim ofd As OpenFileDialog = New OpenFileDialog()
'EXE 파일만 열기...
ofd.Filter = "EXE File (*.exe) | *.exe"
If (ofd.ShowDialog() = Windows.Forms.DialogResult.OK) Then
label1.Text = ofd.FileName
End If
End Sub
Private Sub button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2.Click
'응용 프로그램 실행 시키기...
'해당 파일이 존재 하지 않으면...
If Not System.IO.File.Exists(label1.Text) Then
Return
End If
'다른 응용 프로그램 실행 시키기...
pcEXE = System.Diagnostics.Process.Start(label1.Text)
End Sub
Private Sub button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3.Click
'응용 프로그램 죽이기...
If pcEXE Is Nothing Then Return
'죽이기...
pcEXE.Kill()
End Sub
End Class
* 예제 결과
https://kdsoft-zeros.tistory.com/69
반응형
'VB.NET Programming' 카테고리의 다른 글
[VBNET] string 을 int 및 double 형으로 변환 하기, string null 체크 (0) | 2019.11.06 |
---|---|
[VBNET] 응용 프로그램 재시작 예제 (0) | 2019.11.02 |
[VBNET] File 사용 가능 여부 체크 (0) | 2019.10.26 |
[VBNET] XML File Write & Read 예제 (0) | 2019.10.24 |
[VBNET] 동적 DLL 폼 (Form) 불러오기 및 클래스 (Class) 함수 불러오기 예제 (0) | 2019.10.22 |