Tutorials to .com

Tutorials to .com » Os » Mobile » EVC to develop examples of two: the preservation of information (a)

EVC to develop examples of two: the preservation of information (a)

Print View , by: iSee ,Total views: 14 ,Word Count: 1295 ,Date: Wed, 10 Jun 2009 Time: 12:26 PM

Source code examples in this article or download material

Windows CE software developed under the most closely related and hardware. If you write and the hardware-related technology, that only a few or even no benefit. Instead write an article, more people should be allowed to benefit from, can learn and use. An article I will follow this principle. Of course, I am a very young qualification. Can only do my best.

The information in the topic rarely refers to the volume of data. For example, configuration information, registry data. In other Windows operating system, which generally are stored in *. ini files or registry.

Embedded devices there is no uniform requirements. Some do not need to store any data or data saved to RAM, in closed equipment still provide power to the RAM. Some of the data is saved to permanent storage device. Different situations have different solutions, which resulted in the preservation of information, related technology is very complicated, it is necessary to understand it takes time and practice.

In this article I explain how the Windows CE data saved to permanent memory. Data is saved to permanent memory in a wide range of applications, not easy to lose data, you can save a large amount of data, there is no need to shut down in the system but also to provide power after. Compared the data to be saved to the RAM to provide uninterrupted power supply, storage space is also greatly restricted.

Saved to the *. ini file

Want you to customize the kernel to support the permanent storage device, the need for permanent storage device to support (ie, drivers), then add a file system. Now if we used the IDE interface storage hardware, the use of a simple file system, FAT is the appropriate choice. Then the corresponding steps are as follows: first use of the new kernel Wizard to generate a core project (using the template which the platform will do), in PB right "catalog" window to add the support for storage devices. PB v4.1 in a specific location for the "device drivers" - "storage devices" - "ATAPI PCI / IDE Storage Block Driver". Right-click in the pop-up menu, click "add platform", PB immediately related to the driver source code or compiled files, as well as the relevant environment variable added to the core of your project. And then joined the FAT file system driver. The specific location of FAT components as follows:

"Core OS" - "display based devices" - "file system and data store" - "storage manager" - "FAT File System".

Also used the same way into the left side of the kernel project. After setting environment variables. PB clicking menu "platform" - "settings" - "environment" - "new", enter the environment variable name "IMGRAM64", then enter the value "1." Upon completion of the preparatory work, compile the entire kernel. Custom kernel you should support the permanent storage.

Not consider the issue of the registry first. If our products do not need to store the registry data, but need to use some software configuration information is saved to permanent memory, then the ini file used a more appropriate manner. Do not use the registry to save data in the custom of the core reasons for the need for complicated settings, to ensure that the kernel can be loaded at boot time every time saved to permanent storage device on the registry data. If you only need to use several software configuration information, then I need to save the registry data in order to set up the kernel. The words of a simple point: Unless necessary, can not save the best registry.

Although EVC help document referred to in the MFC library CWinApp:: WriteProfileInt and CWinApp:: WriteProfileString. But also in the EVC also adopted under the compiler. However, the actual implementation function returns a value of 0 indicating no data is written on your hard disk. In the windows directory or hard drive did not find ini file. It looks very odd, if you develop the use of EVC, and you got used to the. Incidentally, the following off my face "wrong":

A, some function in helping to document mentioned that the CE to support this function. EVC at compile time but does not recognize or does not recognize the link. A reason may be that you installed after the CE and EVC, EVC not been adjusted for the compile and link directory, which is included in header files and library files directory. EVC after installation, the default header file that contains the directory and library file for the Standard SDK directory, Standard SDK is designed to prepare for the simulator, of course, very little content, can not find a function is also reasonable. EVC solution is to modify the included header files and library files directory. Location in the menu "tools" - "options" - "directories". In the "CPUs" column to choose your CPU type, and then the respective headers and libraries to add files, add the directory of header files and library files directory is Windows CE when the SDK installation directory. For example, if the development platform using x86 CPU. Well, "CPUs" select "Win32 (WCE x86)", then "Show directories" select "include files", then the following "Directories" column to add a few directories. As shown in Figure 1 (SDK means Software Development Kit, OAK means OAL development kit, DDK Driver Development Kit means). Then in the "Show directories" select "library files", to add the library file into the directory also. As shown in Figure 2. Another reason is that the really do not have this function. CE of the Help file is not doing well. Many functions that are copied code examples in the Help file under VC. Compile or run the program only when you know the existence of this function.

Note: If you are in PB programming created under the project, would not have to set up.

Figure I

Figure II

Back to the topic. CWinApp:: WriteProfileInt and CWinApp:: WriteProfileString function Since I can not write data to permanent storage devices. It would have to write these two functions and the corresponding function to read data GetProfileString and GetProfileInt. Because the function of these four high frequency of use, so I write out this function, when you do not need to write the time.

Note: 1, all string functions are UNICODE. 2, using the MFC class library. 3, specific issues, see the code.

Mobile OS Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.