ท่านสร้าง Windows Forms Application และ เขียนคำสั่ง Process ไม่ถูกต้อง และท่าน Build ขณะคำสั่งเกิด Error! จึง Compile ไม่ผ่าน
ฉนั้น.. ไฟล์ Zuma Deluxe Trainer.sln จึงไม่สามารถเปิดได้
ถ้าเป็นไฟล์ปกติที่ใช้งานได้ จะมีหมายเลฃ 9 ปรากฏอยู่ที่ไอคอนของไฟล์ Zuma Deluxe Trainer.sln
ขอให้ท่านลองทำมาใหม่แล้วลงให้ดาวน์โหลดอีกครั้ง (ห้าม ฺBuild ขณะเกิด Error!) แจ้งด้วยถ้า Up ให้แล้ว
แนะนำ: คำสั่ง Process เป็น Class อยู่ใน System.Diagnostics Namespace
ถ้าไม่อยากเขียนคำสั่งยาวๆ ท่านต้องอ้างหรือ Import Namespace System.Diagnostics ด้วย
และเวลาเขียนคำสั่ง ท่านต้องใช้ตัวแปร เพื่อดึงคำสั่งที่เป็นรายละเอียดออกมาจาก Class
Example Code: GetProcess :: Download:
Click hereImports System.Diagnostics
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pList() As Process = Process.GetProcesses
Dim Output As String = ""
For Each proc As Process In pList
Output &= proc.ProcessName & vbCrLf
Next
MsgBox(Output, 0, "Process List")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pList() As Process = Process.GetProcessesByName("Zuma")
Dim Output As String = ""
For Each proc As Process In pList
Output &= proc.ProcessName & vbCrLf
Next
If Strings.InStr(Output, "Zuma") Then
TextBox1.Text = Output & " is processing..."
Else
TextBox1.Text = "Zuma is not process"
MsgBox("กรุณารันเกมส์ Zuma เพื่อทดสอบ")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If TextBox1.Text <> "" Then
TextBox1.Clear()
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Select Button4.Text
Case "AutoGetProcessName"
Button1.Visible = False
Button2.Visible = False
Button3.Visible = False
Button4.Location = New Point(140, 66)
Button4.Text = "NormalGetProcessName"
Timer1.Enabled = True
Case "NormalGetProcessName"
Button1.Visible = True
Button2.Visible = True
Button3.Visible = True
Button4.Location = New Point(261, 66)
Button4.Text = "AutoGetProcessName"
Timer1.Enabled = False
End Select
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim pList() As Process = Process.GetProcessesByName("Zuma")
Dim Output As String = ""
For Each proc As Process In pList
Output &= proc.ProcessName & vbCrLf
Next
If Strings.InStr(Output, "Zuma") Then
TextBox1.Text = Output & " is processing..."
Else
TextBox1.Text = "Zuma is not process"
End If
End Sub
End Class