2007.4.26 [ctor call ctor?? in C++]

#include "stdafx.h"
#include
using namespace std;
class A{
public:
 A();
 A(int i);
 int value;
 int* p;};
A::A(){new(this)A(1);}//A::A(){ A(1);}错,在stack上建立了一个临时变量;
A::A(int i){
 this->value=i;
 this->p = NULL;
}
int _tmain(int argc, _TCHAR* argv[]){
 A* ppp = new A();
 return 0;
}
写多了C#的程序,突然间再回到古老的C++的确是非常不习惯。以上代码就今天解决的问题。感谢麦当!!~~强调一点,C++中是不直接支持ctor直接调用ctor的,除非有特殊需求才会出现以上特殊的语法。

2007.4.26 [Windows Mobile 5.0 Powertoys]

Device Security Manager Powertoy for Windows Mobile 5.0

  1. 查看当前Cradle的设备的安全配置以及所安装的数字证书;
  2. 查看标准安全配置下的安全策略和数字证书;
  3. 检查某个文件的签名;
  4. 存储开发所需的数字证书以及当前Cradle的设备的安全配置。
Device Security Manager helps developers test various security policies for Windows Mobile devices. It is designed as a desktop application that ships with a preset list of “security configurations”. A security configuration can be thought of as a template, which contains a collection of individual policies and settings. Using this tool, the developer can provision a Windows Mobile device with different configurations, and then test the application’s behavior under these configurations. This tool can be used either on an emulator or an unlocked Windows Mobile device.
 
Note: We take great care to ensure that PowerToys work as they should, but they are not part of Windows Mobile and are not supported by Microsoft. For this reason, Microsoft Technical Support is unable to answer questions about PowerToys. PowerToys are for Windows Mobile only.

Windows Mobile Developer Power Toys

  1. Emulator ActiveSync Connection Tool – Allows Activesync to connect to your Emulator session from Visual Studio .NET 2003.
  2. ActiveSync Remote Display – Display Pocket PC applications on your desktop or laptop without needing any device side configuration.
  3. CECopy – Command line tool for copying files to the device currently connected to desktop ActiveSync.
  4. Convert PPC DAT to SP XML – Command line tool for generating Smartphone CABWizSP XML docs from existing Pocket PC CAB files.
  5. Hopper – User input stress simulator.
  6. JShell – UI version of the Platform Builder Target Control Window.
  7. PPC Command Shell – Command shell for the Pocket PC 2003 device.
  8. RAPI Debug – Displays detailed information about currently running processes.
  9. RAPI Start – Command line tool to remotely start an application on your Pocket PC from your desktop.
  10. TypeIt – Send characters/strings to the Smartphone 2003 Emulator via ActiveSync.

2007.4.15 [Power Manager 原理]

[读书笔记]
 
在Windows CE设备上,如果CPU没有指令需要处理,1毫秒之后,它便会进入Idle状态中。在这个状态中,CPU处于极低的电耗中,直到某个硬件设备将它激活,或者到来了一个计划任务需要去执行。
 
Power Manager(Windows Mobile 2003中被引入)的主要工作就是管理那些“不能自我管理的驱动程序”。举个例子,USB Port能够很好的管理自己的电源使用,当没有设备插入,它就关闭自己,而无需耗电;但是类似于LCD这样的设备呢?它无法知道用户当前是否在使用它。
Note: It can manage all of them, but a driver must be written to take advantage of PM’s control, and we haven’t required that they all do so.
 
Power Manager引入了一个叫作“System Power States”的概念,很简单,PM拥有一个它所控制的所有驱动程序的列表,对于每一个驱动的电源状态,它都有一套对应的设置值。如下:
  1. On:用户正在和设备交互,所有的设备都处于打开中。
  2. BacklightOff:很短时间内用户没有进行操作,只是屏幕的背光灯关闭了。(New in Windows Mobile 5
  3. UserIdle:更长时间内没有进行操作,背光灯和屏幕都被关闭了。(Pocket PC中不被使用,因为它使用了Sleep的概念,但是将来Pocket PC会被设计为Always On,那时便会使用到这个状态)
  4. ScreenOff:用户手动指定地关闭了屏幕。
  5. Unattended:为了不让用户知道,而进行Background操作。ActiveSync就使用了这个状态值:wake up->syncing->sleep。(Pocket PC独有的)
  6. Resuming
  7. Suspended:Pocket PC的Sleep状态。非官方指定的状态。

2007.4.15 [Power Topics – Windows Mobile Team Blog]

2007.4.15 [Power Management Programming Overview]

在这周的工作中,发现了不少关于Windows CE based设备上,电源管理方面编程的问题。在工作以及业余时间,查阅了一些资料,这里将问题进行归类,并且作下概要的总结,如下:
 
Overview:Windows CE是使用电池来供电的系统;当用户关闭了Windows CE设备,电源系统事实上并不会关闭设备的电源,而只是被挂起;当用户打开设被电源时,设备不会重启而是被唤醒。以上这一特点导致了应用程序,在唤醒后会像挂起前一样运行,而且它根本也不会知道曾经被挂起过,除非应用程序明确地请求当系统挂起前通知它。
 
Query Power State:查询电源状态的函数有以下这些,
GetSystemPowerState
GetSystemPowerStateEx // 该函数在Emulator不支持;RAPI中对应CeGetSystemPowerStateEx
GetSystemPowerStateEx2
// 参数1:SYSTEM_POWER_STATUS_EX2的结构指针;(这个结构中大多数成员可能无法获得其指,所以多数的OEM厂商的解决方案只是简单地填入Unknown)
// 参数2:SYSTEM_POWER_STATUS_EX2的结构大小;
// 参数3:BOOL(TRUE从driver中或者最新的电池状态信息;false从缓冲中获得信息,可能不是最新的信息)
NOTE:Windows CE的系统大约每5秒会查询一次电池的状态;Windows CE不验证上面函数所返回的数据,而且以上这些返回的数据依赖于驱动,不同的系统可能会有不同值。
 
Change Power State较新的Windows CE版本使用电源管理程序
GwesPowerOffSystem或者使用Keybd_event模拟用户按键关闭设备(KEY_UP & KEY_DOWN事件);ExtEscape函数可以用来关闭屏幕。
 
防止系统挂起:使用SystemParametersInfo查询系统三个TimeOut值,并调用SystemIdleTimeReset进行重新设定;或者使用SendInputAPI来模拟用户对于设备的输入。
 
Windows CE.NET 4.0中引入了电源管理程序,定义了一系列电源状态:D0,D1,D2,D3;这些系统的电源状态可以由OEM厂商制定;此外电源管理程序提供了以下功能:
  1. 通知电源状态改变的能力;RequestPowerNotifications
  2. 提供了一系列的函数,以统一改变电源状态;SetSystemPowerState 和 SetPowerRequirement