为什么计时器不能在全屏模式下工作?
我有一个带有计时器的Windows窗体应用程序。
每当我打开游戏等全屏应用程序并尝试调试计时器时,它都会完全忽略它。但是当我将应用程序更改为窗口模式时,调试就开始工作了。
我还尝试按一个键(使用全局挂钩)并调试单击,并且在我在游戏中(全屏)时调试工作正常。
有人遇到过这个问题吗?如何解决?
编辑:似乎即使这样也不会进入调试(从 Form1() 调用 OpenNewTempThread)
private void OpenNewTempThread()
{
Thread thread = new Thread(Temp) { Name = "TempThread" };
thread.Start();
}
private bool Temping = true;
private void Temp()
{
while (true)
{
while (Temping)
{
Thread.Sleep(5000);
}
Thread.Sleep(100);
}
}
I got a windows form application with a timer.
Whenever I open a fullscreen application like a game and try to debug the timer, it completely ignores it. But the second I change the application to window mode, the debugging works.
I also tried pressing a key (using global hook) and debugging the click and the debugging worked while I was in the game (full screen).
Has anyone ever had this issue? how can it be fixed?
EDIT : It seems that even this doesn't go into debug (Called OpenNewTempThread from Form1())
private void OpenNewTempThread()
{
Thread thread = new Thread(Temp) { Name = "TempThread" };
thread.Start();
}
private bool Temping = true;
private void Temp()
{
while (true)
{
while (Temping)
{
Thread.Sleep(5000);
}
Thread.Sleep(100);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将此行放入您的代码中(假设您在调试器下运行,它将起作用):
Try putting this line in your code (it'll work assuming you are running under a debugger):