How to call WinCE DirectX APIs in C#?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to use DirectSound
But I don't know how to use it in .Net CF?
Can you help me?
I am a new in C#, so a detailed description is welcome

Harry
 
It's not going to be fun at all. DirectX APIs are COM-based. You will need a
C++ wrapper or something like CFCOMM control from Odyssey Software
 
I can't use CFComm, I must do it myself, it's my work. Sorry

The following is my test code:
[DllImport("dsound.dll")]
static extern uint DirectSoundCreate(IntPtr lpGuid, int ppDS, int pUnkOuter);
The error is: MissingMethodException

I think it's caused by dsound.dll, but I can't find it under my directory.
The environment is VS.Net2003+.Net Compact Framework

Thank you very much!
 
First, are you sure you device has DirectX components?
Second, in Windows CE you don't have functions DirectXXXCreate and
DirectXXXEnumerate. These are helper functions that exist on the desktop.
The general approach that you have to use on CE is to call CoCreateInstance
on CLSID_DirectSound.
You need to write a C++ wrapper DLL as calling CoCreateInstance from CF will
give you a useless interface pointer
 
In MS Windows CE.Net Help
I can find DirectSoundCreate
So, I think WinCE .Net 4.2 should support DirectX, right?
 
Perhaps I was wrong and Platform Builder allows building an image with full
DirectX. Nevertheless my point is still valid. After you have called
DirectSoundCreate, you will end up with an interface IDirectSound (and some
others as well). What are you going to do with it without an unmanaged
wrapper?
 
It looks as though you *should* be able to use DirectSoundCreate() on a
CE.NET 4.2 device that is built with appropriate hardware and the DirectX
components. The DirectX test programs for CE.NET 4.2 attempt to use
DirectSoundCreate() and fail if it's not present or doesn't work.

I'd start by verifying that you actually *can* do this from C++. If so,
then your OS is fine and the hardware is fine. At that point, you have to
build a C++ wrapper which you can use from the .NET CF...

Paul T.
 
Back
Top