// ================================================ ========================================
// Title:
// Switch between wince synchronization and hard disk Mode
// Author:
// Norains
// Date:
// Month 22-October-2007
// Environment:
// Evc4.0 + Windows CE 5.0 standard SDK
// ================================================ ========================================
The content of this article is based on the RMI Au1200 experimental platform, and the default synchronization and hard disk mode driver file name is not changed, so this method is not guaranteed to apply to all platforms.
Before proceeding to our article, we also need to confirm that we have added the features of the two modes when making NK. Bin.
If the platform meets the two conditions mentioned above, it is only one step away from success, and the rest is very simple (of course we haven't seen much complicated before ).
The supervisor automatically loads the USB driver after startup. in other words, if the registry is changed after the system is started successfully, No matter what mode is changed, the USB cable is connected to the previous mode. therefore, if you need the settings to take effect, restart the machine after the settings are complete.
Let's take a look at the pattern setting code: CREG reg;
Reg. Create (HKEY_LOCAL_MACHINE, text ("Drivers/USB/functiondrivers "));
Tchar szdisp [max_path] = {0 };
Reg. getvaluesz (text ("defaultclientdriver"), szdisp, max_path );
MessageBox (null, szdisp, text ("the current value"), mb_ OK );
// Synchronization mode
// Reg. setsz (text ("defaultclientdriver"), text ("serial_class "));
// Hard disk Mode
// Reg. setsz (text ("defaultclientdriver"), text ("mass_storage_class "));
Reg. Reset ();
Everything is so simple, just a few words of code, you can complete the conversion of the two modes. if you are bored and connect the USB cable without doing anything, you only need to give "defaultclientdriver" A value different from the above strings.