'参数不正确'在WinCE5.0中尝试使用PInvoke DirectDraw时

发布于 2024-10-05 15:56:44 字数 1171 浏览 7 评论 0原文

关于让 DirectDraw 在 CE5.0 系统上运行,我一直遇到一个问题。我终于找到了一些使其在 Windows Moblie 上运行的代码,并且通过一些混乱,我已经正确编译了代码。

它成功地通过创建带有 Windows 窗体句柄的实例来运行,但是当它通过以下方式检查系统的功能时:

DDCAPS halCaps = new DDCAPS(), helCaps = new DDCAPS();
halCaps.dwSize = (uint)Marshal.SizeOf(typeof(DDCAPS));
helCaps.dwSize = halCaps.dwSize;
result = dDraw.GetCaps(out halCaps, out helCaps);

我收到“参数不正确”的异常。如果我注释掉这个函数,我也会在后面的函数中得到这个异常,这让我相信我的 PInvoke 某个地方有问题,但我不知道在哪里搜索,因为关于 CE5.0 DirectDraw 的信息似乎非常有限。我目前正在导入我的函数

[DllImport("ddraw.dll", CallingConvention = CallingConvention.Winapi)]

,但是错误似乎仅来自于接口,这些接口的开头是类似

[Guid("9c59509a-39bd-11d1-8c4a-00c04fd930c5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

我一直在关注的文章,迄今为止得到了最好的结果(以及我一直在尝试使用代码的文章)基线)位于此处。我的代码曾经是不同的,但我一直在不断地进行越来越多的更改,以查看我的代码中是否存在问题,所以现在它实际上是相同的。

如果您能提供有关导致问题的原因、我应该在哪里通过 CE5.0 查找有关 DirectDraw 的信息或有关我犯下的严重错误的任何其他信息的任何帮助,我们将不胜感激。

额外信息: 我正在开发的设备是一个自定义框架,其中 D3D 不是一个选项,尽管我确实从主板制造商处获得了支持 DirectDraw 并且可以使用 2d 硬件加速的信息,因此这不应该是一个问题。

I've been having an issue for a while in regards to getting DirectDraw to function on a CE5.0 system. I finally found some code involved with getting it working on Windows Moblie, and through some messing about, I've got the code compiling properly.

It successfully runs through creating the instance with the handle to the windows form, however when it gets to checking the capabilities of the system via:

DDCAPS halCaps = new DDCAPS(), helCaps = new DDCAPS();
halCaps.dwSize = (uint)Marshal.SizeOf(typeof(DDCAPS));
helCaps.dwSize = halCaps.dwSize;
result = dDraw.GetCaps(out halCaps, out helCaps);

I get an exception of 'The parameter is incorrect'. I also get this exception on later functions if I comment this one out which leads me to believe there is a problem with my PInvoke somewhere, but I don't know where to search as information on CE5.0 DirectDraw seems to be very limited. I am currently importing my functions with

[DllImport("ddraw.dll", CallingConvention = CallingConvention.Winapi)]

however the error seems to only come from the interfaces which are lead with something like

[Guid("9c59509a-39bd-11d1-8c4a-00c04fd930c5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

The article I've been following with the best results so far (and the one I've been using code from as an attempted baseline) is here. My code used to be different, but I've been steadily changing more and more to see if something in my code was the problem so at this point it's practically the same.

Any assistance on what is causing the issue, where else I should look for info on DirectDraw via CE5.0, or pointers on anything else I'm doing horribly wrong would be greatly appreciated.

Extra Info:
The device I am working on is a custom framework where D3D is not an option though I do have information from the board manufacturer that DirectDraw is supported and 2d hardware acceleration is available, so that shouldn't be an issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心 2024-10-12 15:56:44

将其放在这里供其他遇到类似问题的人使用。查看 C++ 代码一段时间后,看起来 CE5.0 使用的变量和函数与 6.0+ 不同,因此您必须使用 IDirectDraw4 之类的东西,而不是 IDirectDraw 和 IDirectDrawSurface5,后者必须从 IDirectDrawSurface4 转换。

我希望这对其他有类似问题的人来说是有用的信息。我还没有解决此代码的所有问题,但这是一个很好的起点。

Putting this here for others who are having similar problems. After looking into the C++ code for a while, it looks like CE5.0 uses different variables and functions than 6.0+, therefor you must use things like IDirectDraw4 rather than IDirectDraw and IDirectDrawSurface5 which has to be converted from an IDirectDrawSurface4.

I hope this is useful information to anyone else who has a similar problem. I have not fixed all my issues with this code but it's a good place to start.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文