locked
//MSDN says, "This function is obsolete as of Windows Embedded CE 6.0. Use ActivateDeviceEx instead. " and as of I know WM 6.1 is WinCE 5.2 based. RRS feed

  • Question

  • //[DllImport("CoreDLL")]                                                                                     //0x0000
    //[DllImport("coredll.dll", CharSet = CharSet.Unicode)]                                                      //0x0000
     [DllImport("Coredll.dll", EntryPoint = "ActivateDeviceEx",SetLastError = true, CharSet = CharSet.Unicode)] //0x0964
    //[DllImport("coredll", EntryPoint = "ActivateDeviceEx", SetLastError = true)]                               //0x064a     
    private static extern IntPtr ActivateDeviceEx(String lpszDevKey, IntPtr lpRegEnts, UInt32 cRegEnts, IntPtr lpvParam);

     string regKeyDSK4 = @"Drivers\BuiltIn\SamrtCard";

    IntPtr hndDriver = ActivateDeviceEx(regKey, IntPtr.Zero, 0, nFlags)
      if (IntPtr.Zero == hndDriver)
        {
                        Int32 err = Marshal.GetLastWin32Error(); 
                        //2404 : The value means the drive is already loaded.
                        //1610 : ERROR_BAD_CONFIGURATION
                        throw new Win32Exception(err)
        }
     My C# Code is same this. then as a DllImport , return value is differ from as you know...
     May I use this code C# Mobile , if possible? Can you modify its? Why not Handle 0x00000000 ?

    Wednesday, November 18, 2009 4:41 AM

All replies

  •         //[DllImport("CoreDLL")]                                                                                     //0x0000
            //[DllImport("coredll.dll", CharSet = CharSet.Unicode)]                                                      //0x0000
            [DllImport("Coredll.dll", EntryPoint = "ActivateDeviceEx",SetLastError = true, CharSet = CharSet.Unicode)] //0x0964
            //[DllImport("coredll", EntryPoint = "ActivateDeviceEx", SetLastError = true)]                               //0x064a     
            private static extern IntPtr ActivateDeviceEx(String lpszDevKey, IntPtr lpRegEnts, UInt32 cRegEnts, IntPtr lpvParam);

    Many DllImport method in here ..But return 0x000,0x0964,0x64a
    if 0x0964 , then Not mount device with target?  Do you answer why it is result?
    • Merged by ZHE ZHAO Friday, November 20, 2009 2:55 AM
    Wednesday, November 18, 2009 4:47 AM