I am developing a .net 2.0 windows form application for a mobile device like scanner (Intermec CK3). The application is running fine on my windows XP. But when I moved the application to the scanner (Windows CE 6.1) and ran it. I got an error like "Can't find PInvoke DLL Mpr.dll". I seached for the dll on the scanner and could find it. The dll is on the windows XP.
Any help would be appreciated.
[
private static extern ErrorCodes WNetAddConnection3(IntPtr hWndOwner, NETRESOURCE lpNetResource, string lpPassword, string lpUserName, int dwFlags);
public enum ResourceScope{
RESOURCE_CONNECTED = 1,RESOURCE_GLOBALNET,RESOURCE_REMEMBERED,RESOURCE_RECENT,RESOURCE_CONTEXT};
public enum ResourceType{RESOURCETYPE_ANY,RESOURCETYPE_DISK,RESOURCETYPE_PRINT,RESOURCETYPE_RESERVED};
public enum ResourceUsage{
RESOURCEUSAGE_CONNECTABLE = 0x00000001,RESOURCEUSAGE_CONTAINER = 0x00000002,RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004,RESOURCEUSAGE_SIBLING = 0x00000008,
RESOURCEUSAGE_ATTACHED = 0x00000010,RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),
};
public enum ResourceDisplayType{
RESOURCEDISPLAYTYPE_GENERIC,RESOURCEDISPLAYTYPE_DOMAIN,RESOURCEDISPLAYTYPE_SERVER,RESOURCEDISPLAYTYPE_SHARE,RESOURCEDISPLAYTYPE_FILE,
RESOURCEDISPLAYTYPE_GROUP,RESOURCEDISPLAYTYPE_NETWORK,RESOURCEDISPLAYTYPE_ROOT,RESOURCEDISPLAYTYPE_SHAREADMIN,RESOURCEDISPLAYTYPE_DIRECTORY,
RESOURCEDISPLAYTYPE_TREE,RESOURCEDISPLAYTYPE_NDSCONTAINER
};
public enum ErrorCodes{
NO_ERROR = 0,
ERROR_NO_MORE_ITEMS = 259,
ERROR_BAD_NETPATH = 53,
ERROR_SESSION_CREDENTIAL_CONFLICT = 1219,
};
ret =
uint bufferSize = 16384;IntPtr buffer = Marshal.AllocHGlobal((int)bufferSize);IntPtr handle = IntPtr.Zero;ErrorCodes result;ErrorCodes.ERROR_9999;NETRESOURCE nr = new NETRESOURCE();
nr.lpRemoteName = @\\myServer_Name ;
nr.dwScope = ResourceScope.RESOURCE_GLOBALNET;
nr.dwType = ResourceType.RESOURCETYPE_ANY;
nr.dwDisplayType = ResourceDisplayType.RESOURCEDISPLAYTYPE_SHARE;
nr.dwUsage = ResourceUsage.RESOURCEUSAGE_CONNECTABLE;
result = WNetAddConnection3(handle, nr, my_password, my_userID, 1);