Esempio n. 1
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     if ((int)process_handle != 0)
     {
         W_API.CloseHandle(process_handle);
     }
 }
Esempio n. 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     run_fast.Checked = false;
     if ((int)process_handle != 0)
     {
         W_API.CloseHandle(process_handle);
     }
     //查找窗口
     window_hwnd = W_API.FindWindow(null, "PAL4-Application");
     if ((int)window_hwnd == 0)
     {
         MessageBox.Show("找不到窗口");
         return;
     }
     //获取PID
     W_API.GetWindowThreadProcessId(window_hwnd, out process_id);
     if (process_id == 0)
     {
         MessageBox.Show("查找进程ID失败");
         return;
     }
     //打开进程
     process_handle = W_API.OpenProcess(0x1F0FFF, 0, (uint)process_id);
     if ((int)process_handle == 0)
     {
         MessageBox.Show("打开进程失败");
         return;
     }
     //Get_HP(process_handle);
     //MessageBox.Show("载入完成");
     Text            = "仙剑4内存修改器 - PAL4.exe - " + process_id.ToString();
     timer1.Enabled  = true;
     button1.Enabled = false;
     button1.Text    = "加载完成";
 }