[/B]
[B]Private Const PROCESS_ALL_ACCESS As Long = &H1F0FFF[/B]
[B]Private Declare Function GetWindowThreadProcessId Lib "User32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long[/B]
[B]Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long[/B]
[B]Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long[/B]
[B]Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long[/B]
[B]Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long[/B]
[B]Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long[/B]
[B]Private Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long[/B]
[B]'Şimdi de fonksiyonumuzu yazıyoruz.[/B]
[B]Public Function Longyaz(Offset As Long, WindowName As String, Value As Long) As Boolean[/B]
[B]Dim hwnd As Long[/B]
[B]Dim ProcessID As Long[/B]
[B]Dim ProcessHandle As Long[/B]
[B]'Önce oyunun pencere numarasını bulalım;[/B]
[B]hwnd = FindWindow(vbNullString, WindowName)[/B]
[B]If hwnd = 0 Then 'Oyun şuanda açık değilse[/B]
[B]MsgBox "Oyun şuanda açık değil!", vbCritical, "Yazma Hatası" 'Eğer isterseniz bu satırı kaldırabilirsiniz, oyun açık değilse zaten trainer bi işe yaramaz[/B]
[B]Exit Function[/B]
[B]End If[/B]
[B]GetWindowThreadProcessId hwnd, ProcessID[/B]
[B]ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID)[/B]
[B]If ProcessHandle = 0 Then[/B]
[B]Exit Function[/B]
[B]End If[/B]
[B]WriteProcessMemory ProcessHandle, Offset, Value, 4, 0& 'Değeri yazıyoruz[/B]
[B]CloseHandle ProcessHandle 'Yazma işlemi bitti, pencere kulbunu kapatıyoruz[/B]
[B]End Function[/B]
[B]