Where to place native DLL to use Pocket PC emulator?

Suppose you have these two projects in the same Visual Studio solution:

  1. SmartDeviceProject1: the Pocket PC device application in C#.
  2. NativeDLL: the Win32 SmartDevice DLL in C++.

Now you can follow the following steps:

  • Select the Pocket PC Emulator for both project, in the Visual Studio Device Option.
  • Deploy the projects; now in \\Program Files of your Emulator you can see the two new directories: SmartDeviceProject1 and NativeDLL (Start -> Programs -> File Explorer -> Program Files).

Your NativeDLL.dll is in the NativeDLL directory, so use the following DllImport:

[DllImport(@"..\NativeDLL\NativeDLL.dll", EntryPoint = "Write")]
public static extern bool Write(char[] FileName);

And now you can run your application using the emulator.

MSDN additional Information: Using the Emulator in Smart Device Projects.