Controler migpro
source code from vortex n edited by phatp
bahan : vb 6 (microsoft visual basic 6),dan migpro
Langkah pertama buka vb >> buat sebuah project
Buat 6 buah text box, dan 8 buah command button seperti gmbr di bawah
Langkah kedua coding (memfungsikan button dan text box yg telah dibuat)
pilih view code kemudian copy dan paste declarasi code berikut
Code:
Private filo As New FileSystemObject
Private sete As TextStream
Private strName As String
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Const WM_CLOSE = &H10
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Code diatas adalah deklarasi untuk fungsi yang mau kita buat
Dibawahnya kita buat sebuah deklarasi code lg yg berfungsi untuk menyimpan file dari text box dan menyimpanya ke dlm file mig.ini
Code:
Private Sub savingData(ByVal strFileName As String)
strFileName = App.Path & "\mig.ini"
Set sete = filo.CreateTextFile(strFileName, True)
With sete
.WriteLine ("[migpro edited by phatp]")
.WriteLine ("p01=") & Text1.Text
.WriteLine ("pass=") & Text2.Text
.WriteLine ("room=") & Text3.Text
.WriteLine ("kick=") & Text4.Text
.WriteLine ("lol=") & Text5.Text
.WriteLine ("address=") & Text6.Text
.Close
End With
End Sub
dibawah adalah code untuk menyimpan ke dlm file data.txt
Code:
Private Sub saveData(ByVal strFileName As String)
strFileName = App.Path & "\data.txt"
Set sete = filo.CreateTextFile(strFileName, True)
With sete
.WriteLine Text1.Text
.WriteLine Text2.Text
.WriteLine Text3.Text
.WriteLine Text4.Text
.WriteLine Text6.Text
.Close
End With
End Sub
Kemudian pilih view object
dobel klik pada button "save" dan isikan code seperti berikut
Code:
Private Sub Command1_Click()
savingData strFileName
saveData strFileName
End Sub
dobel klik pada button "load" dan isikan code seperti berikut
Code:
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
With filo
strFileName = App.Path & "\data.txt"
Set sete = .OpenTextFile(strFileName, ForReading)
With sete
Text1.Text = Text1.Text & .ReadLine
Text2.Text = Text2.Text & .ReadLine
Text3.Text = Text3.Text & .ReadLine
Text4.Text = Text4.Text & .ReadLine
Text6.Text = Text6.Text & .ReadLine
End With
End With
End Sub
dobel klik pada button "login" dan isikan code seperti berikut
Code:
Private Sub Command3_Click()
savingData strFileName
Shell App.Path & "\phat01.exe", vbNormalFocus
End Sub
dobel klik pada button "close" dan isikan code seperti berikut
Code:
Private Sub Command4_Click()
Dim lngHandle As Long
lngHandle = FindWindow(vbNullString, "phat01")
SendMessage lngHandle, WM_CLOSE, 0, 0
End Sub
dobel klik pada button "enter" dan isikan code seperti berikut
Code:
Private Sub Command5_Click()
savingData strFileName
Dim kBd As New Class1
AppActivate "phat01"
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (keyReturn)
End Sub
dobel klik pada button "leave" dan isikan code seperti berikut
Code:
Private Sub Command5_Click()
Dim kBd As New Class1
AppActivate "phat01"
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyDown)
kBd.PressKeyVK (keyReturn)
kBd.PressKeyVK (KeyUp)
End Sub
dobel klik pada button "kick" dan isikan code seperti berikut
Code:
Private Sub Command5_Click()
savingData strFileName
Dim kBd As New Class1
AppActivate "phat01"
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyDown)
kBd.PressKeyVK (KeyDown)
kBd.PressKeyVK (keyReturn)
End Sub
dobel klik pada button "send" dan isikan code seperti berikut
Code:
Private Sub Command5_Click()
savingData strFileName
Dim kBd As New Class1
AppActivate "phat01"
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyUp)
kBd.PressKeyVK (KeyDown)
kBd.PressKeyVK (KeyDown)
kBd.PressKeyVK (KeyDown)
kBd.PressKeyVK (keyReturn)
End Sub
dobel klik pada button "save ip" dan isikan code seperti berikut
Arrow Langkah ketiga menambahkan sebuah module, ini berfungsi untuk mendeklarasikan perintah menekan tombol dlm migpro
Pilih Project >> add Class module >> open
dan isikan atau copy paste code di bawah ini
Code:
Option Explicit
Private Declare Function MapVirtualKey Lib "user32" Alias _
"MapVirtualKeyA" (ByVal wCode As Long, _
ByVal wMapType As Long) As Long
Private Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal _
cChar As Byte) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As _
Long) As Integer
Private Const KEYEVENTF_EXTENDEDKEY = &H1
Private Const KEYEVENTF_KEYUP = &H2
Public Enum enumKeys
keyBackspace = &H8
keyTab = &H9
keyReturn = &HD
keyShift = &H10
keyControl = &H11
keyAlt = &H12
keyPause = &H13
keyEscape = &H1B
keySpace = &H20
keyEnd = &H23
keyHome = &H24
keyLeft = &H25
KeyUp = &H26
keyRight = &H27
KeyDown = &H28
keyInsert = &H2D
keyDelete = &H2E
keyF1 = &H70
keyF2 = &H71
keyF3 = &H72
keyF4 = &H73
keyF5 = &H74
keyF6 = &H75
keyF7 = &H76
keyF8 = &H77
keyF9 = &H78
keyF10 = &H79
keyF11 = &H7A
keyF12 = &H7B
keyNumLock = &H90
keyScrollLock = &H91
keyCapsLock = &H14
End Enum
'Presses the single key represented by sKey
Public Sub PressKey(sKey As String, Optional bHold As Boolean, Optional _
bRelease As Boolean)
Dim nVK As Long
nVK = VkKeyScan(Asc(sKey))
If nVK = 0 Then
Exit Sub
End If
Dim nScan As Long
Dim nExtended As Long
nScan = MapVirtualKey(nVK, 2)
nExtended = 0
If nScan = 0 Then
nExtended = KEYEVENTF_EXTENDEDKEY
End If
nScan = MapVirtualKey(nVK, 0)
Dim bShift As Boolean
Dim bCtrl As Boolean
Dim bAlt As Boolean
bShift = (nVK And &H100)
bCtrl = (nVK And &H200)
bAlt = (nVK And &H400)
nVK = (nVK And &HFF)
If Not bRelease Then
If bShift Then
keybd_event enumKeys.keyShift, 0, 0, 0
End If
If bCtrl Then
keybd_event enumKeys.keyControl, 0, 0, 0
End If
If bAlt Then
keybd_event enumKeys.keyAlt, 0, 0, 0
End If
keybd_event nVK, nScan, nExtended, 0
End If
If Not bHold Then
keybd_event nVK, nScan, KEYEVENTF_KEYUP Or nExtended, 0
If bShift Then
keybd_event enumKeys.keyShift, 0, KEYEVENTF_KEYUP, 0
End If
If bCtrl Then
keybd_event enumKeys.keyControl, 0, KEYEVENTF_KEYUP, 0
End If
If bAlt Then
keybd_event enumKeys.keyAlt, 0, KEYEVENTF_KEYUP, 0
End If
End If
End Sub
'Loop through a string and calls PressKey for each character (Does not
' parse strings like SendKeys)
Public Sub PressString(ByVal sString As String, Optional bDoEvents As Boolean = True)
Do While sString <> ""
PressKey Mid(sString, 1, 1)
Sleep 20
If bDoEvents Then
DoEvents
End If
sString = Mid(sString, 2)
Loop
End Sub
'Presses a specific key (this is used for keys that don't have a
' ascii equilivant)
Public Sub PressKeyVK(keyPress As enumKeys, Optional bHold As Boolean, _
Optional bRelease As Boolean, Optional bCompatible As Boolean)
Dim nScan As Long
Dim nExtended As Long
nScan = MapVirtualKey(keyPress, 2)
nExtended = 0
If nScan = 0 Then
nExtended = KEYEVENTF_EXTENDEDKEY
End If
nScan = MapVirtualKey(keyPress, 0)
If bCompatible Then
nExtended = 0
End If
If Not bRelease Then
keybd_event keyPress, nScan, nExtended, 0
End If
If Not bHold Then
keybd_event keyPress, nScan, KEYEVENTF_KEYUP Or nExtended, 0
End If
End Sub
'Returns (in the boolean variables) the status of the various Lock keys
Public Sub GetLockStatus(bCapsLock As Boolean, bNumLock As Boolean, _
bScrollLock As Boolean)
bCapsLock = GetKeyState(enumKeys.keyCapsLock)
bNumLock = GetKeyState(enumKeys.keyNumLock)
bScrollLock = GetKeyState(enumKeys.keyScrollLock)
End Sub
Langkah keempat menambahkan componen agar project bisa jalan
Pilih Project >> References >> trus cari Microsoft Scripting Runtime dan centang dah
Langkah terakhir save project as
Kamu bisa simpan project didirektori apa aja atau folder apa aja
note : jangan lupa menambahkan migpro editan yg bisa km donlot di link berikut
migpro phat01Hasil akhir dari project
Copy phat01.exe ke folder project kamu trs jalankan project
Kamu juga bisa donlot project jadinya di link di bawah ini
controler migpro