Windows Mobile Device and desktop PC Resources are quite limited. Currently, the latest devices are generally 128 M Ram + 256 M Flash , And then expand 4G Memory card. However Windows Mobile Device resources and Ram And Flash Yes Byte To compute 8bit Single-chip microcomputer is still quite impressive, and it does not need to be as tricky as it was before when programming Byte To compute global variables. HoweverProgramAnd OS All are in Ram The most depressing reason is that Ram Not big enough, so that when running some software, you have to turn off the running program and make some space for it, which is often met in the past.
As you know Windows Mobile On the device, we can use Settings-> system-> memory To view the Usage Status of the current device resource, but this requires a few clicks, click the screen, it is troublesome. We generally like to be lazy, so it is better to display this information in real time on today's interface. Therefore, many companies use software to display the status of device resources in real time on the interface, such SPB For example RESCO There are many.
In fact Wm6.0 SDK Built-in Sample , There is a related program, it is located in " \ Pocketpc \ CPP \ Win32 \ memwatcher " Folder. This project is used Native code A plug-in written on the current interface. After compilation, DLL File and Cab Installation File, we can directly Cab Install the file on the device, and then display it in the settings on today's interface. For example 1 :
figure 1 : memwatcher today's plug-in
Of course, we can also use Platform Invoke Set Coredll In Getdiskfreespaceex Introduced in. Total free bytes And Total Bytes Calculate the current resource usage. 2 As shown in the following figure: the running effect of the program is displayed on the left and the running effect of the Program on the right. Settings-> system-> memory Through comparison, we can find that the resource information they display is consistent.
figure 2 : computing memory programs used
The one with the current plug-in Memwatcher Installation package: Memwatchercab.cab.rar After downloading the file, change the file life Memwatchercab. Cab And then install it on the device. And Display the source file of the resource program: Getstoragecard.zip
For more information, see Article : display device memory information with P/invoke