- Katılım
- 7 Mart 2012
- Mesajlar
- 12,842
VB6
VB.NET
Yazan: Trayhoper (Burak)
Kod:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
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 PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Const VK_RETURN = &HD
Const WM_SETTEXT = &HC
Const WM_KEYDOWN = &H100
Dim EbenezerHWND As Long, ETextBox As Long
Public Sub Gonder(Komut As String)
EbenezerHWND = FindWindow(vbNullString,"Ebenezerin Başlığı") 'Ebenezer başlıkları genelde GameServer Ver - 20041111 oluyor.
ETextBox = FindWindowEx(EbenezerHWND, 0&, "Edit", vbNullString) ' ETextBox değişkenine ebenezerdeki textboxımızı buldurduk.
If EbenezerHWND = 0 Then MsgBox "Ebenezere Bağlanılamadı !",vbCritical:End 'Burada ebenezere bağlantımızı kontrol ediyoruz.Bağlantı başarısızsa programı sonlandırıyoruz.
SendMessageSTRING ETextBox, WM_SETTEXT, 256, Komut 'Komutumuzu ebenezerdeki textboxa yazdırdık.
PostMessage ETextBox, WM_KEYDOWN, VK_RETURN, 0 'Burada da entera bastırıp komutu göndertiyoruz.
End Sub
VB.NET
Kod:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Const WM_SETTEXT = &HC
Const WM_KEYDOWN = &H100
Const VK_RETURN = &HD
Dim EbenezerHWND As Long
Dim ETextBoxHWND As Long
Public Sub Gonder(ByVal Komut As String)
EbenezerHWND = FindWindow(vbNullString, "Ebenezerin Başlığı") ''Ebenezer başlıkları genelde GameServer Ver - 20041111 oluyor.
ETextBoxHWND = FindWindowEx(EbenezerHWND, 0&, "Edit", vbNullString) ' ETextBoxHWND değişkenine ebenezerdeki textboxımızı buldurduk.
If EbenezerHWND = 0 Then MsgBox("Error : Cannot get hWnd for Ebenezer !", vbCritical) : End 'Eğer ebenezere bağlantı başarısızsa programı sonlandırıyoruz.
SendMessageByString(ETextBoxHWND, WM_SETTEXT, 256, Komut)
PostMessage(ETextBoxHWND, WM_KEYDOWN, VK_RETURN, 0)
End Sub
Yazan: Trayhoper (Burak)