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.