private bool bind_window() { int hwnd = dm.FindWindow("LDPlayerMainFrame", "雷電模擬器"); hwnd = Int32.Parse(dm.EnumWindow(hwnd, "TheRender", "RenderWindow", 4)); //hwnd = Int32.Parse(dm.EnumWindow(hwnd, "sub", "subWin", 4)); int dm_ret = dm.BindWindowEx(hwnd, "gdi", "windows", "windows", "", 0); //int dm_ret = dm.BindWindow(hwnd, "normal", "normal", "dx", 0); if (dm_ret != 1) { MessageBox.Show("我找不到模擬器!"); return(false); } return(true); }
public int FindWindow() { switch (BaseData.SystemInfo.Simulator) { case 0: { try { string temp0 = dm.EnumWindow(0, "QWidgetClassWindow", "Qt5QWindowIcon", 1 + 2); //temp自动找 if (temp0 != "") { string[] s = temp0.Split(new char[] { ',' }); BaseData.SystemInfo.GameWindowsHwnd = Int32.Parse(s[1]); } return(-2); } catch (Exception ex) { MessageBox.Show("无法找到模拟器窗口", "少女前线"); WriteLog.WriteError("查找句柄" + ex.ToString()); return(-2); } } case 1: { try { BaseData.SystemInfo.GameWindowsHwnd = Convert.ToInt32(dm.EnumWindow(0, "WndTxtCore", "XXEmulatorCore", 1 + 2)); //temp自动找 break; } catch (Exception ex) { MessageBox.Show("无法找到模拟器窗口", "少女前线"); WriteLog.WriteError("查找句柄" + ex.ToString()); return(-2); } } case 2: { try { BaseData.SystemInfo.GameWindowsHwnd = Convert.ToInt32(dm.EnumWindow(0, "kaopu001_tiantianplayer_opengl_wndWindow", "Qt5QWindowIcon", 1 + 2)); //temp自动找 } catch (Exception ex) { MessageBox.Show("无法找到模拟器窗口", "少女前线"); WriteLog.WriteError("查找句柄" + ex.ToString()); return(-2); } //variables.GameWindowsHwnd = Convert.ToInt32(dm.EnumWindow(0, "kaopu001_tiantianplayer_opengl_wndWindow", "Qt5QWindowIcon", 1 + 2));//temp自动找 break; } case 3: //靠谱助手 BS2HD { try { string temp0 = dm.EnumWindow(0, "kpzs -- Power plus BlueStacks", "", 1 + 2); //temp自动找 if (temp0 != "") { string[] s = temp0.Split(new char[] { ',' }); BaseData.SystemInfo.GameWindowsHwnd = Int32.Parse(s[0]); } return(-2); } catch (Exception ex) { MessageBox.Show("无法找到模拟器窗口", "少女前线"); WriteLog.WriteError("查找句柄" + ex.ToString()); return(-2); } //variables.GameWindowsHwnd = Convert.ToInt32(dm.EnumWindow(0, "kpzs -- Power plus BlueStacks", "", 1 + 2));//temp自动找 } case 4: //靠谱助手 BS { try { string temp0 = dm.EnumWindow(0, "kpzs -- Power by BlueStacks", "Mono.WinForms.0.0", 1 + 2); //temp自动找 if (temp0 != "") { string[] s = temp0.Split(new char[] { ',' }); BaseData.SystemInfo.GameWindowsHwnd = Int32.Parse(s[0]); } return(-2); } catch (Exception ex) { MessageBox.Show("无法找到模拟器窗口", "少女前线"); WriteLog.WriteError("查找句柄" + ex.ToString()); return(-2); } //variables.GameWindowsHwnd = Convert.ToInt32(dm.EnumWindow(0, "kpzs -- Power plus BlueStacks", "", 1 + 2));//temp自动找 } case 5: { try { string temp0 = dm.EnumWindow(0, "AEngineRenderWindow", "AEngineRenderWindowClass", 1 + 2); //temp自动找 if (temp0 != "") { BaseData.SystemInfo.GameWindowsHwnd = Int32.Parse(temp0); break; } return(-2); } catch (Exception ex) { MessageBox.Show("无法找到模拟器窗口", "少女前线"); WriteLog.WriteError("查找句柄" + ex.ToString()); return(-2); } } default: break; } return(-1); }