Closed mcoo closed 3 years ago
当游戏窗口未加载时执行 handle.SetTitle("修改游戏窗口"); 会返回 True 实际未执行成功! 源代码:
handle.SetTitle("修改游戏窗口");
True
public static bool SetTitle(this LaunchHandle handle, string title) { try { SetWindowText(handle.Process.MainWindowHandle, title); return true; } catch { return false; } }
这里的SetWindowText并不会触发try,当执行失败只会返回0,所以会造成判断错误! 贴上 修复后代码:
public static bool SetTitle(this LaunchHandle handle, string title) { try { if (SetWindowText(handle.Process.MainWindowHandle, title) != 0) { return true; } else { return false; } } catch { return false; } }
当游戏窗口未加载时执行
handle.SetTitle("修改游戏窗口");
会返回True
实际未执行成功! 源代码:这里的SetWindowText并不会触发try,当执行失败只会返回0,所以会造成判断错误! 贴上 修复后代码: