DirectX全屏应用程序:Application.DoEvents()问题 [英] DirectX Fullscreen Application: Problem with Application.DoEvents()

查看:115
本文介绍了DirectX全屏应用程序:Application.DoEvents()问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我正在尝试使用C#创建全屏DirectX应用程序.在我的主循环中,我调用Windows可以处理KeyEvents的Application.DoEvents()...如果这样做,则会收到"InvalidCallException".在非全屏模式下运行应用程序时,我没有问题.

谁能帮我吗?事先非常感谢.

Hello

I am trying to make a fullscreen DirectX application with C#. In my mainloop I call Application.DoEvents() that Windows can process the KeyEvents... If I do so, I get a "InvalidCallException". I don''t have the problem when I run the application in non-fullscreen-mode.

Could anyone please help me? Many thanks in advance.

推荐答案

您能拨通Application.DoEvents()呼叫并使其在全屏模式下工作吗?

如果不能,则需要更改当前参数.

例如

Can you take out the Application.DoEvents() call and have it work in full screen?

It you can''t, then you need to change your present parameters.

Ex.

presentParams.Windowed = false;


请参阅以下链接 [


See the following link[^].

It might help if you provide more information on the exception as well.


如果我省略了Application.DoEvents()调用,则该应用程序在全屏模式下工作,但是OnKeyPress(KeyPressEventArgs e )不再工作,因为Windows似乎没有事件处理留下的任何资源.

如果我打开Application.DoEvents()调用,则会收到此错误消息:

If I ommit the Application.DoEvents() call, the app is working in fullscreen mode, but the OnKeyPress(KeyPressEventArgs e) is not working anymore since windows seems not to have any resources left vor event-handling.

If I turn on the Application.DoEvents() call, I get this error-message:

Error in the application.
-2005530516 (D3DERR_INVALIDCALL)
   at Microsoft.DirectX.Direct3D.Device.Reset(PresentParameters[] presentationParameters)
   at Microsoft.DirectX.Direct3D.Device.OnParentResized(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnResize(EventArgs e)
   at System.Windows.Forms.Form.OnResize(EventArgs e)
   at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
   at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
   at System.Windows.Forms.Control.UpdateBounds()
   at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmWindowPosChanged(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


这篇关于DirectX全屏应用程序:Application.DoEvents()问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆