- UID
- 191737
- 帖子
- 322
- 主題
- 52
- 精華
- 0
- 積分
- 140
- 楓幣
- 680
- 威望
- 124
- 存款
- 2601
- 贊助金額
- 0
- 推廣
- 1
- GP
- 53
- 閱讀權限
- 20
- 在線時間
- 327 小時
- 註冊時間
- 2017-6-13
- 最後登入
- 2024-11-1
|
小弟因為私服不能使用CE,所以開始研究如何用其他方式寫入數據,目前嘗試使用C#來引用CE的DLL來達到CE數據的功能,但是遇到一個問題,雖然已經可以得到遊戲的視窗ID與PID,但是數據開關都沒反應,想請大神們幫小弟解惑QQ
以下是我引用DLL的程式碼:- [DllImport("User32.dll", EntryPoint = "FindWindow")]
- public extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
- [DllImport("User32.dll",CharSet = CharSet.Auto)]
- public extern static int GetWindowThreadProcessId(IntPtr hWnd, out int ID);
- [DllImport("kernel32.dll")]
- public static extern int OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
- [DllImport(@"C:\path_to_dll\ceautoassembler.dll", EntryPoint = "CEInitialize")]
- public extern static int CEInitialize
- (
- int ngPassedPID,
- int Phandle
- );
- [DllImport(@"C:\path_to_dll\ceautoassembler.dll", EntryPoint = "CEAutoAsm")]
- public extern static bool CEAutoAsm
- (
- string Script,
- bool AllocID,
- int Alloc
- );
複製代碼 再來是偵測PID與開啟數據的程式碼:- private void button1_Click(object sender, EventArgs e)
- {
- IntPtr maindHwnd = FindWindow(null, "MapleStory");
- const int PROCESS_ALL_ACCESS = 0x1F0FFF;
- if (maindHwnd != IntPtr.Zero)
- {
- int ID;
- int Process;
- MessageBox.Show("鎖定成功!");
- GetWindowThreadProcessId(maindHwnd, out ID);
- Process = OpenProcess(PROCESS_ALL_ACCESS, false, ID);
- label3.Text = maindHwnd.ToString();
- label4.Text = ID.ToString();
- if (ID != 0)
- {
- CEInitialize(ID, Process);
- }
- }
- else
- {
- MessageBox.Show("鎖定失敗!");
- }
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- if(checkBox1.Checked)
- {
- //取出字串
- label2.Text = Properties.Resources.script;
- CEAutoAsm(Properties.Resources.script, true, 0);
- }
- else
- {
- label2.Text = "";
- CEAutoAsm(Properties.Resources.script, false, 0);
- }
- }
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox2.Checked)
- {
- CEAutoAsm(Properties.Resources.script2, true, 0);
- }
- else
- {
- CEAutoAsm(Properties.Resources.script2, false, 0);
- }
- }
複製代碼 補充:CE數據已經從resources建立,並可以正常使用呼叫,所以不太可能是數據寫錯的問題 |
[發帖際遇]: u11334342 因為參加「太陽花學運」被黨看見,而成功加入DDP側翼網軍,領取網軍獎勵 1 楓幣 |
幸運榜 / 衰神榜 |
|