views:

65

answers:

2

Hi all,

I am developing a Windows Mobile application using WM6 SDK. The application is a Managed code (using C#) & I would like to know the steps to be taken in order to call native functions.

Thanks for the help, Abdel Olakara

A: 

You need to first declare the native APIs as static extern using DLLImport and then use them like normal methods. Example:

    [DllImport("user32.dll", ExactSpelling = true)]
    internal static extern IntPtr SetTimer(IntPtr hWnd, IntPtr nIDEvent, int uElapse, IntPtr lpTimerFunc);
logicnp
A good example - but would have been better if it was designed for Windows Mobile. Unlike the desktop most APIs will be found within a single dll called coredll.dll, so the above example will actually throw an exception on a Windows Mobile device stating user32.dll can not be found.
Christopher Fairbairn
+1  A: 

http://www.pinvoke.net/

That should do it.

Ed Swangren
Thanks, I didn't know about this site.. was able to get details of what I need.
Abdel Olakara