MobiNav

All Things Mobility

octobre 24th, 2007

Wifi scanner + custom MFC controls

Good job on customizing MFC controls. See it at codeproject.

Related works:

juin 4th, 2007

Comment spécifier un URL en démarrage de Pocket Internet Explorer

SHELLEXECUTEINFO  SHInfo;
SHInfo.cbSize = sizeof(SHELLEXECUTEINFO);
SHInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
SHInfo.lpFile = lpFilePath;  // path of PPC explorer
SHInfo.lpParameters = lpURL;  // URL

ShellExecuteEx(&SHInfo);

février 26th, 2007

L’analyse de dépendance avec link.exe

On peut obtenir un certain nombre d’information avec l’optioon /dump  du linker de la plateforme cible. Par exemple,

« C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\WCE400\BIN\link.exe » /dump -HEADERS -DEPENDENTS toto.exe > dump.txt 

il donne la sortie ci-dessous avec le résumé, les dépendances, etc. 
Read the rest of this entry »

avril 27th, 2006

Power Manager Suspend Time-outs

[Source : MSDN

The following list shows the registry values that control system power state transitions for the sample Power Manager:

  • ACUserIdle
  • ACSystemIdle
  • ACSuspend
  • BattUserIdle
  • BattSystemIdle
  • BattSuspend
  • BatteryPoll

These DWORD values are stored in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\Timeouts registry key. A value of 0 indicates that no time-out will occur. The sample implementation does not provide a method for bypassing OS power states; however, OEMs may choose to do so.

For the Power Manager to actively manage system power states, these settings need to be present in the registry. The actual decision to manage system power is based on the presence of ACUserIdle.

Note   To prevent conflicts between GWES and the Power Manager, you need to disable GWES power management as described previously. When the Power Manager is actively managing system power, it may restrict applications from entering arbitrary system power states.

You can reset the system state transition timers by creating a named auto-reset event called _T(« PowerManager/ReloadActivityTimeouts« ) and calling SetEvent on the handle of that event. This informs the Power Manager to read transition timer settings again from the Timeouts registry key.

Registry Settings

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerTimeouts]

« ACUserIdle »=dword:3c; in seconds

« ACSystemIdle »=dword:12c; in seconds

« ACSuspend »=dword:0; in seconds

  »BattUserIdle »=dword:3c; in seconds

  »BattSystemIdle »=dword:b4; in seconds

  »BattSuspend »=dword:12c; in seconds

« BatteryPoll »=dword:1f4; battery polling interval, in milliseonds

janvier 4th, 2006

Get System Power Status

GetSystemPowerStatusEx

This function retrieves the power status of the system. The status indicates whether the system is running on AC or DC power, whether or not the batteries are currently charging, and the remaining life of main and backup batteries.

BOOL GetSystemPowerStatusEx(
PSYSTEM_POWER_STATUS_EX pstatus,
BOOL fUpdate );

Parameters

pstatus
[out] Pointer to the SYSTEM_POWER_STATUS_EX structure receiving the power status information.

fUpdate
[in] If this Boolean is set to TRUE, GetSystemPowerStatusEx gets the latest information from the device driver, otherwise it retrieves cached information that may be out-of-date by several seconds.
Return Values
This function returns TRUE if successful; otherwise, it returns FALSE.

Remarks
The GetSystemPowerStatusEx function is not supported for emulation.

Requirements
Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h
Pocket PC 2002 Windows CE OS 3.0 Winbase.h Winbase.h coredll.lib
Pocket PC Windows CE OS 3.0 Winbase.h Header Link to
Note This information applies to the version of the operating system as provided by Microsoft. Actual implementation is determined by the original equipment manufacturer (OEM) and some devices may not support this function.

SYSTEM_POWER_STATUS_EX
This structure contains information about the power status of the system.

typedef struct _SYSTEM_POWER_STATUS_EX {
BYTE ACLineStatus;
BYTE BatteryFlag;
BYTE BatteryLifePercent;
BYTE Reserved1;
DWORD BatteryLifeTime;
DWORD BatteryFullLifeTime;
BYTE Reserved2;
BYTE BackupBatteryFlag;
BYTE BackupBatteryLifePercent;
BYTE Reserved3;
DWORD BackupBatteryLifeTime;
DWORD BackupBatteryFullLifeTime;
} SYSTEM_POWER_STATUS_EX, *PSYSTEM_POWER_STATUS_EX, *LPSYSTEM_POWER_STATUS_EX;

Members

ACLineStatus

AC power status. It is one of the following values: Value Description
0 Offline
1 Online
255 Unknown status

All other values are reserved.

BatteryFlag
Battery charge status. It can be a combination of the following values: Value Description
1 High
2 Low
4 Critical
8 Charging
128 No system battery
255 Unknown status

All other values are reserved.

BatteryLifePercent
Percentage of full battery charge remaining. This member can be a value in the range 0 to 100, or 255 if status is unknown. All other values are reserved.

Reserved1
Reserved; set to zero.

BatteryLifeTime
Number of seconds of battery life remaining, or 0xFFFFFFFF if remaining seconds are unknown.

BatteryFullLifeTime
Number of seconds of battery life when at full charge, or 0xFFFFFFFF if full lifetime is unknown.

Reserved2
Reserved; set to zero.

BackupBatteryFlag
Backup battery charge status. It is one of the following values: BATTERY_FLAG_HIGH
BATTERY_FLAG_CRITICAL
BATTERY_FLAG_CHARGING
BATTERY_FLAG_NO_BATTERY
BATTERY_FLAG_UNKNOWN
BATTERY_FLAG_LOW

BackupBatteryLifePercent
Percentage of full backup battery charge remaining. Must be in the range 0 to 100, or BATTERY_PERCENTAGE_UNKNOWN.

Reserved3
Reserved; set to zero

BackupBatteryLifeTime
Number of seconds of backup battery life remaining, or BATTERY_LIFE_UNKNOWN if remaining seconds are unknown.

BackupBatteryFullLifeTime
Number of seconds of backup battery life when at full charge, or BATTERY_LIFE_UNKNOWN if full lifetime is unknown.

décembre 3rd, 2005

Le Nom « My Documents »

Sur le PPC, le nom de dossier "My documents" dépends de la langue de version de ROM. Voici la méthode d’eVC pour récupérer ce chemin: [Ref : MSDN]
SHGetSpecialFolderPath(NULL,szTxt,CSIDL_PERSONAL,0);

CSIDL_PERSONAL requests that the "My Documents" folder be returned in szTxt (TCHAR).

décembre 3rd, 2005

Comment trouver la carte de stockage?

Voici un morceau de code d’eVc qui cherche la carte de stockage:[ref: MSDN]

void ShowFlashCard()
{
BOOL bContinue = TRUE;
HANDLE hFlashCard;
WIN32_FIND_DATA lpwfdFlashCard;

hFlashCard = FindFirstFlashCard (&lpwfdFlashCard);
if (hFlashCard == INVALID_HANDLE_VALUE) return;

while (bContinue)
{
MessageBox( NULL, lpwfdFlashCard.cFileName,
TEXT(« FindFlash »), MB_OK );
bContinue = FindNextFlashCard ( hFlashCard,
&lpwfdFlashCard );
}

FindClose (hFlashCard); // Close the search handle.
}

|