새로운소식2009. 3. 27. 14:51

SKT 가 옴니아 SW 경진 대회를 시작으로 앱스토어 오픈에 가속이 붙은 것 같습니다.

모바일용 SW를 누구나 사고 팔게 한다고 하네요

곧 SDK도 공개할 예정이라고 합니다. 4월13일에…

image

SKT 모바일콘텐츠 오픈마켓

Posted by krsuncom
옴니아2009. 2. 12. 18:31

T*옴니아 DMB 관련 API 가 공개 되었습니다.

옴니아 개발자분들 참조하세요

image

http://www.mysmart.co.kr/eventQnaList.do

Posted by krsuncom
IT 이야기2007. 10. 24. 11:25

마이크로 소프트웨어가 저가형 스마트폰을 선보인다는 기사다. 정말 마소 공룡은 안하는게 없네. 구글도 안하는게 없고 네이버도 안하는게 없고 다음도 안하는게 없고.....작은 회사들은 뭐해먹고 살아야 하나 ???

참조기사:요기

MS, 저가형 스마트폰 선뵌다

100달러미만 폰 내달 출시

관련기사

• MS-EU `반독점 9년분쟁`일단락

마이크로소프트(MS)가 하드웨어 업체들과 손잡고 100달러 미만의 저가형 스마트폰을 내놓는다.
블룸버그통신은 MS와 제휴업체들이 애플 아이폰의 도전에 맞서기 위해 판매가격 100달러 미만의 염가 스마트폰을 다음달 선보일 계획이라고 23일 보도했다.
이들 제품에는 MS의 윈도 모바일 운영체제(OS)가 탑재돼 이메일과 인터넷 서핑 등 각종 기능을 제공하게 된다. MS의 스콧 혼 이사는 "앞으로 몇 주 이내에 MS 윈도 모바일 기반의 많은 휴대폰들이 가격을 내리게 될 것"이라고 말했다. 혼 이사는 제품을 생산하고 판매할 하드웨어 업체와 이동통신 사업자가 어디가 될 것인지는 밝히지 않았다.
손정협기자 sohnbros@

MS, 저가형 스마트폰 선뵌다 - 디지털 시대, 디지털 리더 디지털타임스

Posted by krsuncom
IT 이야기2007. 10. 23. 10:41

 

국내 스마트폰이 똑똑해 진다는 기사다. 외국만큼 활성화가 되진 않았지만 매니아 층으로 부터 나날이 발전하고 있다 아래기사를 보면 서비스가 다양해 지는것은 사실이지만 다 유료 서비스이다. 무료로 쓸 수도 있겠지만 너무 복잡하다. 이동 통신사의 경우에는 유료로 받는 서비스 개발에만 몰두 하고 있다. 제조사 측에서 보면 사용자가 쓰기 편하게 개발 하고 싶겠지만 이동 통신사에서 원하지 않고 있으니.....이상한 이통사다. 정부의 비호를 너무 받아서 그런가?

 

아래 기사 참조 : 원문

똑똑한 휴대전화 ‘스마트폰’을 당신의 e비서로

‘당신의 휴대전화 사용 단계는 다음 중 어디까지 진화해 있습니까.’

1단계, 상대방에게 전화를 걸어 통화하기. 2단계, 문자메시지(SMS)나 컬러메시지(MMS) 보내고 받기. 3단계, 휴대전화로 컴퓨터(PC)의 문서파일이나 e메일 보내고 받기….


만약 2단계를 지나 3단계 이상으로 가고 싶다면 휴대전화에 개인휴대정보기(PDA)의 장점을 결합한 스마트폰에 도전해 볼 만하다.

스마트폰은 일반 휴대전화와 달리 윈도, 리눅스와 같은 개방형 운영체제(OS)를 적용해 전화통화 외에 PC와 같은 다양한 기능을 더한 제품이다.

최근 미국 애플의 ‘아이폰’이 큰 인기를 얻은 뒤 해외 시장에서는 다양한 스마트폰이 경쟁적으로 쏟아져 나오고 있고, 국내 시장에서도 스마트폰에 대한 관심이 확산되는 추세다.

○ 다양한 스마트폰 쏟아져 나와

미국 업체와 휴대전화로 e메일을 주고받는 일이 잦은 대기업 임원 A 씨는 얼마 전부터 아예 컴퓨터와 같은 배열의 ‘쿼티(QWERTY)’ 자판이 설치된 스마트폰을 구입해 사용하고 있다.

‘쿼티폰’으로는 미국에서 일명 ‘블랙잭’이라는 이름으로 인기를 얻은 삼성전자의 ‘울트라 메시징폰(SCH-M620, SPH-M6200)’이 대표적이다.

팬택 계열이 이달 말 미국에 선보이는 스마트폰인 ‘팬택 듀오(duo)’도 슬라이드 방식으로 쿼티 자판을 꺼내 쓰는 디자인을 채택했다.

인터넷이나 멀티미디어 파일을 즐기는 데 유리한 스마트폰도 많다.

올해 4월 유럽 시장에 선보인 LG전자의 ‘조이(LG-KS10)’는 미국의 구글과 제휴해 구글맵, 구글메일 이용을 편리하게 했다. 이 회사의 ‘LG-KS20’도 윈도 모바일 6.0 운영체제를 적용해 각종 멀티미디어 기능을 강화했다.

삼성전자의 ‘듀얼슬라이드 뮤직폰(SGH-i450)’ ‘모바일 내비게이션폰(SGH-i550)’ ‘패션 스마트폰(SGH-i560)’은 각각 음악, 내비게이션, 패션 등 각 분야를 특화해 개발됐다.

이 밖에도 △무선 인터넷 기능을 강화한 노키아의 ‘N810’ △위성위치확인시스템(GPS)을 장착한 HP의 ‘아이팩912’ △100달러대의 최저가인 팜의 ‘센트로(Centro)’ △대만 HTC의 ‘터치’ 등이 애플의 ‘아이폰’과 경쟁을 벌이는 대표적인 스마트폰이다.

○ 스마트폰 활용 서비스 국내서도 등장

각양각색의 스마트폰이 넘쳐나는 해외 시장과 달리 국내 시장은 상대적으로 조용한 편이다. 최근 소개된 제품도 삼성전자의 ‘울트라 메시징폰’ 정도에 그친다.

하지만 3세대(3G) 이동통신 서비스 가입자가 늘어나면서 스마트폰의 인기가 조금씩 살아날 것이라고 관련 업체들은 전망했다.

이동통신 사업자들도 스마트폰으로 활용할 수 있는 다양한 서비스를 준비하면서 앞으로 국내 스마트폰 시장 확산에 대비하고 있다.

예를 들어 SK텔레콤의 ‘모바일 미니PC’나 KTF의 ‘쇼 마이 PC’는 외부에서 자신의 컴퓨터에 연결해 동영상, 문서파일을 불러오고 실행할 수 있는 서비스다.

또 휴대전화 인터넷을 일반 PC 화면과 똑같이 보여 주는 ‘풀 브라우징’ 등도 스마트폰 이용자를 즐겁게 할 서비스로 꼽힌다.

김용석 기자 nex@donga.com

내 손안의 뉴스 동아 모바일 401 + 네이트, 매직n, ez-i
ⓒ 동아일보 & donga.com, 무단 전재 및 재배포 금지

donga.com[뉴스]-똑똑한 휴대전화 ‘스마트폰’을 당신의 e비서로

Posted by krsuncom
개발이야기2007. 10. 18. 19:26

원본:요기 

윈도우에서 Physical Drive 직접 읽고 쓰기

  • 드라이브 열기
  1. HANDLE OpenDrive( int iPhysicalDriveNumber )
    {
        HANDLE hDevice;
        char vcDriveName[ 30 ];
  2.     // HDD를 실수로 지우는걸 방지하기 위함

        if( iPhysicalDriveNumber == 0 )
        {
            return INVALID_HANDLE_VALUE;
        }

  3.     // Physical Drive를 연다.
        sprintf( vcDriveName, "\\\\.\\PhysicalDrive%d", iPhysicalDriveNumber );
        hDevice = CreateFile( vcDriveName, GENERIC_READ | GENERIC_WRITE,
            FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
        return hDevice;
    }

  • 드라이브 읽기
  1. BOOL ReadSector( HANDLE hDevice, DWORD dwSectorOffset, BYTE* pbBuffer,
                     int iSectorCount )
    {
        DWORD dwLow;
        DWORD dwHigh;
        DWORD dwRet;
        DWORD dwRead;
        DWORD dwErrorCode;
  2.     // 움직일 위치는 byte 단위로 되어야 한다.
        // 결국 dwSectorOffset에 512를 곱해줘야 한다.
        dwLow = ( dwSectorOffset << 9 );
        dwHigh = ( dwSectorOffset >> 23 );
  3.     // File Pointer를 이동한다.
        dwRet = SetFilePointer( hDevice, dwLow, &dwHigh, FILE_BEGIN );
        if( dwRet == INVALID_SET_FILE_POINTER )
        {
            return FALSE;
        }
  4.     // Sector를 읽는다.
        if( ReadFile( hDevice, pbBuffer, iSectorCount * SECTORSIZE, &dwRead,
            NULL ) == FALSE )
        {
            dwErrorCode = GetLastError();
            return FALSE;
        }
  5.     return TRUE;
    }
  • 드라이브 쓰기
  1. BOOL WriteSector( HANDLE hDevice, DWORD dwSectorOffset, BYTE* pbBuffer,
                     int iSectorCount )
    {
        DWORD dwLow;
        DWORD dwHigh;
        DWORD dwRet;
        DWORD dwWrite;
        DWORD dwErrorCode;
  2.     // 움직일 위치는 byte 단위로 되어야 한다.
        // 결국 dwSectorOffset에 512를 곱해줘야 한다.
        dwLow = ( dwSectorOffset << 9 );
        dwHigh = ( dwSectorOffset >> 23 );
  3.     // File Pointer를 이동한다.
        dwRet = SetFilePointer( hDevice, dwLow, &dwHigh, FILE_BEGIN );
        if( dwRet == INVALID_SET_FILE_POINTER )
        {
            return FALSE;
        }
  4.     // Sector를 쓴다.
        if( WriteFile( hDevice, pbBuffer, iSectorCount * SECTORSIZE, &dwWrite,
            NULL ) == FALSE )
        {
            dwErrorCode = GetLastError();
            return FALSE;
        }
  5.     gs_dwTotalWriteSectorCount += iSectorCount;
        return TRUE;
    }
  • 드라이브 닫기
  1. void CloseDrive( HANDLE hDevice )
    {
        CloseHandle( hDevice );
    }

Drive의 Geometry 읽기

Geometry정보에는 CHS 값이 들어있기 때문에 유용하게 쓸 수 있다.

  1. BOOL GetDriveGeometry( int iPhysicalDriveNumber, GEOMETRY* pstGeometry )
    {
        HANDLE hDevice;
        BOOL bRet;
        DWORD dwOutBytes;
        char vcDriveName[ 30 ];
        DISK_GEOMETRY stWindowGeometry;
  2.     // Physical Drive Number를 저장한다.
        sprintf( vcDriveName, "\\\\.\\PhysicalDrive%d", iPhysicalDriveNumber );
  3.     hDevice = CreateFile( vcDriveName, 0, FILE_SHARE_READ |
            FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
  4.     if( hDevice == INVALID_HANDLE_VALUE )
        {
            return FALSE;
        }
  5.     bRet = DeviceIoControl( hDevice, IOCTL_DISK_GET_DRIVE_GEOMETRY,
            NULL, 0, &stWindowGeometry, sizeof( DISK_GEOMETRY ), &dwOutBytes,
            NULL );
  6.     CloseHandle( hDevice );
  7.     // 지금은 윈도우 Geometry와 같은 Geometry를 사용한다.
        memcpy( pstGeometry, &stWindowGeometry, sizeof( DISK_GEOMETRY ) );
  8.     return bRet;
    }

Drive Descriptor 얻기

Descriptor에 보면 해당 드라이브의 제품명과 리비전 번호 같은 걸 알 수 있다.

  1. BOOL GetDeviceDescriptor( char* pcDevice, PSTORAGE_DEVICE_DESCRIPTOR pstDesc )
    {
        HANDLE hDevice;
        STORAGE_PROPERTY_QUERY  stQuery;
        DWORD dwOut;
        BOOL bRet;
  2.     memset( pstDesc, 0, sizeof(STORAGE_DEVICE_DESCRIPTOR) );
  3.     // Device를 Open한다.
        hDevice = CreateFile( pcDevice, GENERIC_READ, FILE_SHARE_READ |
            FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
        if( hDevice == INVALID_HANDLE_VALUE )
        {
            return FALSE;
        }
  4.     pstDesc->Size = sizeof( STORAGE_DEVICE_DESCRIPTOR );
  5.     // Device Io Control을 호출한다.
        stQuery.PropertyId = StorageDeviceProperty;
        stQuery.QueryType = PropertyStandardQuery;
  6.     bRet = DeviceIoControl( hDevice, IOCTL_STORAGE_QUERY_PROPERTY,
                &stQuery, sizeof( STORAGE_PROPERTY_QUERY ),
                pstDesc, pstDesc->Size, &dwOut, NULL);                
        if( bRet == FALSE )
        {
            return FALSE;
        }
  7.     CloseHandle( hDevice );
        return TRUE;
    }

Drive 문자로 Physical Index 얻기

드라이브 문자로 Physical Index를 얻는 방법은 VOLUME 정보를 이용하면 된다.

  1. int GetPhysicalDriveNumber( char cDriveName )
    {
        HANDLE hDevice;
        DWORD dwOut;
        BOOL bRet;
        char vcDriveName[ 40 ];
        VOLUME_DISK_EXTENTS* pstVolumeData;
        int iDiskNumber;
  2.     // 메모리를 할당한다.
        pstVolumeData = ( VOLUME_DISK_EXTENTS* ) malloc( VOLUMEDISKSIZE );
        if( pstVolumeData == NULL )
        {
            return -1;
        }
  3.     // 해당 Drive의 정보를 얻는다.
        sprintf( vcDriveName, "\\\\?\\%c:", cDriveName );
        // Device를 Open한다.
        hDevice = CreateFile( vcDriveName, GENERIC_READ, FILE_SHARE_READ |
            FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
        if( hDevice == INVALID_HANDLE_VALUE )
        {
            return -1;
        }
  4.     // Device Io Control을 호출한다.
        bRet = DeviceIoControl( hDevice, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
                NULL, 0, pstVolumeData, VOLUMEDISKSIZE, &dwOut, NULL );
        if( bRet == FALSE )
        {
            free( pstVolumeData );
            return -1;
        }
        CloseHandle( hDevice );
  5.     // Disk 정보가 1보다 작으면 실패
        if( pstVolumeData->NumberOfDiskExtents < 1 )
        {
            free( pstVolumeData );
            return -1;
        }
  6.     iDiskNumber = pstVolumeData->Extents[ 0 ].DiskNumber;
        free( pstVolumeData );
  7.     return iDiskNumber;
    }


Logical Drive와 Physical Drive 간의 매치방법

1. 일단 Logical Drive를 검색한다.
-> GetDriveType() 함수를 이용
2. 해당 Drvie를 열어서 Volume 정보를 얻음
-> "\\?\c" 와 같은 형태로 CreateFile() 호출
-> IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS를 날려서 Physical Drive 정보를 얻음
-> 리더기에 데이터가 연결되어있지 않으면 DeviceIoControl에서 문제 발생

00 Window I/O 관련

Posted by krsuncom
개발이야기2007. 10. 10. 09:57

원문이라네 : 요기

Tweaks and Hacks

Post registry and software hacks to make your TyTN do even more here.
(Obviously none of these will be supported by either HTC or your local phone service provider. Use these at your own risk.)
Registry Editors:
Mobile Registry Editor
Works with Mobile 5 though developed for older

Change Bluetooth Name Without Changing Owner Name
Normally the name of your device which is displayed when using bluetooth is the owner name.
To change this use a registry editor and browse to
\HCKU\Software\Microsoft\Bluetooth\Settings\Local Name
And change the value of the local name key to what ever you want.
THIS HAS ONLY BEEN TESTED ON MY DEVICE: IMATE JASJAM RUNNING WINDOWS MOBILE 5.0 (build 14955.2.3.0) AKU 2.3
Internet Explorer Navigation
The default behaviour for your device's four-way direction button in Pocket Internet Explorer (PIE) is to jump between hyperlinks/form fields on a web page. To change this behaviour so that the button scrolls the page left, right, up and down, use the following tweak:
\HKLM\Software\Microsoft\Internet Explorer\Navigation\4-Way Nav = 0 (DWORD decimal)
And to re-enable hyperlink/form field navigation:
\HKLM\Software\Microsoft\Internet Explorer\Navigation\4-Way Nav = 1 (DWORD decimal)
NB: You may still jump between links using Tab and Shift-Tab if your device has a built-in hardware keyboard.
WM5: Increase Performance and Speed

Boost Windows Mobile 5 performance by makeing the following changes in the registry...
[HKLM\System\StorageManager\FATFS] CacheSize = 4096 EnableCache = 1
[HKLM\System\StorageManager\Filters\fsreplxfilt] ReplStoreCacheSize = 4096
Default values for all keys are 0. Soft reset for changes to take effect.
Disable Menu Animation

Navigate to HKEY_LOCAL_MACHINE\SYSTEM\GWE\Menu, then change the value of "AniType" from 6 (default) to 0.
This disables the menu animation which helps in speeding up your PocketPC.
Change the Tap and Hold Dots Colours

1) Go to the HKLM\SOFTWARE\Microsoft\Color\ key.
2) Add a Binary value called "40" if it does not already exist.
3) Set the value to "rr gg bb 00" (RGB hex values 00 to FF so "FF 00 000 00" is Red)
SMS Settings

SMS Notification Always On
[HKEY_CURRENT_USER\Software\Microsoft\Inbox\Settings]
"SMSDeliveryNotify"=dword:00000001 ->0 to disable, 1 to enable.
Disable SMS Sent Notification
[HKEY_LOCAL_MACHINE\Software\Microsoft\Inbox\Settings]
"SMSNoSentMsg"=dword:00000001 ->0 to enable, 1 to disable.
Bottom tray icons

Remove the Battery Icon:
[HKEY_LOCAL_MACHINE\Services\Power]
"ShowIcon"=dword:00000000
Remove the Wireless Manager Icon:
[HKEY_LOCAL_MACHINE\Services\WirelessMgr]
"Keep"=dword:00000000
Restore local language support for sliding keyboard after upgrade to a different language ROM

This has been reported not to work, see below for another hack
You need to create Registry value of name "Locale" and type of "String" and data of "Localization ID" within [HKEY_CURRENT_USER\ControlPanel\Keybd]
Localization IDs:
French = 040c
German = 0407
Italian = 0410
Japanese = 0411
Kazakh = 043f
Russian = 0419
Other IDs can be found here: Tweaks and Hacks - htcwikihttp://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx.
Some versions of the OS seem to be case sensitive on this value, and if it does not work, try upper case letters. Registry example for say russian kbd:
[HKEY_CURRENT_USER\ControlPanel\Keybd]
"Locale"="0419"
Modification to keyboard hack. The above solution does not work for the Hermes the following new settings are required.

Goto the following registry entry
[HKEY_LOCAL_MACHINE\Software\Oem\Qwerty]
There is a key called 'Layout' and it is in Decimal.
The default value of English ROM is 20409, and Chinese ROM is 20404 (both are in hexadecimal).
The suitable value for German Hermes keyboard is 20407 (132103 in decimal).
Probably Hermes use 20+country ID (409=WWE, 407=German, 404=Trad. Chinese, etc...) format for keyboard layout value.

The above settings does not work with the latest Hermes firmware, the following is required.

[HKEY_CURRENT_USER\keyboard layout\Preload]
"Default"="e0010414"
[HKEY_CURRENT_USER\keyboard layout\Preload\1]
"Default"="e0010414"
[HKEY_LOCAL_MACHINE\Software\Oem\Qwerty]
"Layout"="132116"
The last setting is the same as in the above solution
These settings are for Norwegian keyboard, country code : 0414
Tested on fw. 1.31.502.1
Improve BT A2DP sound quality

[HKLM/Software/Microsoft/Bluetooth/A2DP/Settings]
Add new dword, Value name=BitPool; Value data=48 (Decimal)
Modify, Value name=UseJointStereo; Value data=0 (Decimal, Originally 1)
For BitPool:
Microsoft suggests the following bitpool values for optimal buffer sizes.
30 - Low audio quality
40 - Medium audio quality
48 - High audio quality
58 - Excellent audio quality
Chose one you like. I think 48 is good enough.
For UseJointStereo: use 0 instead of 1, then you got the real stereo.
Show Network Operator Name in today screen

Restoring Today Item: WiFi, BT and Phone Connection Status
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Today\Items] Create "Wireless" use Key "Flags"=dword:00000000
"Options"=dword:00000000
"DLL"="netui.dll"
"Order"=dword:00000000
"Enabled"=dword:00000001
"Type"=dword:00000004
  • Enable clicking on the today plugin above open Comm Manager
[HKEY_LOCAL_MACHINE\ControlPanel\WrlsMgr] Create key "Redirect" "Redirect"= "\Windows\CommManager.exe"
Restore clock on top bar

[HKLM\Software\Microsoft\Shell\]
"ShowTitleBarClock"=1 (enable)
"ShowTitleBarClock"=0 (disable)
PocketIE Cache in storage card

Create these folders:
\Storage Card\Pocket IE\Temporary Internet Files
\Storage Card\Pocket IE\Cookies
\Storage Card\Pocket IE\History
Add the following registry keys, string data type:
[HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
"Cache"="\Storage Card\Pocket IE\Temporary Internet Files"
"Cookies"="\Storage Card\Pocket IE\Cookies"
"History"="\Storage Card\Pocket IE\History"
Disable flashing service LEDs

[HKLM\Drivers\BuiltIn\AllLEDMgr]
"Index"=0 Note! Disables vibrating.
Adding disconnect GPRS/UMTS button

To add Disconnect button and a timer display showing how long GRPS is in use for the session: HKLM\ControlPanel\Phone\Flags2 = 16 (DWORD decimal) To have only Disconnect button: HKLM\ControlPanel\Phone\Flags2 = 8 (DWORD decimal) To disable both the Disconnect button and the timer: HKLM\ControlPanel\Phone\Flags2 = 0 (DWORD decimal)
Disable annoying beeps when changing in-call volume

There are actually 3 different sounds in play here: the one at the bottom end of the slider (quietest), the one in the middle posisitions (standard), and the one at the top end of the slider (loudest). These are handled by 3 registry keys: HKCU\ControlPanel\Sounds\LoudestInCallVolume
HKCU\ControlPanel\Sounds\QuietestInCallVolume
HKCU\ControlPanel\Sounds\StandardInCallVolume Within each of these keys the default 'Script' value is 'p' for 'play', change the 'Script' value to blank (erase the 'p').
Change ringtone/vibrate/LED flash characteristics

If you would like more control over how your device rings/vibrates/flashes its LEDs on events, you can can change the Script values of these events.
For example, for an incoming call performing 'activate device, play ringtone, wait 3 seconds, repeat':
HKCU\ControlPanel\Sounds\RingTone0\Script = "apw3r" (REG_SZ string, no quotes)
For performing 'active device, set volume to 33%, play ringtone, set volume to 67%, play ringtone, set volume to 100%, play ringtone (no repeat)':
HKCU\ControlPanel\Sounds\RingTone0\Script = "ac33pc67pc100p" (REG_SZ string, no quotes)
The following are the full codes available to you.
Please note that all the codes are executed simultaneously except after a ringtone play / wait code. E.g. 'v1p' will vibrate and play at the same time, while vibrating for 1 second. But 'pv1' will play the ringtone through all the way first, then start vibrating for 1 second. a = activate device
cN = set volume to N in percentage max volume
fN = flash notification LED for N seconds
p = play ringtone. Note that this will play the ringtone all the way through before continuing with the next code.
r = repeat. Note that this should be the last code in your Script string, if used at all. The repeat will be from the most recent a. So: v3apr will vibrate once then repeat the ring signal.
vN = vibrate for N seconds
wN = wait for N seconds. Note that the device will wait this long before continuing with the next code.

Tweaks and Hacks - htc

Posted by krsuncom
개발이야기2007. 8. 30. 15:36

엄청나게 많은 정보다. 원본은 요기 :HTC UNIVERSAL HACK COLLECTION POOL! - xda-developers

HTC UNIVERSAL HACK COLLECTION POOL!


Dear Friends,
As an one month owner of Htc Universal, i searched the internet a lot and found lots of information. Also this great forum is really helpfull for me to do the rom updates or hacks provided by the experienced members... But i am thinking to open a topic to share what i found with all description... So i want to upload all the cabs and hacks i found, in an ordinary way... Probably most of the hacks which i uploaded here may be given a time ago in these forum or somewhere else... So this topic is aimed to be a collection pool of all the hacks for newbies like me and i will try to update the topic frequently... Any help to me is really great and for any mistake of mine, please forgive me...
Regards and thanks...

HTC UNIVERSAL HACK COLLECTION POOL!
**** NONE OF THE HACKS, UPLOADED IN THIS TOPIC, BELONG TO ME...I HAVE COLLECTED ALL OF THEM FROM THE INTERNET... THANKS GO TO THEIR PROGRAMMERS AND FOUNDERS....
*** AFTER APPLYING HACKS, PLEASE POWER OFF THE PHONE AND WAIT FOR 5 SECONDS AND THEN SOFT RESET...
HARD RESET:
PLEASE DONT FORGET TO BACKUP YOUR IMPORTANT DATA.
PRESS BOTH SOFT KEYS ON THE KEYBOARD AND RESET HOLE WITH STYLUS AT THE SAME TIME TO DO A HARD RESET...
BOOT LOADER MODE(USB/SERIAL):
FIRST DEATTACH SIM AND SD/MMC MEMORY CARD.
DISCONNECT USB CABLE.
PRESS BACKLIGHT BUTTON + POWER BUTTON + RESET HOLE AT THE SAME TIME.
YOU WILL SEE " SERIAL " ON THE SCREEN.
NOW CONNECT USB CABLE TO ENTER " USB " MODE.
PHONE KEYS VIBRATION EFFECT:
With this hack, you can feel the vibrate effect while pressing phone keys...
PHONE KEYS SOUND EFFECT:
With this hack, you can go back to default settings after phone keys vibration effect hack...
SHOW CONTACTS FIRST NAME SURNAME ORDER:
With this hack, you can change the view style of contacts to first name surname. After installation, tap and hold any contact and slect the file as option from the menu...
CHANGE BACKLIGHT KEY COMMAND:
With this hack, you can change the command of back light button to any program other than backlight function...
CLEARTYPE ON FOR PORTRAIT AND LANDSCAPE MODES:
With this hack, you can activate clear type both for portrait and landscape modes...
ACTIVATE PHONE SKIN WITH 3D BUTTONS:
With this hack, you can activate phone skin with 3d buttons in the expense of some memory and speed..
BLUETOOTH VOICE DIAL COMMAND OFF:
With this hack, you can deactivate the launching of voice command program and get opportunity to transfer the playing music directly to bluetooth headset by pressing the voice call button on the bluetooth headset (must be supported by bluetooth headset)...
BLUETOOTH VOICE DIAL COMMAND ON:
With this hack, you can reactivate voice call function over bluetooth headset...
DISABLE SECURITY:
With this hack, you can disable security procedures just after a clean hard reset without extented rom installations...
PERFORMANCE TWEAK HIGH RESOURCES:
With this hack, you will change the all storage caches,audio prioty,soft keyboard sensivity,font cache,glyph cache,deactivate start menu and windows animations with high amount of memory allocations...
PERFORMANCE TWEAK LOW RESOURCES:
With this hack, you will change the all storage caches,audio prioty,soft keyboard sensivity,font cache,glyph cache,deactivate start menu and windows animations with low amount of memory allocations...
WIFI G MODE ON:
With this hack, you can activate the mode for connecting wifi networks only for g protocol but be advised that there is no significant speed improvement over b mode...
WIFI SCAN INTERVAL LOW:
With this hack, you can consume some battery power while wifi is on by lowering the scan interval of wifi networks...
POCKET IE TWEAKS:
With this hack, you can change the parameters of pocket ie.the changes are make fit,zoom to small,search page as google,max request and max connections,cleartype on for ie,pocket ie as msie6.0 ...
ENHANCED FILE DIALOG:
With this Hack, you can enhance the builtin file dialog applet to browse whole the phone easily in the dalog window.just copy all the files in the archive to windows dir and soft reset.After run the file dialog applet from control panel and check the option Exchange standart File Dialog.
SOFT KEY APPLET:
With this hack, you can change the soft key commands.Just copy the file in the archive to windows dir and soft reset.After run the applet from control panel...
DSP ENHANCER -BASS&TREBLE SETTINGS:
With this hack, you can set the level of bass and treble easily via applet in the control panel. Especially you can feel the basss and treble changes by headset... ( Removed! Reported to be not working with Htc Universal )
UNLOCK EXTENDED ROM:
With this hack, you can get extra 10 mb free space in the new mounted storage area called ExtendedROM...Simply after installing cab, just run the ExtROMUNLOCKER from start menu - programs and soft reset.After you can add or delete any file in this new storage space or organize it with the cabs which you want to automatically be installed after hard reset...
HIDE ROTATE ICON FROM TRAY BAR:
With this hack, you can hide rotate icon from tray bar...
SHOW ROTATE ICON ON TRAY BAR:
With this hack, you can show rotate icon on tray bar...
HIDE WIRELESS MANAGER ICON FROM TRAY BAR:
With this hack, you can hide wireless manager icon from tray bar...
SHOW WIRELESS MANAGER ICON ON TRAY BAR:
With this hack, you can show wireless manager icon on tray bar...
HIDE BATTERY ICON FROM TRAY BAR BATTERY:
With this hack, you can hide the battery icon from tray bar...
SHOW BATTERY ICON ON TRAY BAR:
With this hack, you can show the battery icon on the tray bar...
ACTIVATE TRUE VGA MODE:
With this hack, you can activate true vga mode (96 dpi instead of 192 dpi). Installation information included.
WM5 NEW MENU
With this hack, you can change one of the soft keys as a new menu like in windows mobile 2003...
DISABLE GPRS AUTO CONNECT
With this hack, you can disable gprs autoconnect and then connect manually whenever you want...
BLUETOOTH ICON ON TRAY BAR
With this hack, you can see and change the status of bluetooth from tray icon.
***UPDATE: 03.03.2006***
TUNE CLEAR TYPE LEVEL:
With this hack, you can tune the level of clear type from high to low or from low to high. Very usefull when using true vga mode. Install and run the program from start menu...
POCKETIE BLANK HOME PAGE
With this hack, pocketie will start with a blank home page...
DATE+TIME ON TITLE BAR
With this hack, date and time is available on the title bar...

HTC UNIVERSAL HACK COLLECTION POOL! - xda-developers

Posted by krsuncom
개발이야기2007. 8. 30. 15:32

Source: http://www.ppcsg.com/index.php?showtopic=49904 

Just fiddled with my mini's registry and found that the GPRS can be disabled. This would be pretty useful if u:
1) have absolutely no use for GPRS.
2) have no intention to use GPRS.
3) have been chalking up huge bills for GPRS.
Anyway, if u wanna rid urself of GPRS:
1) Open ur registry editor
2) Go to the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ConnMgr\Providers\
{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections
\IDEAS Internet (GPRS)\Enabled
3) Edit the key 'Enabled' by double-tapping or otherwise.
4) Change its DWORD Data from '1' to '0'.
5) Go to the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ConnMgr\Providers\
{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections
\IDEAS WAP (GPRS)\Enabled
6) Edit the key 'Enabled' by double-tapping or otherwise.
7) Change its DWORD Data from '1' to '0'.
8) Soft-reset.
If u really really hate GPRS, u might as well rid urself of the MMS function as well:
1) Open ur registry editor
2) Go to the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ConnMgr\Providers\
{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections
\IDEAS MMS\Enabled
3) Edit the key 'Enabled' by double-tapping or otherwise.
4) Change its DWORD Data from '1' to '0'.
5) Soft-reset.

PPCSG -> How to disable GPRS and MMS

Posted by krsuncom
개발이야기2007. 8. 30. 14:43

원본 : 요기

USE SD Card as My Documents Folder

This hack isn't very practical for people which swaps SD cards on and off frequently.

Open the key HKLM\System\?StorageManager\Profiles\SDMemory and change the value of the string "Folder" to "My documents". Be sure to close all documents and copy the original My Documents content to the SD card. Remove or rename the Old 'My Documents' out of the way and soft-reset. It might happen that another 'My Documents' folder is created and the SD shows up as 'My Documents 2'. just delete the just created 'My Documents', and remove and reinsert the SD card.

XDADeveloperWiki - BA_Hacks_WM5

Posted by krsuncom
개발이야기2007. 8. 30. 14:37

유용한 정보가 될것같다 : 원본은 요기

Popular Reg Tweaks


Here's a list of some of the more popular reg tweaks taken from my Longhrn 4015 theme:

Quote:

[RegData] ; registry key list
HKLM,Software\Microsoft\Splash Screen, CarrierBitmap,, \Storage\Longhorn\boot2.gif
HKLM,Software\Microsoft\Splash Screen, CarrierShutdownBitmap,, \Storage\Longhorn\boot2.gif
HKLM,Software\Microsoft\Splash Screen, MSBitmap,, \Storage\Longhorn\boot1.gif
HKLM,Software\Microsoft\Splash Screen, MSShutdownBitmap,, \Storage\Longhorn\boot1.gif
HKLM,Software\Microsoft\Windows Media Player\Parameters,SkinDir,,"\Storage\WMP\"
HKLM,Software\Microsoft\Windows Media Player\Parameters,SkinFile,,wmplayer.skn
HKLM,Software\Microsoft\Shell\Rai\:CallAlert, BKBitmapFile,,\Storage\Longhorn\call.gif
HKLM,Software\Microsoft\Shell\Rai\:ErrorBox, BKBitmapFile,, \Storage\Longhorn\exclamation.gif
HKLM,Software\Microsoft\Shell\Rai\:ExclamationBox, BKBitmapFile,, \Storage\Longhorn\exclamation.gif
HKLM,Software\Microsoft\Shell\Rai\:InformationBox, BKBitmapFile,, \Storage\Longhorn\information.gif
HKLM,Software\Microsoft\Shell\Rai\:QuestionBox, BKBitmapFile,, \Storage\Longhorn\question.gif
HKLM,Software\Microsoft\Shell\Rai\:VolDlg, BKBitmapFile,, \Storage\Longhorn\volume.gif
HKLM,Software\Microsoft\Shell\Rai\:MSCPROG, BannerImage,, \Storage\Longhorn\incall.gif
HKLM,Software\Microsoft\Shell\Rai\:MSCPROG, BKBitmapFile,, \Storage\Longhorn\startmenu.gif
HKLM,Software\Microsoft\Shell\Rai\:MSCdial, BannerImage,, \Storage\Longhorn\dial.gif
HKLM,Software\Microsoft\Shell\Rai\:MSCdial, BKBitmapFile,, \Storage\Longhorn\startmenu.gif
HKLM,Software\Microsoft\Shell\Rai\:MSClog, BKBitmapFile,, \Storage\Longhorn\startmenu.gif
HKLM,Software\Microsoft\Shell\Rai\:MSStart, BKBitmapFile,, \Storage\Longhorn\startmenu.gif
HKLM,Software\Microsoft\Shell\Rai\:MSCONTACTS, BKBitmapFile,, \Storage\Longhorn\contacts.gif
HKLM,Software\Microsoft\Shell\Rai\:MSSYNCAPP, BKBitmapFile,, \Storage\Longhorn\async.gif
HKCU,ControlPanel\Home, BgImage,, ""
HKCU,ControlPanel\Home, ColorScheme,, ""
HKCU,ControlPanel\Home, Scheme,, \Storage\Application Data\Home\LH2.home.xml
HKCU,ControlPanel\Sounds\SystemStart, Sound,, \Storage\Application Data\Sounds\start.wav
HKCU,ControlPanel\Sounds\SystemStart, Script,, ap
HKCU,ControlPanel\Sounds\MenuCommand, Script,, av0p
HKCU,ControlPanel\Sounds\MenuPopup, Script,, av0p
HKCU,ControlPanel\Sounds\Ringtone0, Script,, av0pr
HKCU,ControlPanel\Sounds\Ringtone0, Sound,, \Storage\Application Data\Sounds\GiveMeAReason.wav
HKCU,ControlPanel\Sounds\E-mail, Script,, av0p
HKCU,ControlPanel\Sounds\E-mail, Sound,, \Storage\Application Data\Sounds\gotmail10.wav
HKCU,ControlPanel\Sounds\SMS, Script,, av0p
HKCU,ControlPanel\Sounds\SMS, Sound,, \Storage\Application Data\Sounds\gotmail10.wav
HKCU,ControlPanel\Sounds\VoiceMail, Script,, av0p
HKCU,ControlPanel\Sounds\VoiceMail, Sound,, \Storage\Application Data\Sounds\gotmail10.wav
HKCU,ControlPanel\Sounds\SystemQuestion, Script,, av0p
HKCU,ControlPanel\Sounds\SystemQuestion, Sound,, \Storage\Application Data\Sounds\confirm.wav
HKCU,ControlPanel\Sounds\SystemHand, Script,, av0p
HKCU,ControlPanel\Sounds\SystemHand, Sound,, \Storage\Application Data\Sounds\BreakYourself.wav
HKCU,ControlPanel\Sounds\SystemExclamation, Script,, av0p
HKCU,ControlPanel\Sounds\SystemExclamation, Sound,, \Storage\Application Data\Sounds\BreakYourself.wav
HKCU,ControlPanel\Sounds\SystemAsterisk, Script,, av0p
HKCU,ControlPanel\Sounds\SystemAsterisk, Sound,, \Storage\Application Data\Sounds\kick_a.wav
HKCU,ControlPanel\Sounds\SystemDefault, Script,, av0p
HKCU,ControlPanel\Sounds\SystemDefault, Sound,, \Storage\Application Data\Sounds\kick_a.wav
HKCU,ControlPanel\Sounds\Warning, Sound,, \Storage\Application Data\Sounds\BreakYourself.wav
HKCU,ControlPanel\Sounds\Reminder, Script,, av0pr
HKCU,ControlPanel\Sounds\Reminder, Sound,, \Storage\Application Data\Sounds\alarm.wav
HKCU,ControlPanel\Sounds\Clock, Script,, av0pr
HKCU,ControlPanel\Sounds\Clock, Sound,, \Storage\Application Data\Sounds\alarm.wav
HKLM,SOFTWARE\Microsoft\RIL\OperatorNames, 23410,, Longhorn
HKLM,SOFTWARE\Microsoft\RIL\OperatorNames, 23433,, Longhorn
HKLM,Ident, Name,, Longhorn
HKCR,exefile,editflags,0x00010001,65536
HKLM,SOFTWARE\Microsoft\FontPath, FontPath,, \Storage\Windows\Fonts

Popular Reg Tweaks - SPV-Developers Forums

Posted by krsuncom
개발이야기2007. 8. 29. 13:45

 

Virtual-Key Codes

Send Feedback

The following table shows the symbolic constant names, hexadecimal values, and keyboard equivalents for the virtual-key codes used by the Microsoft Windows CE operating system. The codes are listed in numeric order. You can combine any of the codes with a modifier key to create a hot key.

Virtual key codes

Symbolic constant
Hexadecimal value
Mouse or keyboard equivalent

VK_LBUTTON
01
Left mouse button

VK_RBUTTON
02
Right mouse button

VK_CANCEL
03
Control-break processing

VK_MBUTTON
04
Middle mouse button on a three-button mouse

0507
Undefined

VK_BACK
08
BACKSPACE key

VK_TAB
09
TAB key

0A0B
Undefined

VK_CLEAR
0C
CLEAR key

VK_RETURN
0D
ENTER key

0E0F
Undefined

VK_SHIFT
10
SHIFT key

VK_CONTROL
11
CTRL key

VK_MENU
12
ALT key

VK_PAUSE
13
PAUSE key

VK_CAPITAL
14
CAPS LOCK key

1519
Reserved for Kanji systems

1A
Undefined

VK_ESCAPE
1B
ESC key

1C1F
Reserved for Kanji systems

VK_SPACE
20
SPACEBAR

VK_PRIOR
21
PAGE UP key

VK_NEXT
22
PAGE DOWN key

VK_END
23
END key

VK_HOME
24
HOME key

VK_LEFT
25
LEFT ARROW key

VK_UP
26
UP ARROW key

VK_RIGHT
27
RIGHT ARROW key

VK_DOWN
28
DOWN ARROW key

VK_SELECT
29
SELECT key

2A
Specific to original equipment manufacturer

VK_EXECUTE
2B
EXECUTE key

VK_SNAPSHOT
2C
PRINT SCREEN key

VK_INSERT
2D
INS key

VK_DELETE
2E
DEL key

VK_HELP
2F
HELP key

3A40
Undefined

VK_LWIN
5B
Left Windows key on a Microsoft Natural Keyboard

VK_RWIN
5C
Right Windows key on a Microsoft Natural Keyboard

VK_APPS
5D
Applications key on a Microsoft Natural Keyboard

5E5F
Undefined

VK_NUMPAD0
60
Numeric keypad 0 key

VK_NUMPAD1
61
Numeric keypad 1 key

VK_NUMPAD2
62
Numeric keypad 2 key

VK_NUMPAD3
63
Numeric keypad 3 key

VK_NUMPAD4
64
Numeric keypad 4 key

VK_NUMPAD5
65
Numeric keypad 5 key

VK_NUMPAD6
66
Numeric keypad 6 key

VK_NUMPAD7
67
Numeric keypad 7 key

VK_NUMPAD8
68
Numeric keypad 8 key

VK_NUMPAD9
69
Numeric keypad 9 key

VK_MULTIPLY
6A
Multiply key

VK_ADD
6B
Add key

VK_SEPARATOR
6C
Separator key

VK_SUBTRACT
6D
Subtract key

VK_DECIMAL
6E
Decimal key

VK_DIVIDE
6F
Divide key

VK_F1
70
F1 key

VK_F2
71
F2 key

VK_F3
72
F3 key

VK_F4
73
F4 key

VK_F5
74
F5 key

VK_F6
75
F6 key

VK_F7
76
F7 key

VK_F8
77
F8 key

VK_F9
78
F9 key

VK_F10
79
F10 key

VK_F11
7A
F11 key

VK_F12
7B
F12 key

VK_F13
7C
F13 key

VK_F14
7D
F14 key

VK_F15
7E
F15 key

VK_F16
7F
F16 key

VK_F17
80H
F17 key

VK_F18
81H
F18 key

VK_F19
82H
F19 key

VK_F20
83H
F20 key

VK_F21
84H
F21 key

VK_F22
85H
F22 key

(PPC only) Key used to lock device.

VK_F23
86H
F23 key

VK_F24
87H
F24 key

888F
Unassigned

VK_NUMLOCK
90
NUM LOCK key

VK_SCROLL
91
SCROLL LOCK key

VK_LSHIFT
0xA0
Left SHIFT

VK_RSHIFT
0xA1
Right SHIFT

VK_LCONTROL
0xA2
Left CTRL

VK_RCONTROL
0xA3
Right CTRL

VK_LMENU
0xA4
Left ALT

VK_RMENU
0xA5
Right ALT

BA-C0
Specific to original equipment manufacturer; reserved. See following tables.

C1-DA
Unassigned

DB-E2
Specific to original equipment manufacturer; reserved. See following tables.

E3 – E4
Specific to original equipment manufacturer

E5
Unassigned

E6
Specific to original equipment manufacturer

VK_PACKET
E7
Used to pass Unicode characters as if they were keystrokes. If VK_PACKET is used with SendInput, then the Unicode character to be delivered should be placed into the lower 16 bits of the scan code. If a keyboard message is removed from the message queue and the virtual key is VK_PACKET, then the Unicode character will be the upper 16 bits of the lparam.

E8
Unassigned

E9-F5
Specific to original equipment manufacturer

VK_ATTN
F6
ATTN key

VK_CRSEL
F7
CRSEL key

VK_EXSEL
F8
EXSEL key

VK_EREOF
F9
Erase EOF key

VK_PLAY
FA
PLAY key

VK_ZOOM
FB
ZOOM key

VK_NONAME
FC
Reserved for future use

VK_PA1
FD
PA1 key

VK_OEM_CLEAR
FE
CLEAR key

VK_KEYLOCK
F22
Key used to lock device

Original equipment manufacturers should make special note of the VK key ranges reserved for specific original equipment manufacturer use: 2A, DBE4, E6, and E9F5.

In addition to the VK key assignments in the previous table, Microsoft has assigned the following specific original equipment manufacturer VK keys.

Symbolic constant
Hexadecimal value
Mouse or keyboard equivalent

VK_OEM_SCROLL
0x91
None

VK_OEM_1
0xBA
";:" for US

VK_OEM_PLUS
0xBB
"+" any country/region

VK_OEM_COMMA
0xBC
"," any country/region

VK_OEM_MINUS
0xBD
"-" any country/region

VK_OEM_PERIOD
0xBE
"." any country/region

VK_OEM_2
0xBF
"/?" for US

VK_OEM_3
0xC0
"`~" for US

VK_OEM_4
0xDB
"[{" for US

VK_OEM_5
0xDC
"\|" for US

VK_OEM_6
0xDD
"]}" for US

VK_OEM_7
0xDE
"'"" for US

VK_OEM_8
0xDF
None

VK_OEM_AX
0xE1
AX key on Japanese AX keyboard

VK_OEM_102
0xE2
"<>" or "\|" on RT 102-key keyboard

For East Asian Input Method Editors (IMEs) the following additional virtual keyboard definitions must be observed.

Symbolic constant
Hexadecimal value
Description

VK_DBE_ALPHANUMERIC
0x0f0
Changes the mode to alphanumeric.

VK_DBE_KATAKANA
0x0f1
Changes the mode to Katakana.

VK_DBE_HIRAGANA
0x0f2
Changes the mode to Hiragana.

VK_DBE_SBCSCHAR
0x0f3
Changes the mode to single-byte characters.

VK_DBE_DBCSCHAR
0x0f4
Changes the mode to double-byte characters.

VK_DBE_ROMAN
0x0f5
Changes the mode to Roman characters.

VK_DBE_NOROMAN
0x0f6
Changes the mode to non-Roman characters.

VK_DBE_ENTERWORDREGISTERMODE
0x0f7
Activates the word registration dialog box.

VK_DBE_ENTERIMECONFIGMODE
0x0f8
Activates a dialog box for setting up an IME environment.

VK_DBE_FLUSHSTRING
0x0f9
Deletes the undetermined string without determining it.

VK_DBE_CODEINPUT
0x0fa
Changes the mode to code input.

VK_DBE_NOCODEINPUT
0x0fb
Changes the mode to no-code input.

Original equipment manufacturers should not use the unassigned portions of the VK mapping tables. Microsoft will assign these values in the future. If manufacturers require additional VK mappings, they should reuse some of the current manufacturer-specific and vendor-specific assignments.

See Also

Using Virtual-Key Codes | Manufacturer-specific Virtual-Key Codes

Virtual-Key Codes

Posted by krsuncom
개발이야기2007. 8. 18. 09:51

원문:Download details: Windows Mobile Developer Power Toys

 

Windows Mobile Developer Power Toys

Brief Description

Developer Power Toys for the Windows Mobile platform

On This Page

Quick Details

Overview

System Requirements

Instructions

Related Resources

What Others Are Downloading

Download files below

Quick Details

Version:
12Dec2006

Date Published:
9/18/2003

Language:
English

Download Size:
1.2 MB - 19.7 MB*

*Download size depends on selected download components.

Overview

The Windows Mobile Developer Power Toys help you develop and test your Windows Mobile applications. N.B. These Power Toys are NOT supported..
The Power Toys include:

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

Top of page

System Requirements
  • Supported Operating Systems: Windows 2000 Service Pack 3; Windows Server 2003; Windows XP
  • Windows Mobile 2003 based Pocket PCs
  • Windows Mobile 2003 based Smartphones
  • Windows Mobile 2002 based Pocket PCs
  • Windows Mobile 2002 based Smartphones

Not all tools are supported on all listed platforms.

Top of page

Instructions

There are two packages to download. The Emulator Activesync Connection Tool comes as one package. The remaining tools come in a second package.
Emulator Activesync Connection Tool

  1. Start Visual Studio .NET 2003.
  2. Click "Connect Emulator with ActiveSync" on the Tools menu.
  3. From the "Connect Emulator with ActiveSync" dialog, select an Emulator image from
    the dropdown list.
  4. Ensure the selected emulator is not running yet.
  5. Click the Connect button. The emulator will be started and an ActiveSync
    connection will be established with it.
  6. Once the connection is ready, it is OK to close the tool by clicking Exit
    from the menu.

Remaining Power Toys
All the other Power Toys are installed by the second installation package. A shortcut called Windows Mobile Developer Power Toys is created on the Start Menu which will allow you to access the Power Toys. The readme file for each toy explains how the Power Toy is used.

Top of page

Download details: Windows Mobile Developer Power Toys

Posted by krsuncom
개발이야기2007. 8. 14. 11:02

 

How to develop and test device drivers in Windows CE 5.0

by Mike Hall (Oct. 25, 2005)
Foreword: This article by Mike Hall, a technical product manager on Microsoft's Windows CE team, provides an introduction to developing and testing a Windows CE 5.0 device driver. It provides step-by-step instructions for creating a stream driver, creating a custom Windows CE Test Kit (CETK) test, and writing an application to test the driver. It will take approximately 60 minutes to complete.
Note: before beginning, download Windows CE 5.0 Embedded Development Labs.msi from the Microsoft Download Center.


Part 1: Setting Up a Device Driver



In this exercise, you will use Platform Builder to add a project that will act as a device driver.
Before you begin the process of writing drivers, you should understand the purpose of a device driver. Drivers abstract the underlying hardware from the operating system, and better still from an application developer. An application developer shouldn't need to know the specifics of your display hardware or your serial hardware -- for example, whether a serial device is implemented in a Universal Asynchronous Receiver/Transmitter (UART) or a field-programmable gate array (FPGA). For the most part, it makes no sense for an application developer to need to know how the hardware is implemented.

Microsoft Windows exposes application programming interfaces (APIs) for a developer to call into the hardware without needing to know what the physical hardware is. For example, to write to a serial port, an application developer simply calls CreateFile( ) on COMx (where x donates the serial port number you want to open, for example COM1 for serial port 1), calls WriteFile( ) to write some bytes of data to the serial port, and then calls CloseHandle( ) to close the serial port. The same sequence of APIs works no matter what the underlying serial hardware is (or which Windows operating system you are running).
The same is also true of other APIs: If you want to write to a line to the display surface, you would simply call PolyLine( ), MoveToEx( ), or LineTo( ). As an application developer, for the most part, you don't need to know what the display hardware is. There are APIs to call that will return the dimensions of the display surface, the color depth, and so on.
The good news is that developers have a consistent, well-known set of APIs to call. These APIs abstract their application from the underlying hardware. This is crucial because an application developer has no way of knowing whether the application will run on a laptop, Tablet PC, or desktop computer. Whether the computer is running at 1024x768 or 1600x1200, the application developer can query the screen resolution and color depth at run time and therefore doesn't need to build the application to run only on specific hardware.
A driver is simply a dynamic-link library (DLL). DLLs are loaded into a parent process address space; the parent process can then call any of the interfaces exposed from the DLL. The driver is typically loaded by its parent process through a call to LoadLibrary( ) or LoadDriver( ). LoadDriver not only loads the DLL into the parent process address space, but also makes sure the DLL isn't paged out.
How does a calling process know which APIs or functions are exposed from your DLL or driver? The parent process calls GetProcAddress( ), which takes the name of a function and the hInstance of the loaded DLL. The call returns a pointer to the function, if it exists, or NULL if the function is not exposed from the DLL.
Stream drivers expose a well-known set of functions. For a stream driver, you want to be able to write a stream of bytes to the device, or read a stream of bytes from the device. Therefore, in the serial port example used earlier, you would expect the following set of functions to be exposed from your driver: Open, Close, Read, and Write. Stream drivers expose some additional functions: PowerUp, PowerDown, IOControl, Init, and DeInit.
You can use an existing operating system image for the emulator platform (the Basic Lab MyPlatform platform is ideal). You can then add your DLL/driver project to the platform.
After the platform is built and downloaded (this shows that the operating system starts and runs well), you need to create your skeleton driver. You can use Platform Builder New Project or File command on the File menu to create a Microsoft Windows CE DLL. There is no difference between creating a DLL to expose functions or resources and creating a DLL to be used as a driver; the only difference is which functions the DLL exposes, and how the DLL is registered or used on the platform.
As an aside, one way to create internationalized applications is to create a base application that contains one set of core language strings, dialog boxes, and resources, and then create a number of external DLLs, each of which contains the dialog boxes, strings, and resources for a specific locale. The application can then load the appropriate language resources on the fly. You can add languages to the application by simply adding DLL files. This and other interesting topics are described in the book Developing International Software available on the Microsoft Press Web site.
To add a project that will act as the device driver

  1. Use Platform Builder to open the existing MyPlatform workspace.
  2. On the File menu, click New Project or File.
  3. Select WCE Dynamic-Link Library, give it an appropriate name (for example, StreamDrv), and then click OK, as shown in the following illustration.

  4. On the page shown in the following illustration, fill in as much or as little information as you want, and then click Next.

  5. Click A simple Windows CE DLL project, as shown in the following illustration.

  6. Click Finish to complete the wizard.
    At this point, the DLL contains only an empty DllMain function. You can expose functions to be called by an application, expose resources (perhaps to make this part of a language/culture-aware application), or make this into a device driver. In this article, you'll use the Windows CE Stream Driver Wizard to create your skeleton stream driver.
    In Windows CE, stream drivers are opened just like files, and are opened by means of a unique three-letter prefix (for example, COM).
  7. Choose a unique three-letter identifier for your driver. In the Location box, type the full path for the stream driver that you created previously. Or, use the browse button to browse to the PBWorkspaces directory in your Platform Builder installation, find the platform that you created previously, and then find the name of the stream driver (in the earlier example, this was PBWorkspaces\TuxPlat\StreamDrv).
  8. In the Driver Filename box, type a name for the driver. As shown in the following illustration, use the same name that you used earlier (StreamDrv) to ensure that the original file created in Platform Builder is overwritten.

  9. Press Go, and the stream driver source will be generated.

Part 2: Testing the Stream Driver Test Code



You have now written the basic code for a custom stream driver for Windows CE. At the moment, the driver isn't connected to any hardware.
After the driver is written, you need to provide a way for developers to test it. Windows CE ships with a Windows CE Test Kit (CETK), which provides driver tests for a range of driver types, including networking, Bluetooth, serial, and display. The driver that you wrote is a custom stream driver that doesn't expose the same functionality as existing driver tests, so you need to write a custom test for the driver. Although you could just write an application to exercise the driver, it's perhaps better to provide a CETK module that can be used during development and shipped to customers to test the driver on shipping hardware.
In this part of the exercise, you will perform the following procedures:
  • Create a skeleton Tux module
  • Add test code for a custom driver to the Tux DLL
  • Rebuild an operating system
  • Set a breakpoint
To create a skeleton Tux module
  1. In Platform Builder, on the File menu, click New Project or File.
  2. Select WCE TUX Dynamic-Link Library, type TuxTest as the project name, enter a location, click Workspace Project, and then click OK, as shown in the following illustration. (In practice, you can choose either project type; for this article, click Workspace Project).

  3. On the page shown in the following illustration, fill in as much or as little information as you want, and then click Next.

  4. Read the information on the screen shown in the following illustration, and then click Next.

  5. On the final page, you can optionally select CETK under Release Type, as shown in the following illustration. This option turns off optimizations for retail binaries to increase debugging productivity. Click Finish.

  6. Click View | File View, and then expand the Projects tree to show the tux source, as shown in the following illustration.

    The important files to note in the preceding illustration are:

    • ft.h -- This file contains the function table used by the tux DLL.
    • test.cpp -- This file contains the test procedures called from the function table.
    • TuxStreamTest.cpp -- This file contains DLLMain and ShellProc, the latter of which is called from Tux.exe.

To add the custom driver test code to the Tux DLL
  1. Open the source Test.cpp.
  2. Use CodeClip to get the Tux_Custom_Test | TuxCode source.
  3. Replace the contents of the function TestProc with the code from CodeClip.
    You will notice that the code in Test.cpp loads a driver called Demo.dll. For this article, you created a driver called StreamDrv. You will need to modify the source to load your StreamDrv.dll driver.
  4. Locate the source in Test.cpp that calls LoadLibrary, and then modify the name of the driver being loaded from Demo.dll to StreamDrv.dll.
  5. In the Platform Builder File View, right-click the TuxTest project, and then click Build Current Project.
    You also need to add the Windows CE Test Kit component from the catalog.
  6. Under Device Drivers, locate the Windows CE Test Kit component in the catalog, and then select Add the Windows CE Test Kit to add the component to your platform.
Note Adding the component to your platform doesn't add any files to the final operating system image; it adds the Clientside files to the build release folder. From Platform Builder, you can download the Clientside application and run the application on your target device.
To rebuild your operating system
  • In Platform Builder, select Build OS | Sysgen.
    The build process will take approximately five minutes to complete.
It would be useful to set a breakpoint in the entry point of the stream driver to see when the driver is loaded.
To set a breakpoint
  1. Click File View, open the StreamDrv project, and then open Source files.
  2. Locate and open StreamDrv.cpp.
  3. Locate DllMain, and then locate and click the switch statement.
  4. Set a breakpoint by pressing F9.
  5. Download the operating system to the emulation environment by clicking Target | Attach.
    You will see the following debug output, and the breakpoint will fire. Note that this happens long before the user interface (UI) of the operating system has loaded.
    4294780036 PID:23f767b6 TID:23f767e6 0x83fa6800: >>> 
    Loading module streamdrv.dll at address 0x01ED0000-0x01ED5000
    Loaded symbols for
    'C:\WINCE500\PBWORKSPACES\DRVDEMO\RELDIR\EMULATOR_X86_DEBUG\
    STREAMDRV.DLL'
  6. Disable the breakpoint by clicking the switch statement, and then pressing F9.
  7. Allow the operating system to continue loading by pressing F5.
You've now built a Windows CE 5.0 operating system that contains a custom stream driver, and you've seen the driver load during the boot sequence of the operating system.

Part 3: Examining the Driver



In this exercise, you will perform the following procedures:
  • Use a command-line tool to look at the exposed functions from the driver
  • Use the Remote System Information tool to examine the driver
  • Determine that the driver is loaded
The first way to examine the device driver that you created is to look at the exposed functions from the driver. There is a command-line tool that ships with Windows CE called Dumpbin, which you can use to examine the imports to an application or module, or to examine the exports from a DLL (or driver).
To use the command-line tool to look at the exposed functions from the driver
  1. In Platform Builder, click Build OS | Open Release Directory. This action opens a Command Prompt window in the build release folder for your current workspace.
  2. Type dumpbin 뻛xports StreamDrv.dll
    The following illustration shows how the output looks. You can see that all of the expected stream driver functions are exposed from the driver; functions are exposed from a DLL through the project's .def file.

  3. Close the Command Prompt window by typing Exit
    The contents of the StreamDrv.def file are as follows.
    LIBRARY DemoDriver
    EXPORTS
    DEM_Init
    DEM_Deinit
    DEM_Open
    DEM_Close
    DEM_IOControl
    DEM_PowerUp
    DEM_PowerDown
    DEM_Read
    DEM_Write
    DEM_Seek
    CustomFunction
    CustomFunctionEx
The second way that you can examine the driver is through the Remote System Information tool.
To examine the driver through the Remote System Information tool
  1. In Platform Builder, click Tools | Remote System Information.
  2. Select Windows CE Default Platform | Default Device, and then click OK, as shown in the following illustration.

    This procedure connects the Remote System Information application to the current active platform being used by Platform Builder. The following illustration shows the result.

You can also use the list of loaded modules to determine that your driver is loaded.
To determine that the driver is loaded

  • In Platform Builder, use the Target Control window (gi mod), or View | Debug Windows | Modules and Symbols.
    The following illustration shows the result of this procedure.


Part 4: Using the Windows CE Test Kit



The Windows CE Test Kit contains a device-side component and a desktop component. The device side component is called Clientside.exe, which you added to your workspace by adding the CETK component from the catalog. Note that adding the Clientside.exe application to the workspace doesn't add any files to the final operating system image, but it does copy the application to the build release folder.
Before running the CETK on the desktop computer, you need to start the Clientside.exe application on the device. The reason the tools are not linked (like a remote tool) is that the CETK will also operate on shipping (retail) devices, such as the Pocket PC.
In this part of the exercise, you will perform the following procedures:
  • Examine the Windows CE Test Kit user interface
  • Run one of the standard tests
To examine the Windows CE Test Kit user interface
  1. In Platform Builder, on the Tools menu, click Windows CE Test Kit.
    This step starts the Windows CE Test Kit application, as shown in the following illustration. Note that this is not a standard remote tool. Most of the remote tools that ship with Windows CE use the Kernel Independent Transport Layer (KITL), a transport that abstracts the tools from the underlying communication hardware so that the tools will run over Ethernet, serial, 1394, USB, or other transports.
    The Windows CE Test Kit typically connects over sockets, although for Windows CE 5.0, the tools have been updated to also support KITL.

  2. In the Windows CE Test Kit, click Connection | Start Client.
    This step displays the Device Connection dialog box, where you can choose whether to connect over sockets or KITL.
  3. Make sure that the Use Windows Sockets for the client/server communication check box is cleared, as shown in the following illustration.

  4. Click Connect.
    In the standard user interface for remote tools (KITL), select Windows CE Default Platform | Default Device, and then click OK, as shown in the following illustration.

    This procedure starts Clientside.exe on the target device and makes a connection to the target. After the connection is made, the CETK enumerates the supported devices on the target platform, and nonsupported devices are disabled in the CETK.
    After the CETK has connected to the target and enumerated devices, the UI looks similar to the following illustration. Notice that certain hardware categories, such as Bluetooth, IR Port, and Modem, are disabled.

Before adding a custom test to the CETK, you can run one of the standard tests to see how the test behaves.
To run a standard test

  1. In the CETK, expand Windows CE (x86).
  2. Locate and expand Serial Port.
  3. Right-click Serial Port Driver Test, and then click Quick Start.
This step runs just this one test without also running the other selected tests. The UI indicates that the test is in progress, as shown in the following illustration.

The CETK provides updates on the progress of the test and the outcome of the test. You can also examine the debug output in Platform Builder to see the progress of the test, as shown in the following example.

405910 PID:83d4ee4a TID:83ea5a8a *** Test Name:      
Set event mask and wait for thread to close comm port handle
405920 PID:83d4ee4a TID:83ea5a8a *** Test ID: 1007
405920 PID:83d4ee4a TID:83ea5a8a *** Library Path: \serdrvbvt.dll
405920 PID:83d4ee4a TID:83ea5a8a *** Command Line:
405920 PID:83d4ee4a TID:83ea5a8a *** Result: Passed
405920 PID:83d4ee4a TID:83ea5a8a *** Random Seed: 15595
405930 PID:83d4ee4a TID:83ea5a8a *** Thread Count: 1
405930 PID:83d4ee4a TID:83ea5a8a *** Execution Time: 0:00:05.110
405930 PID:83d4ee4a TID:83ea5a8a ***
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If the CETK UI indicates that the serial port test has failed on the emulator (as shown in the following illustration), the failure may not be due to a complete failure of every test. It may indicate that only a portion of the overall test suite has failed, which may actually be expected behavior.

  1. Right-click Serial Port Driver Test [Failed], and then click View Results.
    A window like that shown in the following illustration appears.

    Looking at the results shown in the preceding illustration, you can see that 10 individual tests have been run. All of these tests have passed except for Set and verify receive timeout.
    To get more information, you can click the individual test.


Part 5: Creating a Custom CETK Test



By using the Platform Builder User-Defined Test Wizard, you can create a custom CETK test. This test will verify the exported functions from a custom stream driver (which you've also added to the platform).
In this part of the exercise, you will perform the following procedures:
  • List the custom stream driver test in the CETK
  • Run the custom stream driver test
To list the custom stream driver test in the CETK
  1. In the CETK, click Tests | User Defined.
    This step starts the User-Defined Test Wizard. The first page of the wizard is for information only.
  2. Click Next, as shown in the following illustration.

  3. Click Add a New Test, and then click Next, as shown in the following illustration.

  4. Enter the following information, and then click Next:
    • In the Name of Test box, type Custom Stream Driver Test
    • In the Tux Module (DLL) box, browse to
      C:\Wince500\PBWorkspaces\MyPlatform\RelDir\Emulator_x86_Debug,
      and then select either test.dll or TuxTest.dll (this depends on the name of the Tux test you used in Platform Builder).
    • In the Command Line box, leave the default setting for the current test.
    • In the Processor box, type x86
    The following illustration shows how the information appears on the current wizard page.

  5. Click Copy the files to the directory for user-defined tests, and then click Next, as shown in the following illustration.
You want to copy the custom driver test (your DLL) to the folder for user-defined tests. If you were to delete your existing workspace, the custom driver test would still be intact.

  1. Click Next, as shown in the following illustration.

  2. Click Finish, as shown in the following illustration.
    The CETK application doesn't automatically refresh with the new tests. You need to resynchronize the desktop application to view the newly added test.

  3. Right-click Windows CE (x86), and then click Redetect Peripherals.
    This procedure adds a new driver category called User Tests. You've added only one test, so when you expand this item, you will see only Custom Stream Driver Test.
    Note The DLL for the custom stream driver test has been copied to the following location: C:\Program Files\Windows CE Platform Builder\5.00\CEPB\wcetk\user\x86.
To run the custom stream driver test
  1. In the list of available tests, expand User Tests.
  2. Right-click Custom Stream Driver Test, and then click Quick Start.
    Make a note of the following debug information being displayed in Platform Builder.
    1162630 PID:3c92032 TID:3efe3ea *** TEST STARTING
    1162630 PID:3c92032 TID:3efe3ea ***
    1162630 PID:3c92032 TID:3efe3ea *** Test Name: Sample test
    1162630 PID:3c92032 TID:3efe3ea *** Test ID: 1
    1162640 PID:3c92032 TID:3efe3ea *** Library Path: \test.dll
    1162650 PID:3c92032 TID:3efe3ea *** Command Line:
    1162650 PID:3c92032 TID:3efe3ea *** Random Seed: 26648
    1162650 PID:3c92032 TID:3efe3ea *** Thread Count: 0
    1162650 PID:3c92032 TID:3efe3ea ***
    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    1162660 PID:3c92032 TID:3efe3ea test:
    ShellProc(SPM_BEGIN_TEST, ...) called
    1162660 PID:3c92032 TID:3efe3ea BEGIN TEST:
    "Sample test", Threads=0, Seed=26648
    1162690 PID:3c92032 TID:3efe3ea
    Custom Stream Driver Test Starting
    1162690 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Loading Demo.DLL
    1162710 PID:3c92032 TID:3efe3ea 0x83d3dc28: >>>
    Loading module streamdrv.dll at address 0x01ED0000-0x01ED5000
    1162720 PID:3c92032 TID:3efe3ea StreamDrv - DLL_PROCESS_ATTACH
    1162720 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Loaded Demo.DLL OK
    1162740 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking Interfaces...
    1162740 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_Open
    1162740 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_Open OK
    1162740 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_Close
    1162750 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_Close OK
    1162750 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_Read
    1162750 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_Read OK
    1162770 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_Write
    1162790 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_Write OK
    1162790 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_Init
    1162790 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_Init OK
    1162790 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_Deinit
    1162800 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_Deinit OK
    1162800 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_PowerUp
    1162800 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_PowerUp OK
    1162800 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_PowerDown
    1162810 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_PowerDown OK
    1162810 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_IOControl
    1162810 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_IOControl OK
    1162810 PID:3c92032 TID:3efe3ea
    Custom Driver Test - Checking DEM_Seek
    1162820 PID:3c92032 TID:3efe3ea
    Custom Driver Test - DEM_Seek OK
    1162830 PID:3c92032 TID:3efe3ea StreamDrv - DLL_PROCESS_DETACH
    1162840 PID:3c92032 TID:3efe3ea 0x83d3dc28:
    <<< Unloading module streamdrv.dll at address 0x01ED0000-0x01ED5000
    1162870 PID:3c92032 TID:3efe3ea test:
    ShellProc(SPM_END_TEST, ...) called
    1162870 PID:3c92032 TID:3efe3ea END TEST:
    "Sample test", PASSED, Time=0.180
    1162870 PID:3c92032 TID:3efe3ea ***
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    1162870 PID:3c92032 TID:3efe3ea *** TEST COMPLETED
    1162880 PID:3c92032 TID:3efe3ea ***
    1162880 PID:3c92032 TID:3efe3ea *** Test Name: Sample test
    1162880 PID:3c92032 TID:3efe3ea *** Test ID: 1
    1162890 PID:3c92032 TID:3efe3ea *** Library Path: \test.dll
    1162890 PID:3c92032 TID:3efe3ea *** Command Line:
    1162890 PID:3c92032 TID:3efe3ea *** Result: Passed
    1162900 PID:3c92032 TID:3efe3ea *** Random Seed: 26648
    1162910 PID:3c92032 TID:3efe3ea *** Thread Count: 1
    1162910 PID:3c92032 TID:3efe3ea *** Execution Time: 0:00:00.180
    The test completed without any warnings or errors. You can also examine the test results in the client.

Part 6: Determining Who Owns the Stream Driver



So far, you've seen the custom stream driver load through Platform Builder debug messages, through a breakpoint in the driver source, and through a custom CETK test.
In this part of the exercise, you will perform the following procedures:
  • Use the Remote Process Viewer to determine which process is loading the driver
  • Display information
To use the Remote Process Viewer to determine which process is loading the driver
  1. In Platform Builder, click Tool | Remote Process Viewer.
    The Process Viewer application displays a list of all the currently running processes, in addition to the DLLs or modules loaded into each process address space.
  2. Locate and select device.exe.
The following illustration shows the list of DLLs loaded into the Device.exe process address space. Device.exe is the device driver manager for Windows CE.

To display information
By using Platform Builder, write a Microsoft Win32 application that writes data to the custom stream driver and reads back and displays the information. You can use the MessageBox API to do this.
The APIs that you need for this task are:

  • CreateFile
  • WriteFile
  • ReadFile
  • CloseHandle
  • MessageBox

Summary


  • Drivers are simply DLLs.
  • Drivers are mapped into the Device.exe process address space.
  • Drivers expose a known set of interfaces.
  • It's relatively easy to add a device driver to a Windows CE operating system image.
  • The Windows CE Test Kit is available to assist with the development and debugging of a platform.
  • Writing custom CETK tests is fairly easy.


Copyright ?2005 Microsoft Corp. All rights reserved. This article was initially published on Microsoft's MSDN website. Reproduced by WindowsForDevices.com with permission.

Related stories:

How to develop and test device drivers in Windows CE 5.0

Posted by krsuncom
개발이야기2007. 8. 13. 21:00

 

Other Registry Tweaks

These registry tweaks either need categorizing, or do not fit any of the existing categories.


For further tweaks, see: WM5 Tweaks - Performance and http://www.pocketpctweaks.com/


Note to editors:

When editing, please make sure to disable the "[ ] Use Old Markup" option for display formatting reasons.


EXAMPLE - TRY NOT TO EDIT/DELETE

Tweak to do something

To do this and that, adjust the following registry value:

HKLM\Software\Microsoft\Something\SomeValue = 1 (DWORD decimal)

To do something different entirely, perhaps the opposite, do this:

HKLM\Software\Microsoft\Something\SomeValue = 0 (DWORD decimal)

This is an additional note


UI Modifications

Change the thickness of scrollbars

To change the thickness of the scrollbars at the right/bottom of documents larger than the screen, adjust...
For the horizontal (bottom) scrollbar:

HKLM\System\GWE\cyHScr = 9 (DWORD decimal)

For the vertical (right) scrollbar:

HKLM\System\GWE\cxVScr = 9 (DWORD decimal)

The default thickness is 13. You can set the value to pretty much anything you like

Change the length of scrollbar arrow buttons

To go with changing the thickness of the scrollbars, you may wish to change the length of the scrollbar arrow buttons...
For the horizontal (bottom) scrollbar arrows:

HKLM\System\GWE\cyVScr = 9 (DWORD decimal)

For the vertical (right) scrollbar:

HKLM\System\GWE\cxHScr = 9 (DWORD decimal)

The default length is 13. You can set the value to pretty much anything you like

Enable ClearType in Landscape mode

To enable ClearType in Landscape mode:

HKLM\System\GDI\ClearTypeSettings\OffOnRotation = 0 (DWORD decimal)

To disable:

HKLM\System\GDI\ClearTypeSettings\OffOnRotation = 1 (DWORD decimal)

Note that your PocketPC screen's LCD red/green/blue ordering required for proper ClearType display is only correct for Portrait display. You may or may not prefer to leave ClearType in Landscape mode disabled

Change the display of the clock in the taskbar

The clock in the taskbar can be changed to show not only the time, but also the date, or just the date, or nothing at all.
To show nothing:

HKLM\Software\Microsoft\Shell\TBOpt = 0 (DWORD decimal)

To show just the clock:

HKLM\Software\Microsoft\Shell\TBOpt = 1 (DWORD decimal)

To show just the date:

HKLM\Software\Microsoft\Shell\TBOpt = 2 (DWORD decimal)

To show both the date and the clock:

HKLM\Software\Microsoft\Shell\TBOpt = 3 (DWORD decimal)

Note 1: If you switch to the Analog clock display, the date will remain visible -through- the Analog clock
Note 2: Setting the clock to show 'nothing' will still keep the reserved space, showing the taskbar background, and obscure any icons that will shift to the right.
Note 3: Your date may get obscured by the space reserved for the OK/Close button in the top-right. You can fix this my adding spaces at the end of your 'Short Date Format'. See also the tweak on 'Change the Short Date Format'

Show Edge network indicator instead of GPRS

If your network provider supports the Edge network (and your device does as well), you can use the following to show a little 'E' icon instead of 'G' icon when connected to an Edge network:

HKLM\Drivers\BuiltIn\RIL\EnableDifferGprsEdgeIcon = 1 (DWORD decimal)

To disable again:

HKLM\Drivers\BuiltIn\RIL\EnableDifferGprsEdgeIcon = 0 (DWORD decimal)

Note that your device -and- your network operator need to support Edge, otherwise you won't see it. Also note that if you connect to GPRS, you will still see the 'G' icon.

Add GPS settings icon

If you have a GPS device, you can add a GPS settings icon to your Start > Settings menu using:

HKLM\ControlPanel\GPS Settings\Group = 2 (DWORD decimal)
HKLM\ControlPanel\GPS Settings\redirect <-- delete, or rename, this value

Note that '2' stands for the Connections tab, '1' is System and '0' would be Personal
Note also that this has reportedly disabled one person's USB connectivity. To restore, set "GPS Program Port = None", "GPS Connection Port = None", "Automatic GPS Management = on"

Hide/Show Screen orientation icon

If you wish to hide the Screen orientation icon, shown in the task bar on some devices, you can set:

HKLM\Services\?ScreenRotate\ShowIcon = 0 (DWORD decimal)
HKLM\System\GDI\Rotation\HideOrientationUI = 1 (DWORD decimal)

And to show it again:

HKLM\Services\?ScreenRotate\ShowIcon = 1 (DWORD decimal)
HKLM\System\GDI\Rotation\HideOrientationUI = 0 (DWORD decimal)

If this doesn't work, you can try:

HKLM\Services\screenrotate = 0 (DWORD decimal)

And to show it again:

HKLM\Services\screenrotate = 1 (DWORD decimal)

Note that this icon and its feature may not be available on your device at all.

Hide/Show battery indicator in Task bar

If you wish to hide the battery indicator in the task bar on some devices, you can set:

HKLM\Services\Power\ShowIcon = 0 (DWORD decimal)

And to show:

HKLM\Services\Power\ShowIcon = 1 (DWORD decimal)

Note that this icon and its feature may not be available on your device at all. For example, the HTC Wizard regularly ships with a battery indicator in the Tray instead, governed by "Windows\Startup\Init_Tray.exe"._
_Note also that this reportedly does not work on AKU2 ROMs to remove the new battery indicator

Show slide-out keyboard caps/dot icon next to SIP

If your device contains a file called "capnotify.exe", try running it (most devices that have it will already have it in the Windows\StartUp\ folder), and setting the following value to get a visual presentation of whether you are in caps or dot (alternate key function) mode:
HKCU\ControlPanel\Keybd\EnableIndicator = 1
Please note that if your device has no external keyboard with caps/dot mode, you won't gain anything from this tweak
Please also note that the application "?CapNotify.exe" must be running (normally found in \Windows\?StartUp\ already) for this to work

Put custom text on bottom-right of Today screen

You can set some piece of text on the bottom-right of the Today Screen by setting the following key:

HKLM\Software\Microsoft\Shell\DeviceBeta\Today = "Hello World" (REG_SZ string, no quotes)

Please note that this text won't take up Today item text. It will be obscured by Today items.


File Locations

Change the location of My Documents

Documents are opened in and saved to the device's internal storage by default. You can change this location to, for example, your Storage Card:

HKLM\Software\Microsoft\Windows CE Services\FileSyncPath = "\Storage Card\My Documents" (REG_SZ string, no quotes)

To return to the original location:

HKLM\Software\Microsoft\Windows CE Services\FileSyncPath = "\My Documents" (REG_SZ string, no quotes)

Change the location of email and attachments

When reading and sending email in Pocket Outlook, emails and their attachments are saved in the device's internal storage by default. You can change this location to, for example, your Storage Card:

HKCU\Software\Microsoft\MAPI\PropertyPath = "\Storage Card\Mail" (REG_SZ string, no quotes) HKCU\Software\Microsoft\MAPI\AttachPath = "\Storage Card\Mail\Attachments" (REG_SZ string, no quotes)

To return to the original location:

Just simply delete these Registry settings (since neither is included by default).

Change the location of Temporary Internet Files

When browsing the web, pages and images are saved in the 'Temporary Internet Files' location. You can change this location to, for example, your Storage Card:

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cache = "\Storage Card\cacheie" (REG_SZ string, no quotes)

To return to the original location:

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cache = "\Windows\Profiles\guest\Temporary Internet Files" (REG_SZ string, no quotes)

Change the location of Ringtone file storage

WM5 will look for Ringtones in \Windows\ or \Windows\Rings by default. You can change this location to, for example, your Storage Card (example given is for ringtones placed on the Storage Card root folder)
HKCU\ControlPanel\SoundCategories\Ring\Directory = "\Storage Card\" (REG_SZ string, no quotes)

To return to the original location:

HKCU\ControlPanel\SoundCategories\Ring\Directory = "\Windows\Rings\" (REG_SZ string, no quotes)

Note the default location may be "\Windows\" or "\Windows\Rings\" depending on your Device provider.

Make WM5 ask where to install a program (1)

If you wish to be able to specify whether to install a program on WM5's Main storage, or your Storage Card, regardless of installer setting set:

HKLM\Software\apps\Microsoft Application Installer\fAskDest = 1 (DWORD decimal)

To disable again:

HKLM\Software\apps\Microsoft Application Installer\fAskDest = 0 (DWORD decimal)

Please note that many applications do not support being installed on the Storage Card and may behave unpredictably, including crashing.

Make WM5 ask where to install a program (2)

An alternative method of making WM5 ask where to install a program is by adding the "/askdest" option to the Windows CE loader:

HKCR\cabfile\Shell\open\command = 'wceload.exe "%1" /askdest' (REG_SZ string, no quotes)

Make WM5 keep CAB files around after installing (1)

If you wish to keep the original .CAB file around after installing the application, set:

HKLM\Software\apps\Microsoft Application Installer\nDynamicDelete = 0 (DWORD decimal)

Or to restore to the default:

HKLM\Software\apps\Microsoft Application Installer\nDynamicDelete = 2 (DWORD decimal)

Make WM5 keep CAB files around after installing (2)

An alternative method of making WM5 keep the original .CAB file around after installing the application is by adding the "/nodelete" option to the Windows CE loader:

HKCR\cabfile\Shell\open\command = 'wceload.exe "%1" /nodelete' (REG_SZ string, no quotes)

Make WM5 prompt before overwriting an existing installation

If you wish to make WM5 prompt you before overwriting an existing installation, set:

HKLM\Software\apps\Microsoft Application Installer\fAskOptions = 1 (DWORD decimal)

To disable again:

HKLM\Software\apps\Microsoft Application Installer\fAskOptions = 0 (DWORD decimal)


Input (keyboard, soft keys, SIP)

Change slide-out keyboard layout

If you have a Device from one country, but would like to use the keyboard layout of another, you can change the keyboard's language setting to do so...

For US layout (QWERTY):
HKCU\ControlPanel\Keybd\Locale = 0409 (String)
For German layout (QWERTZ):
HKCU\ControlPanel\Keybd\Locale = 0407 (String)
For French layout (AZERTY):
HKCU\ControlPanel\Keybd\Locale = 040c (String)
For Spanish layout (QWERTY):
HKCU\ControlPanel\Keybd\Locale = 040a (String)

For other codes, see: http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx

Change the keyboard backlight duration

To change the duration of the keyboard backlight, you can set (example is 30 seconds):

HKCU\ControlPanel\Backlight\QKeyLedTimeout = 30 (DWORD decimal)

Please note that this may not work on some devices. One such notable exception is the HTC Wizard.

Change the application launched by Today screen Soft Keys

To change the application launched by the Today screen Left soft key:

HKCU\Software\Microsoft\Today\Keys\112\Open = "\Windows\Calendar.exe" (REG_SZ string, including quotes)

To change the title of the Left soft key:

HKCU\Software\Microsoft\Today\Keys\112\(Default) = "Calendar" (REG_SZ string, no quotes)

To change the application launched by the Today screen Right soft key:

HKCU\Software\Microsoft\Today\Keys\113\Open = "\Windows\Start Menu\Programs\Contacts.lnk" (REG_SZ string, including quotes)

To change the title of the Right soft key:

HKCU\Software\Microsoft\Today\Keys\113\(Default) = "Contacts" (REG_SZ string, no quotes)

Note that 113 normally doesn't exist by default, and probably needs to be created
Also note that there is at least 1 application that allows you to set these through a GUI, developed by FdcSoft called SoftKeyAppletEx.

Set default SIP

The default SIP (Secondary Input Panel) on practically every device is the Keyboard. You may prefer entry with a different SIP. If so, you can set this to be the default SIP through:

HKCU\ControlPanel\SIP\DefaultIM = |SIP ClassID|

The |SIP ClassID| will depend on the SIP's ClassID, which may vary per-device. You can find the correct ClassID by searching for "IsSIPInputMethod" in HKCR, then going to the top key and checking the name of the SIP that's in the (Default) value.
Please note that this doesn't work with all SIPs. Transcriber/Calligrapher are two examples of this.
You can, however, set Transcriber as the default SIP by starting Transcriber.exe on startup. (This should be moved to, or added to, non-registry Tweaks page)
WARNING: Do not assume that the below ClassIDs would be -as found- on your device! Setting it to a non-existant SIP may prevent your device from booting up!
WARNING: If you set an invalid value in DefaultIM (or apparently if you're running a recent AKU http://forum.xda-developers.com/showpost.php?p=1032402&postcount=800), then you'll probably have to hard reset your device. NOTE: An alternative means of changing the default SIP is by using the SIPChange utility: http://forum.xda-developers.com/showpost.php?p=995883&postcount=16
The following are some of the ClassIDs typically found:

Typical pre-installed:
{42429667-ae04-11d0-a4f8-00aa00a749b9} = Keyboard
{51A2CB38-154E-4C92-A625-A83871C99EC2} = Phone Pad
{42429690-ae04-11d0-a4f8-00aa00a749b9} = Letter Recognizer
{42429691-ae04-11d0-a4f8-00aa00a749b9} = Block Recognizer
{F0034DD0-2AD4-11d1-9CB0-E84BE8000000} = Transcriber
Third Party:
{991A1001-9DCB-11d3-B3C2-000000000000} = AccessPanel
{1E03E205-12D7-4d82-963E-C01889F2EC10} = Claviature
{500AEF94-EBB8-11d4-B1F8-00304F06E973} = Decuma Alphabetic (UNCONFIRMED!)
{95BDB641-772F-11d2-AC6B-204C4F4F5020} = Fitaly
{52429695-AE04-11D0-A4F8-00AA00A749B9} = FleXslide
{4EAD10BD-83AC-44b9-99AE-71958C1B0F0E} = InPad
{C099F78A-924E-4814-A8CF-54E7BD8C2124} = JetKeys
{4128DEE4-EE84-4338-A261-CC704CB32C19} = NanoPad
{42429695-AE04-11D0-A4F8-00AA00A749B9} = NullKB
{025ECAC2-075B-4b82-A972-05E4C17719EA} = PDAMedia Excel
{FA957346-A925-4b68-B9E1-D3D0310F4433} = PDAMEdia KBD
{DE6510EF-6691-401D-B1D3-B9074BFD1555} = PHM Character Map
{81FC2CAD-AD71-4793-9464-36D27630E584} = PHM Clipboard Pane
{9DD23292-0AB3-48F2-A245-0713652A8CEE} = PHM Ext. Keyboard
{FFFD6819-FF21-4e93-B844-A1BBF986B55C} = QuikWriting
{991A1000-9DCB-11d3-B3C2-000000000000} = RapidCalc
{A070BE16-AD56-11d3-BC77-00C06C512035} = Resco Keyboard Pro
{7F0854D9-9ADA-45A9-A3A2-189D9BE8A653} = Smilies Input Panel
{26F56EF0-2CE8-4C46-ADC8-FE0A7DF12DD1} = SPB Fullscreen Keyboard
{5efab5bd-0af5-48f8-abec-6f36e3a0b5af} = TenGo
{8A7968F3-677B-4F64-859C-8A49FCCCB9BF} = TextPlus
{A5304BFA-CC1D-493f-87D3-D9C17147FA32} = TopKey
{4345EA53-B8A5-4E24-A14A-F7C34DD78077} = WordLogic

Add/remove items from the SIP list

If you have a few items in your SIP list which you don't use, they can be removed from the list by setting the IsSIPInputMethod for each item you want removed. To remove the SIP from the list, replace the $SIP_CLSID$ in the example below with a CLSID from the Set default SIP tweak.:

HKEY_CLASSES_ROOT\CLSID\$SIP_CLSID$\IsSIPInputMethod\(Default) = 0 (DWORD decimal)

To add it back to the list:

HKEY_CLASSES_ROOT\CLSID\$SIP_CLSID$\IsSIPInputMethod\(Default) = 1 (DWORD decimal)


Pocket Calendar

Show Calendar event text in Week View

If you wish to see a Calendar event's text in the Week View, set the following:

HKCU\Software\Microsoft\Calendar\ShowTextInWeekView = 1 (DWORD decimal)

To disable it again:

HKCU\Software\Microsoft\Calendar\ShowTextInWeekView = 0 (DWORD decimal)

Please note that your event must have long enough a duration to show the event text, and the week view (with its narrow columns) truncates long words easily
Also note that the key "Calendar" may not exist - just create it if it doesn't

Change Calendar 'working days'

If you wish to change the 'working days' in the calendar, adjust the following:
For a Mon-Fri workweek (default):

HKLM\Software\Microsoft\Calendar\ActiveTimes\ActiveTimes = 2210003E (DWORD hexadecimal)

For a Mon-Sat workweek:

HKLM\Software\Microsoft\Calendar\ActiveTimes\ActiveTimes = 2210007E (DWORD hexadecimal)

For a Tue-Thu workweek:

HKLM\Software\Microsoft\Calendar\ActiveTimes\ActiveTimes = 22100016 (DWORD hexadecimal)

Here's how this works. When editing the value, switch to "Binary" mode. For the default Mon-Fri, you should see:

100010000100000000000000111110

The last 7 numbers are what we're interested in. They stand for the days of the week, in reverse order: Saturday, Friday, Thursday, Wednesday, Tuesday, Monday, Sunday. When the number is "1", it is a working day. If it is "0", it's not a working day. So to look at the above examples again:

Days   : SFTWTMS
Mon-Fri: 0111110
Mon-Sat: 1111110
Tue-Thu: 0011100

Using the above, you should be able to set the working days to whatever you'd like.
Note that this value also adjusts the working HOURS. The examples here all use the default 8am-5pm workday. See the "Change Calendar 'working hours'" tweak to modify this.
Note that the ActiveTimes key and value may not exist. Simply create them first.

Change Calendar 'working hours'

If you wish to change the 'working hours' in the calendar, adjust the following:
For 8am-5pm (default):

HKLM\Software\Microsoft\Calendar\ActiveTimes\ActiveTimes = 2210003E (DWORD hexadecimal)

For 9am-5pm:

HKLM\Software\Microsoft\Calendar\ActiveTimes\ActiveTimes = 2212003E (DWORD hexadecimal)

For 2pm-10pm:

HKLM\Software\Microsoft\Calendar\ActiveTimes\ActiveTimes = 2C1C003E (DWORD hexadecimal)

See here: http://www.pocketpcthoughts.com/index.php?action=expand,47926

XDADeveloperWiki - WM5_Tweaks_Other

Posted by krsuncom
개발이야기2007. 8. 13. 20:59

 

WM5 Registry Tweaks - Performance

These Registry tweaks are typically used to improve performance of Windows Mobile 5. (This content was split off from WM5_Tweaks_Other because that page would no longer accept additional content.)


For further tweaks, see: WM5 Tweaks - Other and http://www.pocketpctweaks.com/


Note to editors:

When editing, please make sure to disable the "[ ] Use Old Markup" option for display formatting reasons.


EXAMPLE - TRY NOT TO EDIT/DELETE

Tweak to do something

To do this and that, adjust the following registry value:

HKLM\Software\Microsoft\Something\SomeValue = 1 (DWORD decimal)

To do something different entirely, perhaps the opposite, do this:

HKLM\Software\Microsoft\Something\SomeValue = 0 (DWORD decimal)

This is an additional note


Disable menu animations

To disable menu animations (sliding in/out) and speed up performance of the UI a bit:

HKLM\SYSTEM\GWE\Menu\AniType = 0 (DWORD decimal)

To change it back to the default:

HKLM\SYSTEM\GWE\Menu\AniType = 6 (DWORD decimal)

Disable window animations

To disable window animations (minimizing/maximizing) and speed up performance of the UI a bit:

HKLM\SYSTEM\GWE\Animate = 0 (DWORD decimal)

And to switch them back on:

HKLM\SYSTEM\GWE\Animate = 1 (DWORD decimal)

Increase font cache

To increase the font cache, speeding up font rendering at the cost of a bit of memory:

HKLM\SYSTEM\GDI\GLYPHCACHE\limit = 16384 (DWORD decimal)

To change it back to the default:

HKLM\SYSTEM\GDI\GLYPHCACHE\limit = 8192 (DWORD decimal)

You can set the value to pretty much anything you like, but suggested values are 4096, 8192, 16384 & 32768.

Enable FileSystem cache

To enable the FileSystem cache, speeding up overall performance at the risk of the cache not being written on a sudden reset:

HKLM\System\StorageManager\FATFS\EnableCache = 1 (DWORD decimal)

To disable again:

HKLM\System\StorageManager\FATFS\EnableCache = 0 (DWORD decimal)

Note that by default, the cache size is zero, and you will see no effect. See "Increase FileSystem cache" below to increase the cache size.

Increase FileSystem cache

To increase the file system cache:

HKLM\System\StorageManager\FATFS\CacheSize = 4096 (DWORD decimal)

To return the file system cache to zero:

HKLM\System\StorageManager\FATFS\CacheSize = 0 (DWORD decimal)

You can set the value to pretty much anything you like.

Increase FileSystem filter cache

To enable the file system filter cache, speeding up overall performance with file mangement:

HKLM\System\StorageManager\Filters\fsreplxfilt\ReplStoreCacheSize = 4096 (DWORD decimal)

To return the file system filter cache to zero:

HKLM\System\StorageManager\Filters\fsreplxfilt\ReplStoreCacheSize = 0 (DWORD decimal)

You can set the value to pretty much anything you like.

XDADeveloperWiki - WM5_Tweaks_Performance

Posted by krsuncom
개발이야기2007. 8. 6. 12:53

 

Windows CE Developers FAQ

Welcome to the CEGadgets Windows CE Developer FAQ page! Here you will find answers to common (and not so common) Windows CE development questions. This FAQ tries to avoid basic Windows CE issues (what is Windows CE, what is activeSync) and instead serves as a technical document discussing Windows CE specific development issues. Also, this FAQ avoids embedded specific issues, and focuses more on application development.

If you have something you want to add, or find a problem, send a note to faq@cegadgets.com explaining the problem or addition. I will update the FAQ ASAP and give you credit for it as well. Thanks!

This FAQ was last updated 27-Mar-01. Also, notice that new and updated items show in a separate section (as well as in the main contents list). Items will remain in the new/updated section for one week.

1. General
1.1 Why should I write software for Windows CE?
1.2 What does the CE in Windows CE stand for?
1.3 I want to learn about Windows CE development. Where should I start?
1.4 What books are available for Windows CE developers?
1.5 What are some other developer related Windows CE websites?
1.6 Where can I find information on DevCon 99?
1.7 I need to learn CE in a hurry - can I take a class?
1.8 Things to consider before you design that new Windows CE application.
1.9 I want to develop using Visual C++. What do I need?
1.10 I want to develop using Visual Basic. What do I need?
1.11 What other development tools are available for windows CE?
1.12 How do I report bugs (or feature requests) in Windows CE development tools?
1.13 Should I get a copy of Platform Builder 2.11/2.12?
1.14 Where can I find a MIPS or SH3 disassembler?
1.15 Can I write DCOM application under Windows CE?
1.16 Is the SH4 binary compatible with the SH3?
1.17 Does Windows CE support COM?

2. Visual C++ Issues
2.1 What do I really need to write C++ apps for Windows CE?
2.2 Do I need to purchase the Windows CE Toolkit for C++ or Basic to develop for CE?
2.3 Can I use Visual Studio SP3 with the Toolkit for Windows CE?
2.4 Can I use Windows 95/98 to build Windows CE applications?
2.5 My MFC app doesn't run on the device the first time I try?
2.6 I keep getting internal compiler errors? How do I make them go away?
2.7 I use a serial connection to debug and use programs like Remote Spy, but the serial connection speed is slow. How can I make it faster?
2.8 How can I copy files to the emulator?
2.9 Can I use C++ exceptions in my Windows CE application?
2.10 Can I use STL in my Windows CE application?
2.11 I populate my combobox using the resource editor, yet when I run my application under CE all I see is garbage. What can I do?
2.12 Is there a way to edit my Visual C++ files on my handheld?
2.13 How does compiler optimization affect Windows CE executables?
2.14 Where is the Windows CE C runtime library? Is source for the runtime available?
2.15 How can I develop applications for Windows CE 1.0?
2.16 I want to port my Windows desktop application to Windows CE.  What issues will I face?
2.17 I can compile for the MIPS and SHx processors, but I don't see an option for the StrongArm.  What can I do?

3. Third Party Tools and Hardware
3.1 Which databases are available on the Windows CE platform?
3.2 Are there any Text-To-Speech engines for the CE platform?
3.3 I want to write an MP3 decoder for Windows CE. Where do I start?
3.4 Are there any printer libraries for Windows CE?
3.5 How can I work with Pocket Outlook data?
3.6 Is there an FTP client API available for Windows CE?
3.7 How can I copy-protect my Windows CE application?
3.8 Where can I find an XML parser for Windows CE?
3.9 Is GCC available for the Windows CE platform?

4. Windows CE Overview
4.1 How many processes can Windows CE support?
4.2 How many threads can Windows CE run?
4.3 What does the basic Windows CE memory map look like?
4.4 What is Execute-In-Place (XIP) and what does it mean for me?
4.5 I want to make my own shell. Where should I start?
4.6 Can I trash my object store by turning off the power during a file operation?
4.7 How much stack space can I use per thread?
4.8 Why does my Windows CE 2.0 stack blow out, even if I allocated it at compile time?
4.9 What kind of limitations will I encounter using the CE Database?

5. General Windows CE Development
5.1 I can't find an API that I need. What should I do?
5.2 How can I insure only one instance of my application?
5.3 How can I make I application startup on system startup?
5.4 How can I prevent other applications from running while my application is active (how can I keep users from accessing the Start Menu)?
5.5 How can I change task bar settings such as Auto Hide?
5.6 How do I keep my device from auto-suspending?
5.7 How do I detect power-on?
5.8 How can I programmatically turn off the device?
5.9 How can I get battery status?
5.10 How can I determine the device type?
5.11 How can I determine the device name?
5.12 How can I initiate a connection to the desktop?
5.13 How can I tell if ActiveSync is currently running?
5.14 How can I programmatically change the display brightness?
5.15 How do I reboot/reset the device?
5.16 How can I change the size of the object store?
5.17 How can I reprogram the buttons on the device? Can I use hardware buttons to initiate application functionality?
5.18 I am writing a dialog based application. Why doesn't an entry appear in the taskbar or in the task list?
5.19 I want to modify the contact database. What is the contact database name or CEOID?
5.20 What is Venus?
5.21 What is Cedar?
5.22 When is MSMQ going to be available?
5.23 How do I get the time under CE - or, what happened to time()?
5.24 How can I convert a pwi to an rtf?
5.25 How can I determine whether the device has been rebooted/reset since the last time the application ran?
5.26 How can I make a resource only DLL under Windows CE?
5.27 How can I determine the current SIP state?
5.28 How can I change the current SIP state?
5.29 How can I enable or disable the Jot SIP?
5.30 I need an ownerdrawn listbox but they are unsupported. What should I do?
5.31 How can I implement a list view with a checkbox next to each item?
5.32 What is POOM and should I use it?
5.33 How can I programmatically launch a dial-up connection (without using the RAS API)?
5.34 How can I write or read a physical memory location?
5.35 How can I enumerate Windows CE databases from the desktop?
5.36 I need to use IrDA to communicate with other devices. Where should I start?
5.37 How can I show the wait cursor, especially from VBCE?
5.38 How can I print from a Windows CE application?
5.39 How do I register a control under Windows CE?
5.40 I am having problems getting CE RAPI to work properly. What can I check?
5.41 I want to create a mail message then send it. Can I do this using the Mail API?
5.42 How can I display GIF, JPG, BMP, or XBM images in my application?
5.43 Why can't I display 16-bit images from my application using imgdecmp.dll?
5.44 What steps can I take to make my software ready for foreign markets?
5.45 How can I open, change and delete mail messages?
5.46 How can I use ATLCE to sink events?
5.47 Do the Pocket Office applications support automation? Can I use them from VCCE, VBCE?
5.48 I am using VBCE and need to call API functions that require structures, but UDT's are not available.  What can I do? What should I watch out for?
5.49 How can I turn on the device when the serial port has activity?
5.50 How can I start applications on device connect/disconnect?
5.51 Do you have any tips on getting more out of HTMLView?
5.52 How do I get the name of a ADOCE table if I only have an Table ID number?
5.53 How can I determine the amount of free space on storage cards, on the device and in memory?
5.54 How can I disable the OK button on my Windows CE dialogs?
5.55 Which common dialogs are supported under Windows CE?

6. Palm Size Development Issues
6.1 If I don't implement an exit menu item, is there anything I can do to make closing the application easier?
6.2 Why should I pay any attention to WM_HIBERNATE?

7. Common Executable Format (CEF)
7.1 What is CEF?
7.2 Can I use CEF in my current applications?
7.3 Can I have a CEF based dll or ocx?
7.4 Why should I use CEF?
7.5 Is CEF as fast as an application compiled for the platform?
7.6 If I am only targeting one specific device should I use CEF?

8. Installation
8.1 What install packages are available?
8.2 How do I programmatically open a cab file on a CE device?
8.3 How do I start an installation from the desktop?
8.4 How can I keep a cab file from being erased after it is installed?
8.5 What command line switches are available for CeAppMgr?
8.6 My install set is having trouble registering controls on Palm-Size PC devices. What am I doing wrong?
8.7 How can I programmatically open a .CAB file?

9. Help
9.1 What format is Windows CE Help in?
9.2 How should I create help files?
9.3 How can I programmatically launch help?

10. Internal/Undocumented/Hack Corner
10.1 Ways to explore windows CE.
10.2 Hack while you can - it will be harder soon.

10.3 BinaryCompress/BinaryDecompress - built in compression for windows ce

10.4 SetProcPermissions - give your process access to other processes!
10.5 RegFileCopy - make an instant copy of the registry
10.6 GetFSHeapInfo - pointer to object store in physical memory
10.7 Predict.dll offers access to word prediction on Palm Size PC's
10.8 Inspect ROM on the Casio E-100 and find interesting things.
10.9 SetWindowsHookEx really does work, sort of.

10.10 Calstore.dll can be used to access the task database API set.
10.11 How can I reformat a compact flash card?

11. Known CE bugs
11.1 Createprocess on pspc devices doesn't work
11.2 MFC CE 6.0 - Gettime with city set to foreign city. Returns 7/22/1863.
11.3 The voice control will not write recordings to any filename except the default.
11.4 The 6.0 StrongArm compiler creates buggy code.

12. Windows CE Gossip Corner
Note: These are all unverified and included just because they are interesting.
12.1 PPTP will be available in 3.0 but not 2.12.
12.2 A new grid control will be released soon.

12.3 The 2.12 version of Imgdecmp.dll supports 24-bit bitmaps.
12.4 When will VCCE 6.5 be released?

1. General

1.1 Why should I write software for Windows CE?

PDA's are booming! Marketing research organizations like IDC project 40% annual growth in handheld device through 2001. Handheld's are also taking off in the enterprise, and are predicted to be the next big enterprise computing platform.

IDC predicts that consumer 'info appliances' will surpass PC sales in 2001, reaching almost 20 million units.

Windows CE is poised to capitalize on this rapid growth. Microsoft is positioning Windows CE to be an easy choice for enterprise development and use, and is working with many OEM's to promote general consumer use and acceptance of Windows CE.

If you have any experience developing for the Windows platform, you can develop for Windows CE. Other platforms cause you to learn new tools and API's, and do not have the broad support of Microsoft and it's partners. Leverage your knowledge and Microsoft's marketing muscle and start coding for CE!

1.2 What does the CE in Windows CE stand for?

While Microsoft claims the CE does not represent any particular meaning, it has been said that it stands for Consumer Electronics (for the devices CE targets) or Compact Edition. When you are really frustrated with a particular problem or shortcoming you can refer to it as Windows CE (Crippled Edition).  I also like Caveat Emptor.

1.3 I want to learn about Windows CE development. Where should I start?

There are many excellent development resources for Windows CE. First, check out the Windows CE related newsgroups:

Microsoft.public.win32.programmer.wince
Microsoft.public.vb.vbce
Microsoft.public.windowsce
Microsoft.public.vc.vcce
Microsoft.public.ado.wince
Microsoft.public.windowsce.developer.betas
Microsoft.public.windowsce.embedded

Also, check www.deja.com for a nice archive of Windows CE posts going back years. This is probably my number one Windows CE resource.

I also really like the windowsce-dev mail list.  It probably has the purest technical Windows CE content of any source, and is monitored by some of the best CE developers I've seen.  It contains a mix of embedded and application development questions.  I also tend to see issues pop up on this list before they show up on the regular newsgroups.  For example, I read about the Platform Builder price increase 3 weeks before it started being discussed on the newsgroups.  To join, send an email to WindowsCE-Dev@Lists.WindowsCE.com

Check out some of the books mentioned in this FAQ, and visit some of the other Windows CE developer websites.

Finally, there is nothing like experience. If you can afford it, purchase the Microsoft development tools, NSBasic or one of the other development tools available for the platform. Try building a few applications. If you have previous Windows development experience you will find Windows CE development to be only mildly painful ;-)

1.4 What books are available for Windows CE developers?

Here is a list of some of the Windows CE development books available, in no particular order:

  • Inside Windows CE - John Murray
  • Programming Embedded Systems for Microsoft Windows Ce - Jeff McLeman
  • Professional Visual Basic Windows CE Programming - Larry Roof
  • Programming Windows CE - Douglas Boling
  • Windows CE 2 Programming for Dummies - Nick Gratten
  • Essential Windows CE Application Programming - Robert Burdick
  • Windows CE Developers Handbook - Terence Goggin
  • Windows CE from the Ground Up - Jean Louis Gareau (annabooks web site).
  • Sams Teach Yourself Windows CE Programming in 24 Hours - Bsquare
  • Windows Ce : Application Development - Keven Millsap, Marshall Brain

1.5 What are some other developer related Windows CE websites?

Here are some CE developer websites:

Samples, SDK's and other tools.

Information and advice on Visual C++ for CE.

Information and advice on Visual Basic for CE. Home of the vbceUtils control for Visual Basic for Windows CE.

Cool API samples and demoware applications for Windows CE.

Samples from DevCon 99.

Some MFC based Windows CE samples.

ActiveX controls for Windows CE developers.

Used to be RoadCoders.com - general Windows CE articles and other development info.

1.6 Where can I find information on DevCon 99?

Take a look at this excellent site. Microsoft has posted video for all of the sessions at DevCon 99 in Denver. Go to http://events.microsoft.com/isapi/events/pages.asp?s=63814&p=620 for more information.

1.7 I need to learn CE in a hurry - can I take a class?

Let's say you need to learn Windows CE ASAP! Depending on your budget and time constraints you could attend a class or conference. The following companies offer beginning and advanced Windows CE training:

David Solomon Expert Seminars www.solsem.com
Annabooks www.annabooks.com
The Paul Yao Company www.paulyao.com

Also, Microsoft has an annual Windows CE developer's conference, usually somewhere between April and June.

Finally, if you really want to learn now (or have no budget), go to http://events.microsoft.com/isapi/events/pages.asp?s=63814&p=620 and check out the video samples. Doug Boling gave did a one-day "Windows CE for application developer's" seminar at DevCon and it is available here.

If you know of others, or want to add your seminar, class or conference, send an email to faq@cegadgets.com and we'll get you added to the list.

1.8 Things to consider before you design that new Windows CE application.

Click here to read the entire article.

1. Read the logo requirements before you design your application.
2. Make life easy for your users - design for your device.
3. Remember power issues - polling, serial port waste power
4. Handle WM_HIBERNATE
5. Think about internet connectivity.
6. Check GNU for portable source code - your app may already be written.
7. Remember, you can't use VB on Palm Sized PC's running Windows CE 2.0 - 2.11 only.
8. Write a help file for your application
9. Plan to write an installer - it's easy
10. Test on actual devices. The emulator is nice but it is not a true Windows CE device.
11. Don't use floating point operations on if you can help it.
12. Buy a Socket Communications ethernet card - it is worth the money.

1.9 I want to develop using Visual C++. What do I need?

Developing using Visual C++ is nice because it will work on any CE platform.

  • The Visual C++ Toolkit for Windows CE 5.0

This is an older version of the Windows CE development environment. It is missing some nice features offered by 6.0, and does not have support for the PSPC 1.2 SDK, ethernet debugging, etc. Interestingly, it does offer an object store browser that was removed in version 6.0. The 5.0 toolkit also lets you target Windows CE 1.0. The 6.0 product does not.

To develop using Visual C++ 5.0 you will need the following:

Visual C++ 5.0, Professional or Enterprise edition
Visual C++ Toolkit for Windows CE 5.0
HPC or PSPC SDK, downloadable for free from the Microsoft web site.

  • The Visual C++ Toolkit for Windows CE 6.0

The current C/C++ development environment for Windows CE.

To develop using Visual C++ 6.0 you will need the following:

Visual C++ 6.0, Professional or Enterprise edition
Visual C++ Toolkit for Windows CE 6.0
Any of the CE SDK's, downloadable for free from the Microsoft web site.

1.10 I want to develop using Visual Basic. What do I need?

First, you need to have an HPC, HPC Pro or a Palm Size PC running 2.11! Many people have purchased the Visual Basic toolkit, written an application and attempted to copy it to a Nino or some other 2.01 device. It does not work! Below is a list of valid Palm Size devices:

Casio E-15, E-100, E-105
HP Jornada 420 and 428
Compaq Aero A2xxx
Philips Nino 520
Everex FreeStyle 540
Any new Palm Size device released after 9/11/99.

Take a look at the official Microsoft statement http://msdn.microsoft.com/cetools/platform/ppcfeatures.asp under the heading of "Visual Basic Runtime in ROM".

Below are descriptions of the available Visual Basic toolkits.

  • The Visual Basic Toolkit for Windows CE 5.0

The first version of basic that supported Windows CE. It was a challenging and generally unpleasant experience developing software for Windows CE using this tool. While version 6.0 has shortcomings, it is worth the upgrade price to make the switch to the Visual Basic toolkit for Windows CE 6.0. To develop using the Visual Basic, you will need:

Visual Basic 5.0, Professional or Enterprise edition
Visual Basic Toolkit for Windows CE 5.0
The HPC SDK

  • The Visual Basic Toolkit for Windows CE 6.0

The current version of Visual Basic for CE. To develop using the Visual Basic, you will need:

Visual Basic 6.0, Professional or Enterprise edition
Visual Basic Toolkit for Windows CE 6.0
The HPC SDK, HPC Pro SDK or the PSPC SDK v. 1.2.

1.11 What other development tools are available for windows CE?

Check out the full article, with comments and pricing on each tool.

1.12 How do I report bugs (or feature requests) in Windows CE development tools?

Microsoft has a couple of useful email addresses:

Windows CE development tools feature suggestions:
wcetwish@microsoft.com

Windows CE Development Tools Bug Reporting:
wcetbug@microsoft.com

1.13 Should I get a copy of Platform Builder 2.11/2.12?

As an application developer you may think Platform Builder doesn't apply to you. While this is mostly true, Platform Builder includes a wealth of information on the internals of Windows CE, including prototypes for functions not documented in the SDK. The Platform Builder help files also contain great information about the workings of the operating system. While this isn't necessarily going to help you make a better list control, you can find interesting little features like RegCopyFile, which copies the entire registry to a file, or PowerOffSystem.

Unfortunately, Platform Builder is a little pricey, and rumor has it PB will be more so when 2.12 is released. Microsoft will charge up to $3000 for Platform Builder and also require a purchase of 250 Windows CE licenses, putting the total price around $13,000! Not to worry, though.  If you really want to get a copy of Platform Builder 2.12 for evaluation purposes, you can purchase the Universal MSDN subscription (which is roughly $2500 I believe).  MSDN Universal not only comes with PB 2.12, but it also contains all the toolkits, SDKs, development tools, and operating system you will need to develop Windows CE software (or any other software for that matter). 

A 60-day trial edition of Platform Builder 2.12 is included with a subscription to MSDN Universal. You can also obtain a trial edition from a distributor for a small fee, ~ $25. See http://www.microsoft.com/embedded/distributors/distrib.asp for a list of distributors.

1.14 Where can I find a MIPS or SH3 disassembler?

Check out http://www.datarescue.com/idawindowsce.htm for a Windows CE code disassembler.

Delosoft also produces a disassembler for MIPS and SH3 executables. Check out www.delosoft.com for more information.

1.15 Can I write DCOM application under Windows CE?

Windows CE 2.11 and earlier do not contain a DCOM implementation - only inproc servers are allowed at this time. However, is has been mentioned that Microsoft does have DCOM for CE in beta (as of 9/99). Perhaps it will be included with CE 3.0 (Cedar) if everything goes as Microsoft plans.

Intrinsyc has a "DCOM" implementation for CE 2.XX+. While not identical to Microsoft's desktop DCOM implementation, it offers similar functionality. More info can be found at http://www.intrinsyc.com.

1.16 Is the SH4 binary compatible with the SH3?

I found this interesting exchange on the windowsce.com developer mailing list:

When I run any SH3 applications on an SH4 device the program starts to load, but the busy icon freezes and never returns.

Response:

Some folks from Hitachi were here Tuesday promoting their new CE unit, which uses an SH4 chip. I asked whether I would have to recompile my app, and they said YES. In other words, the SH3 and SH4 are not binary compatible.

So in other words, according to the post the SH4 is not backwards compatible with the SH3. I have seen other posts mentioning similar problems; the SH3 application will run on an SH4 but crash in peculiar places, for no apparent reason. These same people say that recompiling their app for SH4 seemed to resolve the problems. Also, the compiler warns if an SH3 app is being downloaded to an SH4 machine.

1.17 Does Windows CE support COM?

Windows CE only supports in-process COM object.  There is talk of extending COM functionality in the next major release of Windows CE.  Here are a few references for getting started with COM and CE:

  • "How to Write and Use ActiveX Controls for Microsoft Windows CE" from the MSDN
  • "The Tools You'll Need to Build Embedded Apps: Windows CE Toolkit for Visual C++ 6.0" from MSJ July 1999. There's a section called "Desktop ActiveX Controls".

I have used ATL quite a bit on the CE platform, and aside from one minor problem with connection points, everything works well.  All of the controls available on the CEGadgets.com main page are written using ATLCE.

See Can I write DCOM applications for Windows CE for information on DCOM and CE.

2. Visual C++ Issues

2.1 What do I really need to write C++ apps for Windows CE?

To develop using Visual C++ 6.0 you will need the following:

  • Visual C++ 6.0
  • Visual C++ Toolkit for Windows CE 6.0
  • Any of the CE SDK's, downloadable for free from the Microsoft web site.

You will also need to be running Windows NT 4.0 with SP3 or greater installed.  You can develo using Windows 95/98 as well, but won't be able to use the emulator (which requires a UNICODE operating system).

2.2 Do I need to purchase the Windows CE Toolkit for C++ or Basic to develop for CE?

Yes, you do need to purchase the C++ or Basic Toolkit. Microsoft gets about $200 for it, but there are third party software vendors that will sell it to you for less. buy.com has it for $167.

The toolkit contains the compilers and linkers needed to create executables for Windows CE.  It contains support for the various processor types supported by Windows CE.

The "SDKs" contain the various header and library files used in actually writing the application.  Each SDK contains any customizations to the Win32 API needed by a particular platform, such as the addition of the SIPINFO APIs for Palm-size PCs.

The Windows CE SDKs are free and readily downloadable at: http://msdn.microsoft.com/cetools/downloads/devkits.asp

You can also use tools like NSBasic ($99) to develop directly on the device...

2.3 Can I use Visual Studio SP3 with the Toolkit for Windows CE?

Microsoft states that SP3 is incompatible with WCE toolkit at this time (9/2/99).

2.4 Can I use Windows 95/98 to build Windows CE applications?

You can run VC 5.0 under Windows 95/98 but you will not be able to use the emulator.

You may be able to run VC 6.0 under Windows 95/98 (but you will not be able to use the emulator). It was mentioned on one of the CE newsgroups that as of 6.0, the Windows CE Toolkit will not allow installs to 95/98, but I have only seen this comment once. I haven't tried this (I did use the 5.0 toolkit on 95 and 98 without trouble). However, several other people have written stating that the 6.0 Toolkit does install under 95/98, so I'd bet that there really isn't any problem with this approach.

2.5 My MFC app doesn't run on the device the first time I try?

Some files (like mfcce20d.dll) are not copied properly during the installation of the toolkit. Check the following page for more info:

http://support.microsoft.com/support/kb/articles/q187/6/16.asp

2.6 I keep getting internal compiler errors? How do I make them go away?

The Windows CE compiler is a little finicky when it comes to code. If you get an error like:

myfile.cpp(234): fatal internal error CBE7002:
try changing your code around a little. Move your declarations, remove extra spaces, etc. Basically just change the code style a little bit and try to compile again. This usually fixes the problem.

2.7 I use a serial connection to remotely debug my x86 applications, but the serial connection speed is slow. How can I make it faster?

Contact MS support for a fix to the TCP/IP stack to increase the speed of Apps debugging with DevStudio Add-in. Note that this applies to remote debugging on x86 based platforms (CEPC, etc).

2.8 How can I copy files to the emulator?

After successfully installing your SDK, look for the Windows CE Platform SDK menu item under Start, Programs. Launch 'Emulation Environment for [platform name]'. This will launch a console window. At this point, type empfile -? for options, or type empfile -c [source filename] wce:[taregt location in object store].

For example, empfile -c e:\CEproject\myapp.exe wce:\windows\start menu\myapp.exe will copy myapp.exe into the emulator object store.

2.9 Can I use C++ exceptions in my Windows CE application?

C++ exceptions are not supported on Windows CE. But Win32 exceptions are. You can use the __try and __except keywords (and also the __try and __finally keywords). MFC exceptions are also supported (TRY, CATCH, etc.)

However, the key words for C++ exceptions (try, catch, and throw -- with *no* leading underscores) are not supported.

2.10 Can I use STL in my Windows CE application?

STL relies on exceptions, and since exceptions are not supported under Windows CE, STL cannot be fully implemented. There are a few ports of STL to CE that do not rely on exceptions. Take a look at:

Search www.deja.com for information on STL and CE for more information. If you have information on other STL ports let me know.

2.11 I populate my combobox using the resource editor, yet when I run my application under CE all I see is garbage. What can I do?

Apparently the resource editor treats the text as ANSI, not UNICODE. You have to populate the listbox programatically.

2.12 Is there a way to edit my Visual C++ files on my handheld?

Logical Sky has produced a syntax highlighting C++ editor for use on HPC and HPC/Pro platforms. Here's a recent press release:

Logical Sky is proud to announce the release of CEdit for Windows CE!

CEdit is a color syntax hilighting C++ editor for Windows CE. CEdit is designed for C++ developers who need to work with their source code when they are away from their desks. CEdit is compatible with Microsoft Visual C++. It allows you to open a Visual C++ project file on your handheld, so that you will have quick access to all of your C++ files.

CEdit is designed for MIPS and SH3 based H/PCs. CEdit will not run on a palm-sized CE device.

A free fully functional 30 day demo is available from: http://www.LogicalSky.com.

CEdit is $49.95.

2.13 How does compiler optimization affect Windows CE executables?

I came across the following interesting post in the windowsce-dev digest:

I've been working on a project targeted to the SH3 processor and I noticed that the Release mode EXE for the SH3 was actually larger that the Debug version with symbols!  After a little thought I remembered an article in MSJ a year or so ago or so discussing the various optimizations of the x86 compiler in DevStudio.  IT said that often the default optimization for speed can be slower that the optimizations for size and that it can get worse for RISC processors.  So I compiled for Size instead of speed and there were MAJOR differences in EXE size.

X.EXE CPU Debug Opt Size Opt Speed
SH3 176K 131K 187K
x86 189K 120K 136K

Additionally I couldn't detect any difference in the speed of the code in a relatively GUI intensive app.

Just thought I share that it's actually worth the time spent trying different optimizations, at least on the RISC processors.

2.14 Where is the Windows CE C runtime library? Is source for the runtime available?

Starting with Windows CE 2.01, Microsoft folded the C runtime directly into coredll (in other words, Windows CE 2.0 for the HPC is the only version that did not do this).  One reason for doing this is to help executables stay as small as possible.  With the runtime and API set in ROM, user applications will stay very small.

Microsoft has not released source to the Windows CE C runtime.

2.15 How can I develop applications for Windows CE 1.0?

If for some reason you are stuck doing development for Windows CE 1.0, you will need the Visual C++ 5.0 and the Windows CE Toolkit for Visual C++ 5.0. VC++ 6.0 does not support the WCE 1.0 platform.

2.16 I want to port my Windows desktop application to Windows CE.  What issues will I face?

There are many issues to consider when porting your application to Windows CE.  You will face many obvious issues, like interface changes, power and memory constraints.  However, you will find many not-so-obvious issues to contend with, as well.

Perhaps the largest issue you will face is making your application UNICODE compliant.  Windows CE is a UNICODE operating system, and all strings used in API calls must be UNICODE.

You may  also need to deal with the following issues: missing API's, thread issues, floating point use, sockets, etc.

Check out the full article, Common Windows CE Porting Issues, for more information.

2.17 I can compile for the MIPS and SHx processors, but I don't see an option for the StrongArm.  What can I do?

Download and install the HPC/Pro SDK from http://msdn.microsoft.com/cetools/downloads/hpcprosdk.asp. This SDK  contains what you need to generate executables for the StrongArm using your Windows CE Toolkit.

3. Third Party Tools and Hardware

3.1 Which databases are available on the Windows CE platform?

Check out the full article, Third Party Database Tools for Windows CE, here!

There are a phenomenal amount of database tools available for the Windows CE platform.  Here is the short list of available CE databases:

3.2 Are there any Text-To-Speech engines for the CE platform?

The are a few text to speech (TTS) engines for Windows CE.

Check out Lernout and Hauspie's TTS engine for Windows CE. This is the same speech engine used in the AutoPC. Unfortunately, it is only available for SH3 processors at the current time. See http://www.lhsl.com/ssyn/tts3000wince.asp for more information.

You should also check out the Dectalk TTS engine for Win CE. Apparently, Dectalk was purchased by Fonix Corp.  See http://www.fonix.com/products/dectalk/ for more information.

Another entry to the Windows CE TTS field is from Elan. The Elan TTS toolkit was released 1-Nov-99 and was $495US at that time. It will support the MIPS and SH processors, and will cover the following languages: US English, UK English, French, German, Spanish, Brazilian and Russian.

Note: $495US covers the developer license. The toolkit also requires distribution royalties, which depend on the number of units you ship. Contact Elan for more information - info@elan.fr, or see their web site at www.elantts.com.

3.3 I want to write an MP3 decoder for Windows CE. Where do I start?

There are currently two MP3 players for the Windows CE platform, and both use the Xaudio SDK to actually do MP3 decoding/playback. The Xaudio SDK is easy to use, well documented, and FREE for personal use (you have to license Xaudio for commercial distribution).

Support for Xaudio development is good as well. Check www.xaudio.com for more information and to download the SDK.

If you really want to "roll your own", there is source for mp3 decoders around on the internet. Try www.mpeg.org for more information.

3.4 Are there any printer libraries for Windows CE?

Check out FieldSoftware's PrinterCE ActiveX control. It provides basic print output routines for CE. FieldSoftware offers a barcode package as well.  PrinterCE is license based, with prices ranging from 19.95 for the basic library, up to $1000 for PrinterCE Plus with barcode support, including 500 licenses.

From a FieldSoftware newsgroup post:

PrinterCE makes sophisticated printing from VBCE simple (no worries about device contexts and BitBlits and DIBsections, etc). Plus, PrinterCE goes beyond just plain printing by adding support for printing from Palm-sized PCs!!! as well as printing barcodes, using specialized label printers, and much more.

Get more information at: www.fieldsoftware.com

3.5 How can I work with Pocket Outlook data?

You should definitely check out the POOM SDK. POOM stands for Pocket Outlook Object Model, and represents a standard, easy to use interface into Contacts, Calendar and Tasks on your Windows CE device. Use this in place of modifying the contact, calendar or task databases directly, or even the AddressCard API.

You can download the POOM SDK at msdn.microsoft.com/cetools/platform/poomsdk.asp.

Along with offering basic access to Pocket Outlook, POOM offers some cool features like ReceiveFromInfrared and SentToInfrared, which will squirt the selected object(s) in/out the infrared port. It also allows you to work with cities on the device.

3.6 Is there an FTP client API available for Windows CE?

While an FTP client is documented in the Windows CE help, no FTP client actually ships with OEM devices.  I have heard two explanations for this.  One, given at CE DevCon 99, was that it was up to the OEM to ship or leave out FTP support, and most left it out.  The other is mentioned in the CE documentation.  While FTP functions are documented, there is a statement in the remarks section: "Inetftp.dll is available only for Intel x86 processors."

Here are two third-party sources for Windows CE FTP controls:

Ruksun makes an FTP client, and has packaged some of their code into a simple to use ActiveX control for developers. Contact komal@ruksun.com for information on the control and licensing.

Dev-soft has a massive set of internet controls for Windows CE developers, including support for HTTP, FTP, IMAP, LDAP, NNTP, SMTP, etc. Here's a snippet from their site re: FTP functionality.

FTP - Used to transfer files using the FTP protocol. Very easy to use with a 'plug and play' interface. Supports most corporate firewalls, and has an extensible architecture, enabling access to non-standard FTP server features (mostly found in mainframes).

The toolkit is also royalty-free.

3.7 How can I copy-protect my Windows CE application?

DESkey sells a dongle that plugs into a PCMCIA or compact flash card slot.  Take a look at http://www.des.co.uk/ for more information.  A free developer's kit is available at www.des.co.uk <http://www.des.co.uk>.

Here's some information about DESKey sent to me by the company:

Manufactured to CompactFlash Standard Type I, this device will allow you to protect your Windows CE 2.x applications against unlicensed use / piracy. In addition to this the DESkey API provides the means for your application to encrypt and decrypt data through the DESkey CF Card.

Features:

CompactFlash Design
Random Number Generator
Code or data from your application may be fed through the DESkey for encryption.
Unique 8 Byte Password
Memory - 1,024 bytes of memory as standard. Up to 32K is available on request.
Anti-Emulation Algorithm
The DK3CF+ supports all popular processors including MIPS, SH3 etc.

Also, take a look at R.I.A. TerraSystems (www.mappad.com).  They offer a key-ring device that works by sending a unique ID to the CE device's infrared port.

There are various software-only based protection mechanisms as well, like creating secret entries in the registry, computing a unique ID based on the user and device characteristics, or requiring a valid serial number (supplied by the author) before allowing the application to run.

3.8 Where can I find an XML parser for Windows CE?

On October 13, 1999, mov Software announced a port of EXPAT to Windows CE.  From the post:

EXPAT is a conforming and non-validating XML 1.0 parser, originally written by John Clark. More information about EXPAT can be viewed at http://www.jclark.com/xml/expat.html

EXPAT is distributed via the GPL or MPL 1.1 licenses. To download the source code for EXPAT for Windows CE please visit http://www.movsoftware.com/devres.htm

EXPAT has been verified to work on the following platforms:
CE2.11
    SH3, SH4, ARM, MIPS
CE2.0
    SH3, MIPS

Take a look at http://www.movsoftware.com/expatxml.htm for more information.

3.9 Is GCC available for the Windows CE platform?

Take a look at http://www.innonet.at/~wisi/index.html. There is a GCC MIPS compiler currently under development, although it still is not ready for release.  From the page:

I am trying to finish a port of GCC to WinCE which I found on the page  http://hyperion.clc.cc.il.us/~arty/. The work there was stopped on September 98 and actually I can't find the page any more.  This guy has already done the most work. I tried just to fix some problems.

At the moment the compiler is still in a pre-alpha state. Simple demo programs are working on my VELO500(e.g.: opening a Message Box).

4. Windows CE Overview

4.1 How many processes can Windows CE support?

Windows CE maps the bottom section of memory into 33, 32Mb slices referred to as 'slots'. The lowest slot is used for the currently running process (the process is mapped into slot 0, not copied!), and other low slots are used for system processes as follows (this is how it appears on my casio e-100):

Slot 0: current running process
Slot 1: NK.EXE (kernel)
Slot 2: Filesys.exe (file system - object store, registry, ceDB etc)
Slot 3: Device.exe (device manager)
Slot 4: Shell32.exe (Windows CE shell)

5 slots are used, leaving 28 remaining slots for user processes.

4.2 How many threads can Windows CE run?

While theoretically there are no limits to the number of threads per process, you will eventually run out of memory and virtual address space. Windows CE 2.x has eight priority levels (default is 3). Foreground threads retain the same priority as all other threads at their level.

Threads in Windows CE are referred to as follows:

  • Time Critical (runs until complete)
  • Highest
  • Above Normal
  • Below Normal
  • Lowest
  • Above Idle
  • Idle

One of the new features in Windows CE 3.0 will be support for 256 priority levels.

4.3 What does the basic Windows CE memory map look like?

The Windows CE address space is 4GB. The bottom 2Gb are used for processes and application shared space. The operating system uses the top 2Gb - hardware, object store and ROM are mapped here (Note that some locations may be different on your device). Have any additional info - please send it to me and I'll add it to the list.

FFFF FFFF: top of memory
BF00 0000: Beginning of ROM area
AB00 0000: I/O Registers on a MIPS R4xxx
AA00 0000: Beginning of screen memory
A000 0000: Beginning of DRAM area
8000 0000: Beginning of kernel memory space
[.]
4200 0000: begin shared app memory (memory mapped files)
4000 0000: slot 32 space
[...]
0400 0000: slot 2 - filesys.exe
0200 0000: slot 1 - nk.exe
0000 0000: slot 0 - current process space

4.4 What is Execute-In-Place (XIP) and what does it mean for me?

Execute In Place is the ability for Windows CE to run applications (or operating system code) right in ROM. There is no need to copy the executable from ROM to RAM and run it - that would just waste time and memory.

As an application developer you should keep this in mind - who knows, Casio or HP might buy your application and, burn it into their next device, and sell it to the masses! So, don't write back to your executable or do anything else that would prevent your application from being ROM'd.

4.5 I want to make my own shell. Where should I start?

Try to beg, borrow or steal the Platform Builder v. 2.12. There is source for a simple Windows CE shell on CD 1. This code is an excellent starting point. Your shell will need to handle the battery monitor, resource checking and WM_HIBERNATE message generation.

BSquare has introduced a new development tool, Interface Composer, which allows the developer to create his own shell.  While I believe this product targets the embedded developer looking to implement a cool shell, it can also be used by the developer to create new, custom shells and skins for distribution to OEM device users.

4.6 Can I trash my object store by turning off the power during a file operation?

The Windows CE development team worked very hard to prevent this. The object store is based on a transactional model, complete with a transaction log tracking the most recent object store operations. If any catastrophe occurs, Windows CE can roll back the log to the last good point. In the case of an interruption during database or file delete, Windows CE can actually roll forward, continuing the operation.

See Inside Windows CE, chapter 4, for a good look at the design philosophy behind the object store.

4.7 How much stack space can I use per thread?

In Windows CE 2.0 the limit was 58K per thread. This was changed in 2.1 to be up to 1Mb (that's a big stack!) per thread. 2.1 also allows setting the stack size at compile time, but all threads in your application will have the same stack size.

4.8 Why does my Windows CE 2.0 stack blow out, even if I allocated it at compile time?

Unlike the desktop, Windows CE 2.0 only allocates application stack space as it is needed. This can cause problems if memory is nearly full and you are allocating on the stack. This was changed in CE 2.1.

4.9 What kind of limitations will I encounter using the CE Database?

Windows CE 2.11 and earlier are limited to 4 indexes. Wince 3.0 is increasing the limit to 8.

I assume you could technically have up to 2^32 records, since records are identified by CEOIDs, and since CEOID's are currently DWORDS. I did see a post online showing that the limit was around 16K records, but I have not verified this. 

However, if you are going to be dealing with more than 1500 records do not use the CE database system - it is really slow.

5. General Windows CE Development

5.1 I can't find an API that I need. What should I do?

When writing Windows CE applications, try to keep in mind the Win CE development team philosophy.  They took a look at the entire Win32 API and included only API's they felt they needed - for example, they would leave out an API if the same thing could be accomplished using three other existing API's.  In other words, if you find that an API is missing, first look around and say to yourself "how could I accomplish the same thing using other API's", since for the most part the Win CE team left out an API if they thought it could be implemented in another way.

Another thing to do is dumpbin /all coredll.lib in your sdk lib directory. There are plenty of API functions (over 2400 on the 2.11 pspc) and one may be just what you need. If you have Platform Builder you have access to the prototypes as well. For example, I just found SetWindowsHookEx, which appears to be similar to the desktop SetWindowsHookEx. The documentation says that SetWindowsHookEx is unavailable, but there it is in coredll.lib.

Also, if you want an API for the HPC 2.00 that isn't documented until 2.11, check the 2.00 coredll.lib anyway. It may be in there. Of course, there may be a reason it is undocumented (ie. it does not work!) so, again, use undocumented functions with care and test, test, test.

And finally, if the API is undocumented it may not be there in future versions. Rumor has it that Microsoft is making big changes to 3.0, and even if they are making little changes, you might get left out.

5.2 How can I insure only one instance of my application?

There are a few methods - the registry, FindWindow(), and CreateMutex().

You can store a value in the registry when your application starts, and remove it when your application terminates.  Unfortunately, if your application crashes is abnormally terminates, your registry value will not be removed.  When you go to run the first instance of your application again, it will see the registry entry and stop running. 

The FindWindow() method is the easiest to implement. In your InitInstance search for another instance of your application name, ie.

HWND hWnd=FindWindow(YOUR_WINDOW_CLASS, YOUR_WINDOW_TITLE);
if(NULL!=hWnd) {

SetForegroundWindow(hWnd);
return 0;

}

Here's some sample VB code you can use to find a window.  This sample assumes the window title is SampleForm.

Public Declare Function FindWindow Lib "Coredll" Alias "FindWindowW" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetLastError Lib "Coredll" () As Long

On Error Resume Next
Dim hWndX As Long

hWndX = FindWindow("Form1", "SampleForm")
If (hWndX <> 0) Then MsgBox "found it!"    '

If you are a VBCE user, you may want to consider creating a c++ launcher that checks for a previous instance of your application and changes focus to it if found.  You can then launch the vb application if it is not running.  As a side benefit, you can also create an icon to go with your vb application.   

Another technique is to use CreateMutex(). You first need to attempt to create a mutex and make sure it does not already exist. If the mutex does exist, you would post a registered message to all the top level windows to tell the application to move itself to the foreground, then close the current instance.

HANDLE hMutex=CreateMutex(NULL, TRUE, _T("YOUR_MUTEX_NAME_HERE"));

if(hMutex && ERROR_ALREADY_EXISTS==GetLastError()) {

// The app is already running
CloseHandle(hMutex);
return 0;

}

5.3 How can I make I application startup on system startup?

KEY_LOCAL_MACHINE\Init contains executables to run during device startup. Executables are listed under LaunchXX keys, where XX determines the run order to use. Another key, DependXX, allows specifying dependencies (ie. Launch50 can't run unless Launch40 was successful).

Create a new key under HKEY_LOCAL_MACHINE\Init named Launch60 (or anything greater than Launch50) , and supply the executable name to run. If you want the exe to launch only if the shell successfully started, create Depend60 and set the value to 32h (hex for 50).

An easier way to start an application on system startup is to put a link to your application in the \Windows\StartUp folder.

5.4 How can I prevent other applications from running while my application is active (how can I keep users from accessing the Start Menu)?

One technique is to disable the taskbar. Using FindWindow, get the handle to the taskbar window and disable it. When your program exits, make sure you enable it though! Also, a disabled taskbar makes it difficult to use the SIP. You may have to manually show/hide the SIP to work around this problem.

Here's an example:

HWND hTaskBarWnd = ::FindWindow(_T("HHTaskBar"), NULL);

if (hTaskBarWnd) {

::EnableWindow(hTaskBarWnd, FALSE);
::ShowWindow(hTaskBarWnd, SW_HIDE);

}

Note that this approach may cause the desktop to not redraw properly. If this is a problem, grab the desktop window and manually resize that as well, as follows:

HWND hDesktopWnd = ::FindWindow(_T("DesktopExplorerWindow"), NULL);

If (hDesktopWnd)

::SetWindowPos(hDesktopWnd, NULL, 0, 0, GetSystemMetrics(SM_CYSCREEN), GetSystemMetrics(SM_CYSCREEN) - 26, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);

Note that 26 is the task bar height. I suppose this could change so it may be a good idea to compute the taskbar height prior to resizing the desktop window.

5.5 How can I change task bar settings such as Auto Hide?

AutoHide and other task bar settings are contained in the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Shell in a value called TBOpts. TBOpts is a DWORD bitfield containing four entries:

#define MENUOPT_SHOWTIME 0x0001
#define MENUOPT_SHOWDATE 0x0002
#define MENUOPT_SHOWBANNER 0x0004
#define MENUOPT_AUTOHIDE 0x0008

Once you change the TBOpts value to show or hide various task bar settings you need to notify the task bar. The following:

SendMessage(hTaskBarWnd, WM_COMMAND, 0x3EA, 0)

Will notify the taskbar that changes were made and cause it to update accordingly.

5.6 How do I keep my device from auto-suspending?

One way to keep your device from auto-suspending is to issue a keyboard event every n minutes, such as:

keybd_event(VK_F24, 0, KEYEVENTF_KEYUP | KEYEVENTF_SILENT, 0);

If you are using VBCE, try the following:

Public Declare Sub keybd_event Lib "coredll.dll" (ByVal bVK As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

In the timer control event, type (7B is VK_F12 - you could use any character you like):

keybd_event &H7B, 0, 0, 0
keybd_event &H7B, 0, &H2, 0

Another suggestion is to open a socket and keep it open as long as you want the system to stay awake.

Finally, you can use SystemParametersInfo to set the timeout to 0, disabling it. For example,

SystemParametersInfo(SPI_SETBATTERYIDLETIMEOUT, 0, NULL, TRUE);

The problem I see with this approach is that if your application crashes or somehow manages to exit without putting it back to its previous value, the device will no longer timeout when idle. Even soft resetting the device would not fix the problem, so use this approach with care. When using this approach, the power settings in the control panel show the default settings, but the timeout never occurs.

There is also an undocumented API SetPowerOffHandler, but I have had no luck getting it to work. I can make the device start doing weird power related things, but not exactly what you would want to ship!

5.7 How do I detect power-on?

You can detect power on using WaitCommEvent and the EV_POWER mask. Open a serial port and wait for an EV_POWER event. When the event occurs send your application window a message letting it know that the power was turned back on.

SetCommMask(comportHandle, EV_POWER);
WaitCommEvent(comportHandle, &eventValue, NULL);
SendMessage(hwnd, WM_POWERON, 0, 0);

One caveat - opening the serial port turns on the serial hardware, which takes additional battery power. I don't have any hard numbers on the effect this technique has on battery life (yet).  Another caveat - this may interfere with other applications use of the serial port. Test carefully after implementing this power-on detection technique.

Another way to detect power on was discussed in the Windows CE Tech Journal, September 1999 issue. In the article, Jeff Spurgat described how device drivers receive power state change notifications, and how application developers can latch on to this functionality to receive power on notifications.

Basically, device drivers receive a powerup and powerdown message. Typically, a device driver will power up or power down their hardware based on this notification and return as quickly as possible without calling the kernel or any function that can cause a paging operation. In the article, Jeff simply sets a few global variables when the power state changes. He has a worker thread monitor the state of these variables once per second, and do a PostMessage if the poweron flag is true. Jeff provides sample code as well - both a working power detection driver and a sample application that works with the driver. You can download it here.

Finally, another interesting suggestion is to create an application thread with that fires a timer once every n seconds. Every time the timer fires, compare the current system time (GetSystemTime) with the last (saved) system time value. If the difference exceeds the timer interval the device has been suspended during the interval.

5.8 How can I programmatically turn off the device?

Windows CE treats the power button just like a keyboard key. Because of this, you can simply send a VK_OFF keystroke to the system and it will power off, just like you pressed the off button!

void SuspendDevice()
{

keybd_event(VK_OFF, 0, 0, 0); // down
keybd_event(VK_OFF, 0, 2, 0); // up

// code execution resumes on the next line...
MySampleFunction(); // runs when the device wakes back up...

}

By the way, VK_OFF is defined as 0xDF.

You can also use the PowerOffSystem function. This function is undocumented, so it may change or disappear at any time.

The undocumented function void PowerOffSystem(void) is declared in coredll.dll. It places the CE device in suspend state. However, when power is restored the user password dialog is not shown and the desktop and other windows are not redrawn. Code execution continues at the next line after the PowerOffSystem call.

You can invalidate all windows to get around the redraw problem, and you can also detect the 'prompt for password' state, and if required, display your own password dialog, and use CheckPassword to check the entered password against the user's password.

GwesPowerOff is another power API.  The GWES calls GwesPowerOff when suspending the device.  This may be a better approach than calling PowerOffSystem directly.   Check out http://support.microsoft.com/support/kb/articles/Q207/9/88.ASP for more information. [Thanks to Mike Burch for this tip].

Finally, see Suspending Your Device Programatically for an article and code samples discussing power off APIs.

5.9 How can I get battery status?

Use the GetSystemPowerStatusEx API, available under WCE 2.0 and greater.

5.10 How can I determine the device type?

Use SystemParametersInfo. There is an option SPI_GETPLATFORMTYPE which returns a string containing the platform.

BTW, HPC Pro devices return 'Jupiter'.

5.11 How can I determine the device name?

Note: This key may not be valid on all platforms. Check your platform

Check the registry key HKEY_LOCAL_MACHINE\Platform for a value named 'Name'. The value corresponds to the OEM specified device name. For example, on the casio e-100 it is Casio Jx530 CE2.11. One the Nino 312 it is Philips Version 1.

5.12 How can I initiate a connection to the desktop?

Do a CreateProcess or ShellExecuteEx using \windows\repllog.exe. ReplLog will start an activesync session with the desktop.

5.13 How can I tell if ActiveSync is currently running?

One hack is to do a FindWindow looking for repllog. If you find it, activesync is either running or attempting to connect.

5.14 How can I programmatically change the display brightness?

There is no standard API to change brightness (that I know of). Each OEM implements brightness controls in their own way. If you are interested in modifying brightness check with the OEM or if you can, inspect the OEM display driver.

5.15 How do I reboot/reset the device?

OEM's can optionally handle the IOCTL_HAL_REBOOT in OEMIoControl. However, applications cannot call OEMIoControl directly, but they can call KernelIoControl, which in turn calls OEMIoControl.

#include "winioctl.h"

BOOL KernelIoControl(DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned);
#define IOCTL_HAL_GET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)

KernelIoControl(IOCTL_HAL_REBOOT, &inVal, 4, outBuf, 1024, &bytesReturned);

If implemented by the OEM this function would perform a soft reset of the device. If you want to perform a hard reset, first call SetCleanRebootFlag.

Note that this did not work on the Casio E-100. Also, future versions of CE will implement SetCleanRebootFlag as a restricted function.

5.16 How can I change the size of the object store?

Note: these functions are documented only in Platform Builder, and are likely to be restricted in future versions of Windows CE.

The functions GetSystemMemoryDivision and SetSystemMemoryDivision allow you to change the relationship between memory and the object store.

The prototypes are:

BOOL GetSystemMemoryDivision(LPDWORD storePages, LPDWORD ramPages, LPDWORD pageSize);

DWORD SetSystemMemoryDivision(DWORD storePages);

The function returns SYSMEM_CHANGED if executed successfully.
The function returns SYSMEM_FAILED if storePages is out of range.
If SYSMEM_FAILED is returned, you can get further information by calling GetLastError.
If a reboot is necessary for the change to take effect, the function returns SYSMEM_MUSTREBOOT.
If a previous call returned SYSMEM_MUSTREBOOT, the function returns SYSMEM_REBOOTPENDING. In this situation, the boundary cannot be adjusted further until the reboot occurs.

You cannot shrink system memory or the object store memory beyond 256K each, including space for existing files and records.

5.17 How can I reprogram the buttons on the device? Can I use hardware buttons to initiate application functionality?

Check out the following API's:

RegisterHotkey
UnregisterHotkey
UnregisterFunc1 (undocumented)

Also, check out http://www.conduits.com/ce/dev/wince.htm and take a look at the keytest example - it contains code to actually do this.

5.18 I am writing a dialog based application. Why doesn't an entry appear in the taskbar or in the task list?

The taskbar only contains buttons for visible, top-level windows that have the WS_OVERLAPPED style. By default, dialog boxes have the WS_POPUP style and thus do not get taskbar buttons. The workaround is to change your dialog box style in the resource editor from WS_POPUP to WS_OVERLAPPED.

There was an interesting report from someone using PB 2.12. They did not want a taskbar button, and did not use WS_OVERLAPPED, but the taskbar button still appeared! Perhaps the default dialog/taskbar behavior has been changed in 2.12.

5.19 I want to modify the contact database. What is the contact database name or CEOID?

You should not attempt to modify the contact database directly, but instead use the API set supplied by Windows CE.

Check out OpenAddressBook, CreateAddressBook, CloseAddressBook, as well as AddressCard, GetAddressCardProperties, ModifyAddressCard, etc.

You may also want to check out the Pocket Outlook Object Model SDK, aka POOM SDK. POOM offers a simple interface into the contact, calendar and task database. You can download the POOM SDK at msdn.microsoft.com/cetools/platform/poomsdk.asp.

5.20 What is Venus?

Venus is produced by Chinese television manufacturer TCL. The Venus computer comes with a 56kb modem and a television interface, and runs the Windows CE OS. Venus provides easy internet access through the user's television. TCL plans to start selling Venus in October, and hopes to sell 300,000 units by the end of the first year.

5.21 What is Cedar?

Cedar is the codename for Windows CE 3.0. It should be release sometime around 2Q 2000. Cedar will contain lots of cool stuff, including more DirectX support, MSMQ, CEF.

5.22 When is MSMQ going to be available?

It will be released as part of Windows CE 3.0. MSMQ is ideal for wireless communications - think of it as transaction based messaging. If some of you information gets lost or mangled on the way to the server you can rollback to the beginning of the transaction.

Rumor has it you should expect Windows CE 3.0 out around 2Q 2000, so I guess you can expect MSMQ around the same time.

5.23 How do I get the time under CE - or, what happened to time()?

Use SYSTEMTIME and GetLocalTime instead, ie.

SYSTEMTIME st;
::GetLocalTime(&st);

5.24 How can I convert a pwi to an rtf?

For VCCE there is a document on MSDN named "Converting Rich Ink Data" that provides code for converting between .pwi and .rtf.

5.25 How can I determine whether the device has been rebooted/reset since the last time the application ran?

Check the registry key HKEY_LOCAL_MACHINE\Comm for the value BootCount. This value is incremented every time the device is soft-reset. If the device is hard reset the value is set back to one.

I received a report that this key isn't found on an HP620LX.  Perhaps it was not implemented in the HPC 2.0 OS.

5.26 How can I make a resource only DLL under Windows CE?

You need to define the entry point to the DLL. Just declare DllMain and have it return TRUE.

#if defined(UNDER_CE) && !defined(_WIN32_WCE_EMULATION)
#include <windows.h>
extern "C"
BOOL WINAPI DllMain (
HANDLE /*hInstance*/, // @parm handle of instance
DWORD /*dwReason*/, // @parm reason
LPVOID /*lpReserved*/ // @parm reserved
)
{
return TRUE; // ok
}
#endif

5.27 How can I determine the current SIP state?

GetSIPInfo allows you to determine the current SIP show state. Unfortunately, GetSIPInfo requires a UDT which is not available in VBCE 6.0. If you need to get the SIP show state from VBCE 6.0, get the vbceSoftKey control from www.cegadgets.com.

5.28 How can I change the current SIP state?

You can control the state of the SIP either using SipShowIM or by filling out the SIPINFO structure and using SetSIPInfo.

SipShowIM is handy because it can be used from VBCE 6.0. The prototype for SipShowIM is BOOL SipShowIM( DWORD dwFlags ), where dwFlags is either of the following:

#define SIPF_OFF 0x00000000
#define SIPF_ON  0x00000001

If you need to retrieve the current SIP display state from VBCE 6.0, get the vbceSoftKey control from www.cegadgets.com.  It is a good idea to query the current SIP state prior to showing it - you don't need to show it if its already up, and you do not want to hide it later if the user has chosen to show it.

SetSIPInfo is more robust - you can also determine the current show, hide state of the SIP, get the SIP rectangle size or the visible rectangle size.  Unfortunately, it is only availble from vcce (until the vbceSoftKey control is updated).

Another approach to showing and hiding the SIP involves finding the SIP window and manually showing or hiding it.  Note that this approach does not rely on aygshell.lib, which is nice if you want the same code to run on an hpc and pspc device.

// created by Dennis Berditchevsky
void UL_RaiseSIP(BOOL bRaise)
{
     // Find window class: "SipWndClass"
     CWnd *pWndKeyb ;
     if( pWndKeyb = CWnd::FindWindow(_T("SipWndClass"),NULL) ) {
          if( bRaise ) {
               if( !pWndKeyb->IsWindowVisible() ) {
                    pWndKeyb->ShowWindow(SW_SHOW);
                    bSipUp_Glob = TRUE; // show it. And not manually.
               }
          } else {
               if( bSipUp_Glob ) {
                    pWndKeyb->ShowWindow(SW_HIDE);
                    bSipUp_Glob = FALSE;
               }
          } //endif(bRaise)
     } //endif(pWndKeyb)
}

5.29 How can I enable or disable the Jot SIP?

You can enable/disable jot via the registry.

There is a registry entry under the Jot registry CLSID key called IsSIPInputMethod. Set this to 0 to hide the method, set it to 1 to show it. Apparently the SIP list displayer checks the registry entries every time it displays the list of available SIP because once you change the registry, the change automatically appears in the list.

The keyname is: HKEY_CLASSES_ROOT\CLSID\{6f311f80-4b14-11d1-ab08-006097490b17}\IsSIPInputMethod.

This method works with other SIPs as well. Just find the CLSID for the SIP you are interested in, change the IsSIPInputMethod to 0, and it will be disabled.

5.30 I need an ownerdrawn listbox but they are unsupported. What should I do?

Ownerdrawn listboxes are not supported under Windows CE. However, use can use a listview control to accomplish the same thing. The listview control can be ownerdrawn, can be set to checkbox style, and has a variety of display modes.

If you are using MFC, create a CListCtrl (either on a dialog via the resource editor or manually using create). Make sure you specify the LVS_OWNERDRAWFIXED style, then handle the DrawItem method. Check out CListCtrl for more information.

Also, if you want to add additional listview functionality, see ListView_SetExtendedListViewStyle. You can see styles like LVS_EX_FULLROWSELECT, which cause the entire row to be highlighted when selected, or LVS_EX_CHECKBOXES, which activates checkboxes on each line of the list view.

5.31 How can I implement a list view with a checkbox next to each item?

Create the listview control normally, then specify:

ListView_SetExtendedListViewStyle(hWnd, LVS_EX_CHECKBOXES);

This causes checkboxes to be displayed in the list control. To set and clear the checkboxes, use:

LVITEM lvi;
lvi.stateMask = LVIS_STATEIMAGEMASK;
lvi.state = UINT((int(isChecked) + 1) << 12);
::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi);

or if you are using MFC, use:

m_listCtrl.SetItemState(index, UINT((int(isChecked) + 1) << 12), LVIS_STATEIMAGEMASK);

5.32 What is POOM and should I use it?

POOM stands for Pocket Outlook Object Model, and represents a standard, easy to use interface into Contacts, Calendar and Tasks on your Windows CE device. Use this in place of modifying the contact, calendar or task databases directly, or even the AddressCard API.

You can download the POOM SDK at msdn.microsoft.com/cetools/platform/poomsdk.asp.

Along with offering basic access to Pocket Outlook, POOM offers some cool features like ReceiveFromInfrared and SentToInfrared, which will squirt the selected object(s) in/out the infrared port. It also allows you to work with cities on the device.

5.33 How can I programmatically launch a dial-up connection (without using the RAS API)?

Launch \windows\rnaapp.exe using CreateProcess or ShellExecuteEx. For example:

SHELLEXECUTEINFO shInfo;
memset(&shInfo, 0, sizeof(SHELLEXECUTEINFO));
shInfo.cbSize = sizeof(SHELLEXECUTEINFO);
shInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shInfo.lpFile = _T("rnaapp.exe");
shInfo.lpParameters = _T("-e\"work\" -m");
shInfo.lpDirectory = _T("\\windows");
ShellExecuteEx(&shInfo);

This will start the dial-up connection named work. If you need more control over the connection, use the RAS API.

5.34 How can I write or read a physical memory location?

Use VirtualAlloc and VirtualCopy to read or write to physical memory. VirtualAlloc is documented in the CE SDK help, and VirtualCopy is documented in the Platform Builder docs. The prototype for VirtualCopy is BOOL VirtualCopy ( LPVOID lpvDest, LPVOID lpvSrc, DWORD cbSize, DWORD fdwProtect ). VirtualCopy is defined in coredll.dll.

For example:

// PHYSADDR is the physical address of the peripheral registers
#define PHYSADDR ((PVOID)0x10000000)

#define SIZE (4800*4)
LPVOID lpv;
BOOL bRet;
lpv = VirtualAlloc(0, SIZE, MEM_RESERVE, PAGE_NOACCESS);
bRet = VirtualCopy(lpv, PHYSADDR, SIZE, PAGE_READWRITE | PAGE_NOCACHE);

// At this point lpv is a virtual address which maps the memory at PHYSADDR for SIZE bytes

I have had difficulty using this for access to other process slots - one suggestion was to use SetProcPermissions(0xFFFF) but I did not notice a difference. It may be that SetProcPermissions allow you to access other process slots using regular pointers, as opposed to VirtualAlloc/VirtualCopy.

There are a few quirks with VirtualCopy (ie. shifting bits of address, being on a page boundary). Check the docs for more information.

You could also investigate ReadProcessMemory/WriteProcessMemory.

Note that VirtualCopy, SetProcPermissions, ReadProcessMemory/WriteProcessMemory may  become restricted in future CE versions.

5.35 How can I enumerate Windows CE databases from the desktop?

Enumerating your windows ce device databases from the desktop is fairly straightforward.  Simply initialize the rapi interface, grab a handle to the first database and call CeFindNextDatabase until it returns zero.  Use CeOidGetInfo to retrieve information about the currently selected database. Don't forget to include rapi.h and make sure to link rapi.lib into your project.

Here's an example:

CString message;
CString workString;

m_listboxCtrl.ResetContent();

HANDLE dbHandle = CeFindFirstDatabase(0);    // find all db's
CEOID curDB;
CEOIDINFO ceInfo;
while (curDB = CeFindNextDatabase(dbHandle)) {

  ceInfo.wObjType = OBJTYPE_DATABASE;
  CeOidGetInfo(curDB, &ceInfo);
  workString = ceInfo.infDatabase.szDbaseName;

  message.Format("%s\t%i", workString, ceInfo.infDatabase.wNumRecords);
  m_listboxCtrl.AddString(message);

}

There is also an MFC example, wcedbtst, that covers much of the CEDatabase functionality, including reading/writing database records, so I didn't bother covering that here.  The CE RAPI functions I used above are available as part of the Win32 API.

And for more documentation, take a look at the source files shipped with MFC, even if you aren't using MFC .  There is quite a bit of code showing how to implement Win32 API functions, since that is how MFC is built.

5.36 I need to use IrDA to communicate with other devices. Where should I start?

Check out the IrDA article at: http://www.microsoft.com/mind/0599/wince/wince.htm. It gives a detailed explanation if IrDA and some interesting things you can do with it.

5.37 How can I show the wait cursor, especially from VBCE?

If you are using VBCE and want to show a waitcursor, try this code I found in the microsoft.public.vbce newsgroup, posted by Piet De Booser:

Following code works on a PPC but only on the device not in emulation.

Declare Function LoadCursor Lib "coredll.dll" Alias "LoadCursorW" (ByVal
hInstance As Long, ByVal lpCursorName As Long) As Long
Declare Function SetCursor Lib "coredll.dll" (ByVal hCursor As Long) As Long
Const IDC_WAIT = 32514

Function WaitCursor(bOnOrOff As Boolean) As Long

    If bOnOrOff = True Then
        hCursor = LoadCursor(0, IDC_WAIT)
    Else
        hCursor = LoadCursor(0, 0)
    End If
    WaitCursor = SetCursor(hCursor)
End Function

If you are using VCCE you can using the MFC CWaitCursor class, which works nicely, or just the straight SDK function:

SetCursor(SetCursor(LoadCursor(NULL, IDC_WAIT)); // set wait cursor
SetCursor(NULL); // remove wait cursor

You do not need to call DestroyCursor on the wait cursor. It is a shared cursor, and DestroyCursor is only used on cursors created with CreateCursor.

5.38 How can I print from a Windows CE application?

This code was posted online by Tim Fields of Field Software. Fieldsoftware produces an ActiveX print control. See www.fieldsoftware.com for more information. Note: I have not had a chance to try this code.

PAGESETUPDLG pgs;
memset((void*) &pgs,0,sizeof(PAGESETUPDLG));
pgs.lStructSize = sizeof(PAGESETUPDLG);

// pop up page setup dialog box
int rval=PageSetupDlg(&pgs); //fills pgs structure with current settings
if (rval==0) {
     // handle error..
}

// You can now get margin setting values from pgs structure

LPDEVNAMES lpDev;
lpDev=(LPDEVNAMES) GlobalLock(pgs.hDevNames);
BYTE *tbyte(BYTE *) lpDev;
TCHAR *pDeviceName, *pPort, *pDriverName;
pDriverName=(TCHAR*)(tbyte + lpDev->wDriverOffset);
pDeviceName=(TCHAR*)(tbyte + lpDev->wDeviceOffset);
pPort=(TCHAR*)(tbyte + lpDev->wOutputOffset);

// Get the printer DC!! This may pop up an additional printer dialog box
HDC hdc;
hdc=CreateDC(pDriverName,pDeviceName,pPort,NULL);
GlobalUnlock(pgs.hDevNames);

if (hdc==NULL) {
// handle error
}

// You now have your HDC...

// Lets get some values from the page dialog box
LPDEVMODE lpDevMode;
lpDevMode=(LPDEVMODE) GlobalLock(pgs.hDevMode);
if (lpDevMode==NULL) {
// handle error
}

// Get whatever DEVMODE info needed (orientation, paper size, etc)
CurOrientation=(lpDevMode->dmOrientation==DMORIENT_PORTRAIT);
CurIsColor=(lpDevMode->dmColor==DMCOLOR_COLOR);
CurPaperSize = lpDevMode->dmPaperSize;
CurHighPrintQuality = (lpDevMode->dmPrintQuality==DMRES_HIGH);

GlobalUnlock(pgs.hDevMode);

5.39 How do I register a control under Windows CE?

The easy way to register a control is to use regsvr2.exe, a GUI based registration tool. 

If you want to use regsvrce.exe, do the following:

Copy your control into the \windows directory on your device, run regsvrce passing the path and filename of the control as an argument.

For example, to register vbceSoftKeyboard.dll on a Palm Sized PC, you would do the following:

  • type run23 using the keyboard SIP. This will bring up the Run dialog (note- you may have to type run23 a couple of times before it comes up). Sometimes it helps to make the keyboard show, click on the taskbar, then type 'run23'.
  • Type 'regsvrce \windows\vbceSoftKeyboard.dll' and press OK.  Your control is now registered!

You may have to copy regsvrce.exe from your sdk 'target\mips' (or whichever processor you use) directory. 

5.40 I am having problems getting CE RAPI to work properly. What can I check?

Here's a few basic things you can check:

1. Are you sure RAPI is initialized properly?
2. Try to do a simple command, like cecopyfile, to make sure you've got communications working in your app.
3. Are you converting your strings to unicode?
4. Do you have vcce 5.0? under samples\win32 there is ceinvoke - both a client and server demo, that shows how to do this in block and stream mode.
5. Are you converting your strings to unicode? I mention this twice because it appears to be the leading cause of RAPI problems.  See the RAPI example mentioned below for an example of how to use UNICODE strings.

Finally, check Using CE RAPI to Communicate with Windows CE from the Desktop for more information and a few examples.

5.41 I want to create a mail message then send it. Can I do this using the Mail API?

The Windows CE Mail API allows you to add, modify and delete mail messages and mail folder names.  Using the Mail API you can enumerate all messages in any mail folder, change the recipient, subject, body or attachments, and update the entry in the mail store.

The Mail API does not allow for sending or receiving mail at this time. The documentation says that the Inbox acts as a mediator, which means that you can manipulate messages, but it is up to the Inbox application itself to send and retrieve mail.

While I have not tried this, one thing I can suggest is to look at the mail transport functionality. Check out the svcsampl example in  the HPC Pro SDK. It shows (in code) how a simple mail transport service is implemented.  You can also check the SDK documentation for functions like TransportInit, TransportConnect and TransportSend. It appears that pmail loads smtp.dll (the transport service dll) and calls these functions, using TransportSend to send one message at a time.

5.42 How can I display GIF, JPG, BMP, or XBM images in my application?

The easiest way to display images from your (VC) application is by using imgdecmp.dll. Unsupported Software has an article discussing imgdecmp along with some sample source code.

5.43 Why can't I display 16-bit images from my application using imgdecmp.dll?

Well, it turns out that it can!

Many people have difficulty getting 16-bit jpg images to display properly.  Apparently, the trick is to specify dii.iBitDepth = 24.  Imgdecmp.dll does not like 16 as the value.  The S309 control uses imgdecmp.dll and manages to produce 16 bit color images.

It does appear that SHLoadDIBitmap will display 16bit .bmp images. I believe this is what the shell (hence the SH once the front of the API) uses to load the desktop image.

5.44 What steps can I take to make my software ready for foreign markets?

First, take a look at the internationalization session video from the Windows CE DevCon 99, http://events.microsoft.com/isapi/events/pages.asp?s=63814&p=622. There are a lot of great tips on how to make your applications ready for foreign markets. Some of the suggestions include:

  • Place your strings, images, etc in a resource file and make this resource file a .dll. When you want to build an application for another market you will only need to include the new dll and will not have to recompile your application. 
  • Remember that English is a very compact language. Other language strings average 35% longer, with some string more than 2 to 3 times as long.
  • Not all currency symbols are one character (ie. KR for Swedish Krona)
  • Try to avoid culturally specific images. Images acceptable in your country may be embarassing/insulting in another culture.
  • Consider writing all of your strings in Pig-Latin. Pig-Latin is longer than English, so you will encounter string length issues sooner rather than later (and we all know the sooner you find a problem the easier/cheaper it is to fix).

Also, take a look at the NLS API set. It is easy to use and offers functions like GetDateFormat, GetTimeFormat, GetNumberFormat and GetCurrencyFormat.

Finally, if you are a Visual Basic developer you will notice that many of the NLS API functions use UDTs, which are not supported under VBCE 6.0. Take a look at vbceNLS, available on this site for free. vbceNLS allows the VBCE developer to access several NLS functions.

5.45 How can I open, change and delete mail messages?

Windows CE supplies a mail API that allows the Visual C++ developer to add, change and delete mail messages. If you want to work with the inbox under Windows CE you will need to use this API, since at this time POOM does not work with email.

Below is some sample code - it walks through the inbox mail messages and renames the subject line for any that start with 123, and delete the rest:

CString workString;
HANDLE hMail;
MailMsg curMsg;

if (MailOpen(&hMail, FALSE)) {

memset(&curMsg, 0, sizeof(MailMsg));
curMsg.dwFlags = MAIL_FOLDER_INBOX | MAIL_GET_BODY | MAIL_FULL;

BOOL status = MailFirst(hMail, &curMsg);
while (status) {

workString = MailGetField(&curMsg, _T("Subject"), FALSE);
if (workString.Left(3) == "123") {

workString = workString.Mid(4);
MailSetField(&curMsg, _T("Subject"), workString);
MailUpdate(hMail, &curMsg, TRUE);

   } else

MailDelete(hMail, &curMsg);

// prepare to read next message
MailFree(&curMsg);
curMsg.dwFlags = MAIL_FOLDER_INBOX | MAIL_GET_BODY | MAIL_FULL;
status = MailNext(hMail, &curMsg);

  }
  MailClose(hMail);

Make sure to free each mail message you open, and do a MailClose when you are done with mail. 

5.46 How can I use ATLCE to sink events?

Take a look at Ken Rabold's article Sinking COM Events with ATL CE for information on implementing connection points via ATL CE.

5.47 Do the Pocket Office applications support automation? Can I use them from VCCE, VBCE?

Pocket Office does not support OLE Automation, since Windows CE only supports in-process COM objects at this time.

5.48 I am using VBCE and need to call API functions that require structures, but UDT's are not available.  What can I do? What should I watch out for?

Antonio Paneiro has written an article showing how you can use strings to work around the lack of UDT support in VBCE.  Basically, you can populate the string in such a way to make its memory image match the reuired structure definition.  Take a look at http://www.vbce.com/articles/udt/index.asp

One thing to keep in mind: structure in C are often aligned to specific boundaries, for example:

typedef struct
{
    char c;
    short h;
    int n;
} TheHorror;

The internal representation of c = 0x77, h = 0x8899, n = 0xaabbccdd might be (assuming little endian): 77 00 99 88 dd cc bb aa, if aligned on 2byte boundaries or 99 00 00 00 99 88 00 00 dd cc bb aa, if aligned on 4byte
boundaries. [thanks to Russell Harper for this tip, posted on the windowsce vbce newsgroup].

5.49 How can I turn on the device when the serial port has activity?

You can use CeRunAppAtEvent to cause your device to wake up and run an application based on various events, including:

  • When data synchronization finishes
  • When a PC Card device is changed
  • When an RS232 connection is made
  • When the system time is changed
  • When a full device data restore completes

5.50 How can I start applications on device connect/disconnect?

See registry FAQ entry 3.1 How can I start applications on device connect/disconnect?

5.51 Do you have any tips on getting more out of HTMLView?

I personally have suffered at the hands of this dll.  While the dll works great for simple html rendering, you quickly run into trouble when trying to use it for more complicated purposes.  For example, I once attempted to implement a book reader using the html control.  It worked very well, but basic features like setting cursor position were not implemented.  I considered programmatically placing anchors in the HTML to allow navigation but ended up writing my own simple HTML parser/renderer instead.

Anyway, here is an excellent post from Craig Rairdin:

Download our free demo at www.laridian.com to see what we do with the HTML control. We use it for lots of stuff. The next version handles embedded images (.bmp, .jpg, .gif), sounds, and (soon) forms. That version isn't out yet.

Here are some code snippets from our class wrapper around htmlview.dll. You've messed with this enough to fill in any details I might accidentally leave out. You've discovered enough to catch some of the subtleties (some messages have to go to the child window, etc.) 

Here's the Copy operation:

// But, how to copy from the HTML window?  Experimentation has
// shown that if there is a child window, the WM_COPY should be
// sent to the child window.  If there is not a child window,
// the WM_COPY should be sent to this window.
HWND hwnd = GetWindow(m_hWnd, GW_CHILD);
if (hwnd != NULL)
  {
  SendMessage(hwnd, WM_COMMAND, 0x000156BA, 0);
  }
else
  {
  // On the PPC, there's no child window and this window seems
  // to accept WM_COPY
  SendMessage(m_hWnd, WM_COPY, 0, 0);
  }

Note: Copy does goofy things if you display text then resize the window then do a copy. It drops spaces out of the output.

Next, here's CopyAll (I don't think/remember if the getsel and setsel operations really work)

// If there is a current selection, remember it.
// LOWORD(selection) = start position
// HIWORD(selection) = stop position
DWORD selection = SendMessage(m_hWnd, EM_GETSEL, 0, 0);
// Select and copy all contents.
SelectAll();
BOOL CopiedSomething = Copy();
// Restore the prior selection.
SendMessage(m_hWnd,
  EM_SETSEL,
  (WPARAM)(INT) LOWORD(selection),
  (LPARAM)(INT) HIWORD(selection));
// Here's scroll up a line. Up, down, and moving by pages are similar:
HWND hwnd = GetWindow(m_hWnd, GW_CHILD);
if (hwnd != NULL)
  {
  SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, NULL);
  }
else
  {
  // On the PPC, there's no child window.
  SendMessage(m_hWnd, WM_VSCROLL, SB_LINEUP, NULL);
  }

Some other things we learned is that you can't capture Alt+Tap like the docs say you can. On some platforms you even get a menu of some kind when you do Alt+Tap but you can't do anything with it.

Handling the notification messages is pretty much just like the docs say. Like I said above, we handle hotlinks, pics, sounds and are working on forms.

We've talked to Microsoft at length about this .dll. We've concluded that they are embarrassed about it and don't want to talk about it. They have plans to do this better in 2.12 (they've ported IE4 to that platform). You'll be able to have lots more flexibility if/when any devices ship with that version of the browser. Htmlview.dll will go away and you'll have a much more powerful dll to work with.

5.52 How do I get the name of a ADOCE table if I only have an Table ID number?

This helpful post comes from Sandra Walters:

CDB files created with Pocket Access have several 'hidden' tables, among them are MSysTables and MSysFields, just like the Win32 version of Access. MSysTables includes a TableID and a TableName field in each record, which is
how Access relates the two together.

The readme that comes with ADOCE discusses this in detail with lists of fields in each.  I've had to write code to look up table names as well as field names and this document was very helpful.

5.53 How can I determine the amount of free space on storage cards, on the device and in memory?

Use GetDiskFreeSpaceEx to get information about storage card free space. For memory, check out GlobalMemoryStatus.

5.54 How can I disable the OK button on my Windows CE dialogs?

Try the following code in your dialog box:

ModifyStyleEx(WS_EX_CAPTIONOKBTN,0);
RedrawWindow();

5.55 Which common dialogs are supported under Windows CE?

Paul Yao (www.paulyao.com) is an author and Windows CE development instructor.  Below, Paul gives a list of supported and unsupported common dialogs.

There are eight common dialog boxes in Win32.  The File Find is not supported on CE (and therefore the MFC wrapper, CFileFind, would also not be supported).

Here are the eight. Y= supported on CE (at least on HPC); N= Not supported. Note that support for PsPC doesn't include File|Open, File|SaveAs - at least for version 1 of PsPC.

Dialog
HPC/HPC Pro
PSPC

File Open
Y
Y*

File Save
Y
Y*

Print
Y
Y

Print Setup
N
N

Find
N
N

Replace
N
N

Color Picker
Y
Y

Font Picker
N
N

* The PSPC platform displays a modified version of the file open and save as dialogs.  This version does not let you browse the entire file system, but restricts you to the storage card MyDocuments directory and the object store MyDocuments directory.

6. Palm Size Development Issues

6.1 If I don't implement an exit menu item, is there anything I can do to make closing the application easier?

While the Windows CE Pocket applications do not have an exit item, they do close based on the Ctrl-Q keyboard accelerator. Users can close applications by issuing Ctrl-Q from the input panel. It's not a standard or anything (at least I haven't heard about it) but it's easy to do and some people will try it.

6.2 Why should I pay any attention to WM_HIBERNATE?

Ahhh, the neglected WM_HIBERNATE message. The Windows CE shell sends this message when it sees resources running low, and applications are supposed to free resources, memory, and everything else possible short of closing. The shell actually can close applications if things get bad enough.

The WM_HIBERNATE message is actually part of a larger mechanism. The Windows CE shell watches resources based on a timer (the sample shell checks every 5 seconds). Every so often it will check the available resource level, and if the available memory drop below 224K it will send hibernates to all applications. If memory drops below 160K it will attempt to close background applications via WM_CLOSE. In the sample shell shipped with Platform Builder 2.12, the shell nicely sends a WM_CLOSE then waits 8 seconds. If the application still is not close it kills its process (not so nice)! Windows CE actually relies on the shell to close unused applications by sending WM_CLOSE.

Your application should be a good Palm Size Citizen. Free up lists, close files, etc when you receive WM_HIBERNATE. If you receive a WM_CLOSE message, don't show dialogs or other messages - close silently. And definitely do close, because as mentioned above, if you are not closed in 8 seconds the shell will kill you.

7. Common Executable Format (CEF)

7.1 What is CEF?

CEF stands for Common Executable Format. CEF is Microsoft's solution to the problem of multiple processor types.

CEF provides a single target format for Windows CE executable files. The first time a CEF file is executed on a CE device, CE converts the CEF file to native code. This conversion only occurs once and happens very quickly. The resulting code is native to the processor.

Microsoft's goal is to have the executable's performance be at least 80% of native, fully optimized code, and to be only about 20% larger than a native executable.

7.2 Can I use CEF in my current applications?

Get the Visual C++ Toolkit for Windows CE v. 6.01. One of the features added to this version is generation of CEF output.

7.3 Can I have a CEF based dll or ocx?

Yes. CEF will convert dll's and ocx's as well as exe's.

7.4 Why should I use CEF?

CEF's benefit is it's ability to run on any CE device, even ones that didn't exist at compile time.

Microsoft is (currently) committed to handling CEF on each new platform that comes into existence, so if you have an application built for CEF, that application will run on all current processors as well as new processors that come into existence after the product is shipped.

CEF greatly simplifies installation issues. Instead of producing a cab file for each platform type, produce one install set. Executables are converted on the platform once, prior to running.

7.5 Is CEF as fast as an application compiled for the platform?

No. Applications targeting the CEF format are not as heavily optimized as compilations targeting true native code. Microsoft engineers tried to make performance be at least 80% that of a native application.

7.6 If I am only targeting one specific device should I use CEF?

If you are certain that your application will only be run on one type of device (say a Casio PA2400) you should compile to produce native code for that platform. Compiling for native code produces a better optimized and smaller executable.

8. Installation

8.1 What install packages are available?

Windows CE installation packages usually automate the building of cab files, and provide a desktop CEAppMgr launcher. They hide the issues surrounding building ini files, processor codes, etc from you and let you focus on generating an install set.

Here is info on two installation toolkits:

InstallShield CE is a commercial installation package from the same company that dominates the desktop installation world. Their product is straightforward and easy to use, and they offer excellent support. They have a dedicated newsgroup installshield.ce.general which offers prompt support.

They also have a no questions asked return policy, or at least they did for me.

I returned the product because the CE toolkit is only half of what you will need to build a CE installer. You will also need the desktop version of Installshield. The CE version is $495, and the desktop version is between 600-700 dollars. So to build a CE installer using InstallShield be prepared to spend over $1100.

You can find out more about InstallShield CE here.

  • CuteInstall - download here!

Produced by AcerSoftTech in Shanghai, China, CuteInstall is a simple, easy to use install wizard for Windows CE. CuteInstall allows building install sets for all platforms and processor types.

CuteInstall is not as nice as InstallShield, and does not have the support. You are on your own if you need to produce setup dll's, etc.  Also, take a look at the following list, compiled by Nathan Lewis over at InstallShield. This is a list of CuteInstall's shortcomings:

1.  No localization capabilities.
2.  Does not support the "file flags" used for WinCE installations.
3.  Desktop-to-device installer does not provide any kind of scripting capabilities.
4.  Desktop-to-device installer does not provide access Win32 APIs.
5.  Has limited support for H/PC and P/PC devices.
6.  Does not support HPC Professional devices.
7.  Very little error checking done before compiling the INF file.

On the other hand, you should consider CuteInstall in the following situations:

1. shareware/freeware developer - low budget projects
2. someone that needs a simple installer
3. someone that wants to learn about inf/ini files

You will be able to produce an install more quickly using InstallShield than CuteInstall. However, I personally believe that developers should at least try CuteInstall before plunking down the cash for ISCE.  It's freeware, so the only thing they lose is a little time if it turns out not to be helpful.

You can download CuteInstall here.

This installation toolkit will not automatically build your cab files, but it does take care of building an installation tool, and it comes with source code. 

From the web page:

If you are a WinCE author and are looking for an inexpensive way to create / obtain a setup program, look at EZSetup! Once you have created your .cab files (as described in the WinCE SDK), you are ready to use EZSetup. EZSetup takes your .cab files and *outputs* a compressed, self-contained, self-extracting Windows setup program that will set up your WinCE software.

EZ-Setup is freeware and is released under the GNU Public License.

8.2 How do I programmatically open a cab file on a CE device?

Call \windows\wceload.exe using the .cab filename as the parameter, ie.

Wceload myapp.cab

8.3 How do I start an installation from the desktop?

If you are planning on writing your own installation package, you will need to launch the windows ce services application manager, CEAppMgr.exe. To do this, open the registry key

[SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\CEAPPMGR.EXE]

to get the application manager location, then launch the exe providing the installer .ini file as a parameter.

8.4 How can I keep a cab file from being erased after it is installed?

Cab files allow installations to be run directly from the device. The .cab file extension is associated with wceload, which unpacks and installs files contained in the .cab file. Unfortunately, wceload deletes the .cab file after the installation is complete.

You can set your .cab files to read-only to prevent this behavior. While this does not work on HPC 2.0 devices it does work on Palm Size and HPC Pro devices.

Installshield provides a workaround for the HPC problem for their registered users.

8.5 What command line switches are available for CeAppMgr?

With the help of a hex editor I took a look inside of CeAppMgr.exe.  I found the following possible command line switches:

/report - generates dialog boxes reporting the current install step status
/askdest
/noaskdest
/SilentInstall

Unfortunately, except for /report none of them appear to work. Perhaps the next version of CeAppMgr will implement this functionality. 

8.6 My install set is having trouble registering controls on Palm-Size PC devices. What am I doing wrong?

Many people have reported problems with their installation programs. Usually the installer would crash during registration of controls. Apparently wceload.exe on palm-size devices was not calling CoInitializeEx before starting the registration process. Microsoft has issued a fix for the problem, available at: http://support.microsoft.com/support/kb/articles/Q240/4/35.asp

8.7 How can I programmatically open a .CAB file?

Nathan Lewis of InstallShield posted this note regarding .cab files:

You're developing an embedded system, and since Microsoft doesn't provide WCELOAD for embedded systems you're wanting to roll your own, right?  If that is the case, you can start by looking at the "Wotsit's Format" web site (http://www.wotsit.org/  ) in the Windows section.  They have the source to a program that will extract the various files from the CAB.  But that's the easy part...

When CabWiz builds the CAB files, it does two things:  It compiles the INF into an undocumented format, and it renames all of the files in the CAB using the 8.3 format.  Any filenames that are shorter than 8 characters are padded with leading zeros, and any that are longer than 8 characters are converted to short filename format.  The extension for each file is also changed to use exactly three characters, from "000" to "999".  The compiled INF file is stored in the CAB with the "000" extension, and it contains the original filenames for all the other files.  The last file in the CAB always has the "999" extension, which seems to mean that you can never have more than 1,000 files in the CAB (including the compiled INF).

So the basic steps would be:

    1.  Extract the CAB to a temporary directory.
    2.  Parse the compiled INF (*.000)
    3.  Rename the files to their original names and install them.

The compiled INF is the only problem since it's not documented.  I guess you'll have to reverse engineer the file format.  You could start by creating a bunch of simple CAB files using CabWiz, then examine the "*.000" files to try and figure out how they're stored.

9. Help

9.1 What format is Windows CE Help in?

Windows CE help files are simple html files. There are two file extension types for windows CE help; .htc and .htp. The first, .htc, is the main link into your applications help system. Typically, this help file should be named myapp.htc, where myapp is the name of your application. You can use only one help file, or have links into other files. Other files can be named whatever you like, but is it probably a good idea to use a name related to your application, like myapp_config.htp, myapp_usage.htp.

9.2 How should I create help files?

The simplest way I have found is to enter text in Word for Windows, creating links using bookmarks and hyperlinks, then save it as an html file.

9.3 How can I programmatically launch help?

Call \windows\peghelp %1, where %1 is the name of the help file to open.

10. Internal/Undocumented/Hack Corner

10.1 Ways to explore Windows CE.

The Visual C++ Toolkit for Windows CE includes remote spy, remote registry editor and remote process viewer. Use these tools to find system window names, explore and tweak the registry, etc.

Here's a list of ways you can learn more about Windows CE:

  1. Use dumpbin on SDK library files to find out about exported functions
  2. Use dumpbin on emulator dll's to find out about hidden functions
  3. Use loadlibrary to load executable images from ROM into RAM, then write them out to a file and inspect them.
  4. Get Platform Builder - lots of cool stuff here!
  5. Use virtualalloc, virtualcopy to copy process spaces to disk then inspect.
  6. Download CCMemory and inspect memory directly on the device.
  7. Don't bother with GetROMFileBytes - it only works on files that are not XIP (as far as I can tell).

One other thing I found in the docs

"Most miscellaneous files are compressed (with the exception of a few fonts). Code and read-only sections for the executables and DLLs are uncompressed to enable execute-in-place. The read-write sections are compressed because they are destined for RAM, where they will be [de]compressed."

This means that you can dump the ROM to disk and files will be readable (non-compressed).  If you can figure out the ROM file structure you can have access to the entire system. Not only could you disassemble device drivers, but you could copy pocket office to the pspc and try it out.  I'll keep you posted on my progress.

10.2 Hack while you can - it will be harder soon.

Microsoft plans to tighten up security in its operating system by Windows CE 3.0. Certain functions, including VirtualCopy, SetProcPermissions, and other will be restricted to trusted applications only. Here's a brief list of functions that will be restricted:

AddEventAccess, CeSetThreadPriority, CeSetThreadQuantum, CreateAPISet, ForcePageout, GetKPhys, GiveKPhys, GwesPowerOffSystem, LocalAllocInProcess, LocalFreeInProcess, LocalSizeInProcess, LockPages, PowerOffSystem, RegisterAPISet., RemoteLocaleAlloc, RemoteLocalFree, RemoteLocalRealloc, RemoteLocalSize, SetExceptionHandler, SetGwesPowerOffHandler, SetInterruptEvent, SetKMode, SetPowerOffHandler, SetProcPermissions, SetRAMMode, SetSystemMemoryDivision, SetWDevicePowerOffHandler, SystemStarted, ThisIsGwes, UnlockPages, VirtualCopy, VirtualSetPageFlags.

10.3 BinaryCompress/BinaryDecompress - built in compression for windows ce

You can use BinaryCompress and BinaryDecompress to perform buffer compression. BinaryCompress will take a buffer and return a compressed buffer. BinaryDecompress will take a compressed buffer and turn it back into the original. BinaryCompress and BinaryDecompress are defined in coredll.

I assume the compression API uses the same compression as the object store. That compression is comparative - Windows CE compresses the buffer using several methods and takes the winner.

Remember that all files kept in the object store are compressed, so this is redundant if you are just storing data in a file on your device.

Here's an example:

DWORD BinaryCompress(LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout);
DWORD BinaryDecompress(LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout, DWORD skip);

TCHAR string[] = _T("The quick brown fox jumps over the lazy man who did not come to the aid of his country in time.");
BYTE buffer[1024];
BYTE inpBuffer[1024];

int length = BinaryCompress((BYTE*)string, wcslen(string) * sizeof(TCHAR), buffer, 1024);
BinaryDecompress(buffer, length, inpBuffer, 1024, 0);

AfxMessageBox((TCHAR*) inpBuffer);
CString message;
message.Format(_T("%i, %i"), wcslen(string), length);
AfxMessageBox(message);

In this example, the uncompressed buffer is 188 bytes and the compressed buffer is 148 bytes. Not the best, but it is free.

10.4 SetProcPermissions - give your process access to other processes!

This command will allow you to access memory in other process slots. It currently is available to all processes, but in future versions of CE it will be a restricted function.

The prototype is void SetProcPermissions(WORD procFlag). Each bit in the procFlag refers to a process. To get access to process slot 0, 1, 2 and 3 then procFlag would be 0x000F. To allow access to all processes set the flag to 0xFFFF.

10.5 RegFileCopy - make an instant copy of the registry

This is a great little command. RegFileCopy(filename) will write the registry out to the specified filename. It takes about 1 second on my Casio e-100. There is also a command RegRestoreFile that will restore a .reg file to the registry. I have not used this one yet (as of 9/6) so I cannot comment on its use, but you may want to check it out.

Unfortunately, the output file is not exactly text based. It does look pretty easy to parse, so you could write an application to convert it to text.

10.6 GetFSHeapInfo - pointer to object store in physical memory

Want to have some real fun, and possible really screw up your device? Try this little piece of code:

DWORD objStoreLoc = GetFSHeapInfo();
SetProcPermissions(0xFFFF);
#define SIZE (1024*1024*4)
BYTE* lpv;
BOOL bRet;
lpv = (BYTE*) VirtualAlloc(0, SIZE, MEM_RESERVE, PAGE_NOACCESS);
bRet = VirtualCopy(lpv, (void*)objStoreLoc, SIZE, PAGE_READWRITE | PAGE_NOCACHE);
if (bRet) {

CFile output(_T("\\outputImage.bin"), CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
output.Write(lpv, SIZE);

}
VirtualFree(lpv, 0, MEM_RELEASE);

This writes 4Mb of raw object store out to a file, which you can copy to your pc and proceed to inspect with a hex editor. Remember, all Windows CE buffers will be little endian. The file system is FAT based, too, so search for directory entries and proceed from there.

10.7 Predict.dll offers access to word prediction on Palm Size PC's

Palm Size PC devices use soft keyboards. The standard keyboard also uses a moderate dictionary to try and guess you next word. You can also use the prediction routines and access the dictionary.

Check out Predict dll and the following exported functions:

PredictGetTables
TrieIndexToWord
TrieInit
TriePrefixToRange

I do not have the prototypes yet.

You may also want to check out statdict.dat and dictprob.dat, two files apparently associated with the SIP dictionary gadget. I will post more info as I find it.

10.8 Inspect ROM on the Casio E-100 and find interesting things.

Curious about the internal workings of Windows CE? Want to see weird messages left by the developers, like Woo-hoo! Keyboard type is:  and discover hidden DLL exports like the ones used in jotcore1.dll - ZorroClose, ZorroOpen, ZorroTrain.

It is pretty simple once you know where to look. Lucky for us, EXE's in ROM are not compressed, since they are run in place (Note that they are not in PE format either, but in .bin format.  Check the PB docs for info on .bin format). I made a little program that grabs 4Mb chunks of memory and writes them out to files. I then copy the files to the desktop and read them with a hex editor, like HEdit or Hackman. The ROM image in combination with Platform Builder is a great insight into the working of CE.

Here's some sample code:

#define PHYSADDR ((PVOID)((0xbf000000)))
#define SIZE (1024*1024*4)

BYTE* lpv;
BOOL bRet;

lpv = (BYTE*) VirtualAlloc(0, SIZE, MEM_RESERVE, PAGE_NOACCESS);
bRet = VirtualCopy(lpv, (void*)PHYSADDR, SIZE, PAGE_READWRITE | PAGE_NOCACHE);
if (bRet) {

CFile output(_T("\\outputImage.bin"), CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
output.Write(lpv, SIZE)

}
VirtualFree(lpv, 0, MEM_RELEASE);

This code will write 4 Mb of ROM to a file in the root directory on your device. Simply copy this file to your desktop machine and use your favorite hex editor to review the contents of ROM.

10.9 SetWindowsHookEx really does work, sort of.

If you believe the Microsoft documentation, SetWindowsHookEx does not work under Windows CE. However, if you have read this FAQ you know that SetWindowsHookEx can be found in coredll (2.11 PSPC and HPC Pro versions only). The question is, what does it do, and is it a full implementation.

I have been wanting to write an ATL control that passes messages (like WM_HIBERNATE) to VBCE. One way to do this is to create an ATL control, implement a connection point, and install a windows hook that monitors the message queue, and whenever a relevant message appears, fires an event off to VB. Unfortunately, every combination of

gHook = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC) MyWndProc, gInstance, 0);

returned an error 87 (incorrect parameter). Further searching through the PB header files reveals only three hook-related defines: 

#define WH_JOURNALRECORD 0
#define WH_JOURNALPLAYBACK 1
#define WH_KEYBOARD_LL 20

So I stopped using WH_CALLWNDPROC and tried WH_KEYBOARD_LL, and found that it worked quite well. I actually implemented a hook callback that watched for VK_OFF, and when detected, waited 2 seconds before returning. Whenever I pressed the power button the device would indeed wait before turning off. I also attempted to abort the power off by returning a non-zero number from the hook callback. While this does prevent the power button from powering off the device, it also causes the device to crash. Besides, VK_OFF is only generated when the off button is pressed, and not when a device time-out occurs, so the code was of marginal use. However, if you need to trap other low-level keyboard commands (ctrl-esc, etc) SetWindowsHookEx might be for you.

While I imagine journal record and playback are implemented as well, I have not tried them.

10.10 Calstore.dll can be used to access the task database API set.

Calstore.dll manages access to various task database functionality. I could not find any documentation on the API offered by calstore on the device, but did find the list of exported functions in my Casio E-100 ROM.

ReplAppointmentFromOid
ReplDeleteAppointment
ReplDeleteTask
ReplGetCalendarObjectStore

ReplReleaseAppointment
ReplReleaseCalendarStore
ReplReleaseTask
ReplTaskFromOid

APPTGetMonthData
AdjustForBias
AdvanceRecurNoClone
AppointmentFromOid

CompleteTask
ConvertRenTzToSchedPlus
ConvertSchedPlusToRenTz
CreateAppointment

CreateTask
DeleteAppointment
DeleteTask
EditException

EnumAppointments
EnumExceptions
EnumRecurAppointments
EnumRecurAppointmentsEx

EnumRecurPattern
EnumTasks
ExceptionFromOriginal
FExceptions

FindAppointmentFromGlobj
FreeARI
GetAppointmentData
GetCalendarObjectStore

GetExceptionInfo
GetMinimumPeriod
GetMonthData
GetMonthDataEx

GetPatternStartTime
GetStartAndEndDate
GetTaskData
GetYearData

IsActiveTask
IsApptOid
IsException
IsMeetingUpToDate

IsOccurrenceSameDay
IsOidApptDbase
IsOidTaskDbase
IsOverlappingException

IsRecurring
IsRecurringTask
IsTaskOid
IsToday

MapPMailtoRenRecur
OidFromAppointment
OidFromTask
ReleaseAppointment

ReleaseCalendarStore
ReleaseTask
RenFromStdTimeZoneInfo
ReplSetApptAlarm

ReplSetTaskAlarm
ResetCache
SendAttendeesUpdate
SetAppointmentData

SetAttendeeCriticalChange
SetNextAlarms
SetSnapDate
SetTaskAlarms

SetTaskData
StartTasksEnum
StdTimeZoneInfoFromRen
StopTasksEnum

TaskFromOid
UpdateResponseEntry
WriteLastAlarmDate

The functions don't really do much good without the prototypes, but they are a starting place.

Another way to access calstore functionality is using the Pocket Outlook Object Model, or POOM. See 3.5 How can I work with Pocket Outlook data? for more information.

10.11 How can I reformat a compact flash card?

Formatting a compact flash card from your CE device is fairly straightforward, once you know a couple of key pieces of information.  First, you need to open the compact flash device using:

CreateFile(szVolume, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);

Next, you need to actually issues a format command to the device, as follows:

// hVolume is the file opened with createFile
// fv is FMTVOLREQ struct, which contains a DWORD
DeviceIoControl(hVolume, IOCTL_DISK_FORMAT_VOLUME, &fv, sizeof(fv), NULL, 0, &cb, NULL);

See Ben Beasley's source for a full compact flash formatter.

11. Known CE bugs

11.1 Createprocess on PSPC devices doesn't work

For some reason CreateProcess does not appear to work on palm-sized devices. Try ShellExecuteEx instead.

11.2 MFC CE 6.0 - Gettime with city set to foreign city. Returns 7/22/1863.

I came across this post and verified it on my e-100 as well.

The following code fails that worked previously in CE2.00 MFCs: (for Home
Cities outside the US).


CTime t = CTime::GetCurrentTime( );
int y = t.GetYear( ) // returns 1863 instead of 1999
I have traced it to CTime::GetLocalTm( ) returns a structure with tm_year
= -37
Likewise month, day and time information is incorrect in the structure.
It works for a Home City set in the World Clock to US Cities and a few
others in the world but fails when you choose cities in Australia and some
other countries. My guess is that some of the TimeZone information is not
stored for these cities and is causing GetLocalTm to fail. GetLocalTm did
not exist in previous versions of the CE MFCs. GetCurrentTime and GetYear
would previously work directly with the time value and not use GMT and time
zones.
Stephen Whitcher
Mobile Technologies Pty Ltd
Brisbane Queensland Australia (GMT+10:00 - no daylight saving)

11.3 The voice control will not write recordings to any filename except the default.

A recent post on microsoft.public.win32.programmer.wince discussed the fact the the voice recorder would not write the recording out to a user specified name, but always used the default. He was using the Casio E-100. He did the following:

::SendMessage(m_hWndVoice, VRM_RECORD, 0, (LPARAM) (LPTSTR)_T("\\myfile.wav") );

but the resulting filename was always "\\_tmp_file0.wav" (or incremented file1, file2, etc). Another person confirmed the problem and said he had given up using the voice control and gone straight to using the wave API's.

11.4 The 6.0 StrongArm compiler creates buggy code.

"Roman" posted this on the microsoft.public.windowsce newsgroup on 9/30/99:

The ARM compiler included with SDK version 12.00.8274.0 produces buggy code.  The ARM compiler included with 6.01 preview 12.10.8414 works well, and all bugs that found in (12.00.8274.0) appeared to be FIXED...

We compiled the SHA HASH algorithm - it failed with the old ARM compiler, but SH3, SH4, MIPS worked fine.  The CAST algorithm simple crashed the application. We tried with preview 6.01 compiler and found that it worked perfectly!

12. Windows CE Gossip Corner
12.1 PPTP will be available in 3.0 but not 2.12.

From Sebastion in the public.windowsce newsgroup, on 9/30/99: "PPTP support should come with Windows CE 3.0, but not with version 2.12. That's what I have heard yesterday from Microsoft."

12.2 A new grid control will be released soon

01/14/00 - I have heard that the grid control is nearly complete, and that a update for HPC/Pro users is available.  Microsoft is working on an HPC update as well, but it  is not quite ready yet.  If you are having problems with the grid control and are desperate, try sending a note to wcetwish@microsoft.com explaining your situation and asking for the update.

02/13/00 - Apparently an updated, more reliable grid control will be released within the next week or two, if things go as planned.  Finally!

12.3 The 2.12 version of Imgdecmp.dll supports 24-bit bitmaps.

I received a couple of comments suggesting that CE 2.12 version of imgdecmp.dll supports 24-bit color. The current imgdecmp.dll on OEM devices supports 8-bit color only.

12.4 When will VCCE 6.5 be released?

From Steve Maillet in the win32.programmer.wince group on 10/9: "[VCCE 6.5 is] not officially announced as of yet. but based on time frames in the past it was 6-8 weeks after PB was released. SO a couple months is what I expect."

SP3 support should be supported in the forthcoming VC++ toolkit for Windows CE V6.5.

Copyright CEGadgets.com 1998-2001. All rights reserved.
Microsoft and Windows are registered trademarks of Microsoft Corporation
No guarantee or warranty of any kind is offered for information, controls and software on this or any other CEGadgets page. Use at your own risk.

Windows CE Developers FAQ

Posted by krsuncom
개발이야기2007. 8. 1. 15:09

 

Wireless DevCenter: Microsoft Smartphone Tips and Tricks

Microsoft Smartphone Tips and Tricks

by Wei-Meng Lee
05/14/2004

There is so much an excellently designed smartphone can do. But without the software to power it, it's virtually useless. Since the launch of the first Orange SPV Microsoft smartphone in October 2002, there have been a host of new applications designed to run on this platform. In this article, I will show you some of the cool things you can do with your Microsoft smartphone.

Installing Applications

One point about installing an application for the smartphone: you can either use ActiveSync to install the application from your PC to your smartphone, or you can install it directly from the vendor's web site. Figure 1 shows how you can install an application using Pocket Internet Explorer. Simply go to the vendor's web site and click on the relevant link to download the file. Once you confirm the download, it will be installed on your smartphone automatically.


Figure 1. Installing an application through the Web

Easy, right? Now let's move to file transfer.

Transferring Files onto Your Smartphone

Sometimes you just need to transfer files (such as MP3 music files) onto your smartphone. There are a few easy ways to do that. You can either use the infrared port or use ActiveSync to do the job. I use ActiveSync most of time, as it is the most flexible method. Simply hook up your smartphone to your PC through ActiveSync and at the ActiveSync window, click on the Explore button (see Figure 2). You will then be able to explore the file system on your smartphone and drag and drop files as required.


Figure 2. Exploring the file system of your smartphone through ActiveSync

Photo Contacts

One application that is useful for your smartphone is the Photo Contacts application from PocketX Software. Using Photo Contacts, you can assign photos to your contacts in your address book (see Figure 3).


Figure 3. Assigning photos to your contacts

If your service provider supports caller identification, the photo of the caller will be displayed when your smartphone rings (see Figure 4).


Figure 4. Displaying the photo of the caller

World Time

Another useful application is the World Time application by The MadBeetle. Using the World Time (see Figure 5), you can view the time of 400 cities worldwide. City data includes:

  • Sunrise\sunset
  • GMT offset
  • Daylight savings
  • Analogue clock
  • The moon phase
  • Airport code
  • Dial Code
  • Longitude and Latitude

The World Time application is useful if you do a lot of travelling and need to check out the different time zones.


Figure 5. Using World Time to check on different time zones

System Utilities

If you constantly install applications and move files into and out of your smartphone, then you need an effective way to view the various resources on your smartphone. I've found Resco SystemToys for Smartphone to be a good choice.

Resco SystemToys allows you to check on your battery status, as well as the amount of memory remaining (see Figure 6). So the next time you want to install that favorite MP3 on your smartphone, check out the amount of available memory first.


Figure 6. Use Resco SystemToys to check the battery and memory status

Pocket TV

If you spend a significant amount of time on the road, then you will be glad that PocketTV allows you to play MPEG movies on your smartphone (see Figure 7).


Figure 7. Watching movies using PocketTV

You can download some free video clips from pocketmovies.net. I downloaded snippets of The Return of the King and played them on the MPx200. The playback was smooth and the sound of acceptable quality. So the next time you hit the road, be sure that you load your smartphone with the latest movie hits.

Media Player on Your Smartphone

Envy those people who have an iPod or a digital video player? Fret not; with a little investment, you can turn your smartphone into a music player. In fact, your smartphone already comes with the required software to play your music and video files (MP3s and WMA are supported). The only constraint that you probably face is storage. While the iPod supports storage of 4GB and above, your smartphone comes with a paltry storage space of about 10MB (this depends on your phone model). So you can literally forget about storing your music files on your smartphone.

Fortunately, this problem can be solved by buying an external storage card. For music- and video-playing purposes, I suggest you invest in at least a 128MB SD card. If budget allows, go for the largest in capacity -- 1GB (see Figure 8).


Figure 8. Invest in a large-capacity SD memory card

To copy CD music or videos onto your smartphone, you can use Media Player 9 (see Figure 9).


Figure 9. Using Windows Media Player 9 to copy your music or video onto your smartphone

Playing music on the smartphone is cool -- the sound quality is good and crisp. However, video playback using the smartphone Windows Media player is not fantastic -- screens tend to be jerky. The sound track of the video is good, but the video does not synchronize well with the sound. Even so, watching videos while you are on the train is still a good way to spend your time (see Figure 10).


Figure 10. Watching a video on my smartphone

Final Thoughts

One of the success factors for a platform is the amount of applications available for it. In my upcoming articles, I am going to dive more deeply into how to get more out of your smartphone. In the meantime, do share with us on your favorite applications on the smartphone.

'개발이야기' 카테고리의 다른 글

WM6 A2DP best settings here - xda-developers  (0) 2007.08.06
Windows CE Developers FAQ  (9) 2007.08.06
Bluetooth (A2DP)  (0) 2007.08.03
RegistryNotifyCallback  (4) 2007.07.31
The State and Notifications Broker Part I  (4) 2007.07.31
HTC Application Unlock Guide  (0) 2007.07.30
Posted by krsuncom
개발이야기2007. 7. 31. 16:46

원본 : 요기

RegistryNotifyCallback

Windows Mobile

Windows Embedded CE

6/12/2007

This function registers a transient notification request. It is used to request that the caller be notified by a specified callback when a specified value has been changed.

SyntaxSyntax

Copy Code

HRESULT WINAPI RegistryNotifyCallback(
  HKEY hKey,
  LPCTSTR pszSubKey,
  LPCTSTR pszValueName,
  REGISTRYNOTIFYCALLBACK pfnRegistryNotifyCallback,
  DWORD dwUserData,
  NOTIFICATIONCONDITION * pCondition,
  HREGNOTIFY * phNotify
);

ParametersParameters

hKey

[in] Handle to a currently open key, or a predefined root value.

pszSubKey

[in] The key under which the value is stored. If this value is NULL, pszValueName is assumed to be under hKey.

pszValueName

[in] The name of the value on which change notifications are requested. If this value is NULL, it indicates the default value.

dwUserData

[in] User data that will be passed back to the user with the notification.

pfnRegistryNotifyCallback

[in] A pointer to a function that will be called back when a notification arrives. For a prototype for this function, see REGISTRYNOTIFYCALLBACK.

pCondition

[in] Condition that determines when to send the notification. When the comparison between pCondition and the new registry value is TRUE, then a notification is sent. If this value is NULL, any change results in a notification.

phNotify

[out] Receives the handle to the notification request. This handle should be closed using RegistryCloseNotification when notifications on this key are no longer needed. Resetting the device also stops the notification.

Return ValueReturn Value

Value
Description

S_OK

Request for change notification is registered.

E_INVALIDARG

Invalid hKey, phNotify, or pfnRegistryNotifyCallback.

An error value returned.

Error value wrapped as a FACILITY_WIN32 HRESULT.

RemarksRemarks

The client will be notified of changes via the callback, which is executed on private thread separate from the thread that called RegistryNotifyCallback.

If the value does not exist at the time of the call to RegistryNotifyCallback, the client will be notified when the value is added.

To stop notification and to close the notification handle, the caller must call RegistryCloseNotification. However, this type of notification is transient. Resetting the device stops the notification.

This function can be used to monitor any registry key in the system. The header file snapi.h contains definitions for the registry keys, paths, values, and bitmasks for all the base notifications that are provided by the system.

If the notification to the callback function fails, the notification will be removed.

If the key specified by hKey and pszSubKey doesn't exist, then hKey is monitored until pszSubKey is created, after which pszSubKey is monitored and changes to the key will trigger notifications as requested. To minimize possible performance degradation stemming from a large nuimber of subkeys being monitored, it is a best practice to pass (as hKey) the handle to a key that's as close as possible to pszSubKey rather than passing a root key. For example, if the client is a game and it is monitoring the key structure HKEY_CURRENT_USER\...\MyCoolGame\Player1 and the game could later create HKEY_CURRENT_USER\...\MyCoolGame\Player2, two possible ways to approach notification of changes to the Player2 key include:

Potential performance degradation
Fewer potential problems

hKey = handle to HKEY_CURRENT_USER andpszSubKey=the full path to Player2

hKey = handle to HKEY_CURRENT_USER\...\MyCoolGame\ andpszSubKey=Player2

Code ExampleCode Example

The following code example demonstrates how to use RegistryNotifyCallback.

Note:

To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.

Copy Code

void AdjustPowerConsumption(HREGNOTIFY hNotify, DWORD dwUserData, const PBYTE pData, const UINT cbData);
// Register to be notified of changes to the eighth bit
// in SN_POWERBATTERYSTATE_VALUE. The eighth bit is set to one when 
// the battery is critically low (and set to zero and when it is not).
HRESULT RegistryNotifyCallbackExample()
{
    NOTIFICATIONCONDITION nc;
    HRESULT hr         = S_OK;
    HREGNOTIFY hNotify = NULL;
    // Initialize the notification structure.
    // The mask for the eighth bit.
    nc.dwMask = 0x8;
    // Receive a notification whenever that bit toggles.
    nc.ctComparisonType = REG_CT_ANYCHANGE;
    // dw is ignored for REG_CT_ANYCHANGE.
    nc.TargetValue.dw = 0;
    
    hr = RegistryNotifyCallback(SN_POWERBATTERYSTATE_ROOT, 
                                SN_POWERBATTERYSTATE_PATH, 
                                SN_POWERBATTERYSTATE_VALUE, 
                                AdjustPowerConsumption, 
                                0, 
                                &nc, 
                                &hNotify);
    // Close the notification using RegistryCloseNotification when done.
    // Note that it is alright to call RegistryCloseNotification from the callback function.
    // hr = RegistryCloseNotification(hNotify);
    return hr;
}
// This is the callback function.
void AdjustPowerConsumption(HREGNOTIFY hNotify, DWORD dwUserData, const PBYTE pData, const UINT cbData)
{
    DWORD dwCritical;
    HRESULT hr = S_OK;
    // pData contains the new value for SN_POWERBATTERYSTATE_VALUE.
    dwCritical = (*(DWORD*) pData);
    // Extract the eighth bit.
    dwCritical = dwCritical & 0x8; 
critically low.
    {
 your statements for preserving energy, here.
    }
    // The battery level was critically low, but it is not now.
    else
    {
        // Add your statements for returning to the normal battery state, here.
    }
}

Code ExampleCode Example

The following code example demonstrates how to register transient notification requests for phone StatStore values.

Note:

To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.

Copy Code

#include <regext.h>
#include "snapi.h"
const TCHAR c_szPhoneRegistryRootkey[]      = TEXT("System\\State");
const TCHAR c_szPhoneRegistrySubkey[]       = TEXT("Phone");
const TCHAR c_szPhoneSignalStrength[]       = TEXT("Signal Strength");
const TCHAR c_szPhoneIncomingCallerNumber[] = TEXT("Incoming Caller Number");
const TCHAR c_szPhoneStatus[]               = TEXT("Status");
#define MAX_NOTIF 3
enum NotifType
{
      SignalStrength = 0,
      IncomingCallerNumber,
      PhoneRoaming
};
HREGNOTIFY g_hRegNotify[ MAX_NOTIF ] ;
// The call-back function for Registry Notifications.
void RegistryNotifyCallbackFunc(HREGNOTIFY hNotify, DWORD dwUserData, const PBYTE pData, const UINT cbData)
{
    TCHAR szOutput[MAX_PATH];
    // Identify the Notification received, based upon the User Data passed in, while registering for the notification.
    switch( dwUserData )
    {
        case SignalStrength:
            StringCchPrintf(szOutput, MAX_PATH, _T("The Signal Strength is %d"), (DWORD) *pData);
            break;
        case IncomingCallerNumber:
            StringCchPrintf(szOutput, MAX_PATH, _T("The Incoming Caller Number is %s"), (TCHAR*)pData);
            break;
        case PhoneRoaming:
            {
                  DWORD dw = 0;
                  // Copy the data sent to us into a local buffer.
                  memcpy(&dw, pData, cbData);
                  // Find out if the roaming status has been set by logically ANDing the data with the value 512 (the bitmask for roaming).
                  StringCchPrintf(szOutput, MAX_PATH, _T("The Roam Status of the Phone is %s"), ( dw & SN_PHONEROAMING_BITMASK ) == SN_PHONEROAMING_BITMASK  ? _T("TRUE") : _T("FALSE")  );
            }
            break;
        default :
            break;
    }
    OutputDebugString( szOutput );
    return;
}
void RegisterForPhoneNotifications()
{
    HKEY hKey;
    // Let us open the registry to get a handle to the Phone Registry key.
    if (S_OK == RegOpenKeyEx(HKEY_LOCAL_MACHINE, c_szPhoneRegistryRootkey, 0,  KEY_QUERY_VALUE, &hKey))
    {
    // Since we are registering for multiple notifications, let's pass some unique User Data for each notification ( 5th param ), 
    // which will help us identify the notification in the Call Back.
     // Let us register for Signal strength notifications.
     HRESULT hr = RegistryNotifyCallback(hKey, 
                                         c_szPhoneRegistrySubkey,
                                         c_szPhoneSignalStrength,
                                         RegistryNotifyCallbackFunc,
                                         SignalStrength,
                                         NULL,
                                         &g_hRegNotify[ SignalStrength ] );
        
    // Let us register for Incoming Caller Number notifications.
            hr = RegistryNotifyCallback(hKey, 
                                        c_szPhoneRegistrySubkey,
                                        c_szPhoneIncomingCallerNumber,
                                        RegistryNotifyCallbackFunc,
                                        IncomingCallerNumber,
                                        NULL,
                                        &g_hRegNotify [ IncomingCallerNumber ] );
    //  Let us register for Roaming status change notifications.
            hr = RegistryNotifyCallback(hKey, 
                                        c_szPhoneRegistrySubkey,
                                        c_szPhoneStatus,
                                        RegistryNotifyCallbackFunc,
                                        PhoneRoaming,
                                        NULL,
                                        &g_hRegNotify [ PhoneRoaming ] );
        RegCloseKey(hKey);
      
    }
}
void  CloseAllNotifications ()
{
     for (int i = 0; i < MAX_NOTIF; i++)
    {
            RegistryCloseNotification(g_hRegNotify[i]);
    }
}

RequirementsRequirements

Header
regext.h

Library
aygshell.lib

Windows Embedded CE
Windows Embedded CE 6.0 and later

Windows Mobile
Pocket PC for Windows Mobile Version 5.0 and laterSmartphone for Windows Mobile Version 5.0 and later

See AlsoSee Also

Reference
REGISTRYNOTIFYCALLBACK Structure
RegistryBatchNotification
State and Notifications Broker Functions
State and Notifications Broker Reference
Concepts
Using the State and Notifications Broker in Native Code
Other Resources
State and Notifications Broker

 

RegistryNotifyCallback

Posted by krsuncom
개발이야기2007. 7. 31. 16:03

원본 : 요기

The State and Notifications Broker Part I

Jim Wilson
JW Hedgehog, Inc.

February 2006

Applies to:
   Microsoft .NET Compact Framework version 2.0
   Microsoft Visual Studio 2005
   Windows Mobile 5.0

Summary: In this month's column, Jim introduces the State and Notifications Broker and its role in enabling applications to work more closely with the Windows Mobile platform. The discussion covers the underlying architecture of the State and Notifications Broker, the use of the State and Notifications Broker API to retrieve more than 100 different state values, and how an application can cooperate with the State and Notifications Broker to receive notifications about changes to important state values, such as a change in network availability. This column covers both native and managed code usage of the State and Notifications Broker API.

This month's column is part one of a two-part examination of the State and Notifications Broker and is the first in a series of many deep-dive discussions about the new features Windows Mobile 5.0, the .NET Compact Framework 2.0 and Visual Studio 2005 provide. (20 printed pages)

Contents

Introduction
Getting Started with the State and Notifications Broker
Retrieving Windows Mobile State Information
Receiving Notifications
Conclusion

Introduction

As I mentioned in my previous column, A View of Windows Mobile 5.0 from 10,000 Feet, we are going to spend the next several months taking a detailed look at the new features that Windows Mobile 5.0, Visual Studio 2005, and the .NET Compact Framework version 2.0 offer developers. This first article in the series provides a detailed look at the Windows Mobile 5.0 State and Notifications Broker API.

I have to say that choosing the first feature to investigate was actually easier than I thought. I'm not saying that Windows Mobile 5.0, Visual Studio 2005, and the .NET Compact Framework 2.0 don't offer a lot of great new features—they certainly do. But the State and Notifications Broker API is one of those APIs that literally opens up a whole world of opportunities. Common situations that have historically been difficult to deal with programmatically become quite easy to manage—such as detecting changes in network connectivity, locating the Pocket Outlook contact that corresponds to the incoming caller, or determining that the device battery has become critically low. Similarly, situations where you have an application that needs to publish changes in the application's state or share data with other applications become significantly easier with the State and Notifications Broker API.

The State and Notifications Broker API offers too many features to cover in a single edition of this column, so I'm going to divide this discussion about the State and Notifications Broker API into two parts. In part I, we'll look at using the State and Notifications Broker API to more closely integrate your applications with the device and built-in Windows Mobile applications. In part II, we'll discuss using the State and Notifications Broker API in some more advanced situations, and we'll also look at how to expose state information from your own applications.

Getting Started with the State and Notifications Broker

As the name implies, the State and Notifications Broker provides two services. First, it acts as a central repository for state information without regard for the source of that information. Second, it provides a standard architecture for monitoring those state values for changes and distributing change notifications to the list of interested parties. Fundamentally the State and Notifications Broker is a data store that provides a standardized publish-subscribe model for distributing data change notifications. Don't let this simple definition fool you. The State and Notifications Broker is a very powerful tool.

With the State and Notifications Broker, Windows Mobile 5.0 changes a smart device from a device that simply runs a bunch of independent applications to a holistic platform where applications can easily share information and respond to changes in the device's state and to the state of other applications. The State and Notifications Broker provides the user with a high degree of continuity between individual applications and creates a device that, in a sense, runs a single meta-application made up of the best features of the individual applications that run on the device.

Remember that the State and Notifications Broker and the corresponding API, the State and Notifications Broker API, are part of the Windows Mobile 5.0 platform and, therefore, require you to install Visual Studio 2005 and the Windows Mobile 5.0 SDK for Pocket PC or Smartphone on your desktop computer.

Note   See the Windows Mobile 5.0 Developer Tools section in last month's column for the complete list of downloads and installations that are required to develop Windows Mobile 5.0 applications.
Locating the State and Notifications Broker API SDK Files

The exact location of the Windows Mobile 5.0 SDK on your desktop computer depends on which Windows Mobile 5.0 SDK you've installed. If you install the Windows Mobile 5.0 SDK for Smartphone and accept the default installation path, the SDK files are installed in \Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\. If you install the Windows Mobile 5.0 SDK for Pocket PC, you need to substitute Pocket PC for Smartphone in the previous path. With the Windows Mobile 5.0 SDK installed on their desktop computers, both managed-code and native-code developers have everything they need to use the State and Notifications Broker API.

The classes that are contained in the Microsoft.WindowsMobile.Status assembly expose the State and Notifications Broker API to managed-code developers. With the Windows Mobile 5.0 SDK installed, you can add a reference to the assembly by simply selecting it from the Add Reference dialog box in Visual Studio 2005, as shown in Figure 1.

Note   The Microsoft.WindowsMobile.Status assembly relies on types that are defined in the Microsoft.WindowsMobile assembly; therefore, anytime you add a reference to Microsoft.WindowMobile.Status to a project, you must also add a reference to Microsoft.WindowsMobile. Failing to do so will result in build errors.

Click here for larger image

Figure 1. Adding a reference to the Microsoft.WindowsMobile.Status assembly. Click the thumbnail for a larger image.

If you want to spelunk through the contents of the assembly by using a tool like ildasm or Reflector (for more information, see the Lutz Roeder's Programming.NET Web site), you need to open the assembly file directly, which you can find in the Designtimereferences subfolder of the Windows Mobile 5.0 SDK installation folder. All classes that are contained in the Microsoft.WindowsMobile.Status assembly are part of the "Microsoft.WindowsMobile.Status" namespace.

Native-code developers access the State and Notifications Broker API functions and structures by including the regext.h header file. This header file and other Windows Mobile 5.0 header files are located in the \Include\Armv4i subfolder of the Windows Mobile 5.0 SDK installation folder. The State and Notifications Broker API functions are all implemented in the aygshell.lib library. Visual Studio 2005 generated projects that target the Windows Mobile 5.0 platform automatically link to this library, so in most cases, you won't have to add the aygsell.lib file to the project libraries—because it will already be there.

Retrieving Windows Mobile State Information

As I mentioned previously in this article, one role of the State and Notifications Broker API is to provide unified access to state information. This information provides one-stop shopping for all of your system state needs. The Windows Mobile 5.0 platform ships with over 100 state values that the State and Notifications Broker tracks. These values relate to both the state of the device itself and the state of standard Windows Mobile 5.0–based applications such as Pocket Outlook.

Examples of system-wide state values include the following:

  • ActiveSync status
  • Whether a camera is present
  • Number of Bluetooth connections
  • List of current network connections
  • Whether a headset is connected
  • Whether a keyboard is connected
  • Display orientation
  • Battery strength
  • Outlook Mobile contact that corresponds to the current caller on the phone

Examples of per-user state values include the following:

  • Names of the currently active and previously active applications
  • Next calendar appointment
  • Media player information including current track title, artist, and album
  • Name of the Outlook Mobile e-mail account and number of unread e-mail messages
  • Name of short message service (SMS) account and number of unread SMS messages
  • Number of missed phone calls
  • Number of active tasks and number of overdue tasks

As you can see, the list of state information that the State and Notifications Broker tracks is quite comprehensive. In addition to more than 100 standard state values, original equipment manufacturers (OEMs) are free to add more values.

If you've been working with Windows Mobile–based devices for a while, you might notice that several of the listed state values are available from other APIs. For example, you can determine the current display orientation by calling the GetSystemMetrics function or by checking the Screen.PrimaryScreen.Bounds property if you are using managed code. Similarly, you can retrieve the current battery strength by calling the GetSystemPowerStatusEx method. And of course, information regarding the Calendar and Tasks is available through the Pocket Outlook API.

With these existing APIs, you may wonder why the State and Notifications Broker API has been added. As you'll see, there are a number of reasons, but one of the most notable is that the State and Notifications Broker API provides a single source for retrieving all state information. It is no longer necessary to hunt down a separate function or API for each individual state value. Also, prior to the introduction of the State and Notifications Broker API, determining a specific state value often required several function calls—and sometimes additional logic. With the State and Notifications Broker API, each state value is available through a single function call (in the case of native code) and as a single property value (in managed code).

The underlying implementation of the State and Notifications Broker uses the registry as the data store. All system-wide state values are stored under the HKEY_LOCAL_MACHINE\System\State registry key, and per-user state information is stored under the HKEY_CURRENT_USER\System\State registry key.

Under each of these registry keys, there are multiple child keys. Each child key has one or more values. These values hold the actual state information. Figure 2 shows the contents of the HKEY_LOCAL_MACHINE\System\State registry key on the Windows Mobile 5.0 Smartphone emulator.

Click here for larger image

Figure 2. State registry keys on the Windows Mobile 5.0 Smartphone emulator. Click the thumbnail for a larger image.

Accessing State Values from Native Code

With the information for the State and Notifications Broker being stored in the registry, you can easily access the information by using standard registry functions like RegOpenKeyEx and RegQueryValueEx. The following code example shows how to retrieve the name of the phone's service operator with native code by using these functions.

Copy Code

HKEY hPhone;
TCHAR tszOperatorName[1024];
DWORD dwType;
DWORD dwSize = sizeof(tszOperatorName);

RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("System\\State\\Phone"),
             0, 0, &hPhone);
RegQueryValueEx(hPhone, _T("Current Operator Name"), 0, &dwType,
               (BYTE*)tszOperatorName, &dwSize);

This code uses the RegOpenKeyEx function to open the HKEY_LOCAL_MACHINE\System\State\Phone registry key and then retrieves the operator name from the key's Current Operator Name value using the RegQueryValueEx function.

If you've done some work with the registry, you know that this pattern of opening a key and then accessing a value is common. With the introduction of the State and Notifications Broker, this pattern of access will likely become even more common. As a result, to simplify accessing registry values, the State and Notifications Broker API introduces two new functions: RegistryGetString and RegistryGetDWORD. Each function encapsulates both opening a key and accessing a value. The two functions behave exactly the same; they are just specialized for retrieving either string or DWORD values. The following example retrieves the phone service operator this time by using the RegistryGetString function.

Copy Code

TCHAR tszOperatorName[1024];
RegistryGetString(HKEY_LOCAL_MACHINE, _T("System\\State\\Phone"), 
    "Current Operator Name", tszOperatorName, sizeof(tszOperatorName));

As you can see, this code example is much simpler than the previous code example because it requires only a single function call and avoids the need to declare the extra variables that the RegOpenKeyEx and RegQueryValueEx functions require.

One of the biggest challenges in working with the State and Notifications Broker API in native code is keeping track of all of the registry key and value names. With more than 100 standard state values in the State and Notifications Broker, there are also more than 100 registry key and value name combinations. You also need to keep track of whether the registry key that corresponds to the state value of interest is located under the HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER registry key. Thankfully, you can find the list of standard state values that the State and Notifications Broker API tracks and the corresponding registry information in the State and Notifications Broker Base Properties help topic within the mobile5sdk.chm help file, which is located in the Help subfolder of the Windows Mobile 5.0 SDK installation folder.

Note   The easiest way to locate the help topic is to open the mobile5sdk.chm file and search for the string "State and Notifications Broker Base Properties". At the time I wrote this article, there is a version of the State and Notifications Broker Base Properties help topic located in the MSDN Library, but it didn't include the registry key and value names.

The documentation is a great help, but with the registry key names and value names being strings, there's no way to know about any error that might exist in the registry key or value name strings at compile time. Instead, the program will fail at run time. To avoid this failure, the State and Notifications Broker API provides a header file, snapi.h, that provides a complete list of #define values for the standard State and Notifications Broker API state values. The #define values include the root key, the key name, and value name for each state value. The following code example is the portion of the snapi.h header file that corresponds to the phone service operator state value.

Copy Code

///////////////////////////////////////////////////////////////////////
// PhoneOperatorName
// Gets the name of the mobile operator (i.e., the mobile phone 
// company, or carrier).
#define SN_PHONEOPERATORNAME_ROOT HKEY_LOCAL_MACHINE
#define SN_PHONEOPERATORNAME_PATH TEXT("System\\State\\Phone")
#define SN_PHONEOPERATORNAME_VALUE TEXT("Current Operator Name")

The following code example shows accessing the phone service operator, this time by using the provided #define values instead of the literal strings.

Copy Code

TCHAR tszOperatorName[1024];
RegistryGetString(SN_PHONEOPERATORNAME_ROOT, SN_PHONEOPERATORNAME_PATH, 
    SN_PHONEOPERATORNAME_VALUE, tszOperatorName, 
    sizeof(tszOperatorName));

Using the #define values rather than literal strings makes the code easier to read and, in the event that there are any errors in the #define value names, the compiler reports them.

Working with DWORD Values and Bitmasks in Native Code

When accessing DWORD state values you use the RegistryGetDWORD function rather than the RegistryGetString function of course, but there's also a little more to it. Let's take a look at the #defines values for two state values in the snapi.h header file: Phone Multi-Line and Phone Radio Present.

Copy Code

///////////////////////////////////////////////////////////////////////
// PhoneMultiLine
// Gets a value indicating whether the phone supports multiple lines.
#define SN_PHONEMULTILINE_ROOT HKEY_LOCAL_MACHINE
#define SN_PHONEMULTILINE_PATH TEXT("System\\State\\Phone")
#define SN_PHONEMULTILINE_VALUE TEXT("Multiline Capabilities")

///////////////////////////////////////////////////////////////////////
// PhoneRadioPresent
// Gets a value indicating whether the mobile device has a phone.
#define SN_PHONERADIOPRESENT_ROOT HKEY_LOCAL_MACHINE
#define SN_PHONERADIOPRESENT_PATH TEXT("System\\State\\Phone")
#define SN_PHONERADIOPRESENT_VALUE TEXT("Status")
#define SN_PHONERADIOPRESENT_BITMASK 32

In the case of Phone Multi-Line, a single function call accesses the DWORD value very much like accessing a string state value, as shown in the following code example.

Copy Code

DWORD dwPhoneMultiLine;
RegistryGetDWORD(SN_PHONEMULTILINE_ROOT, SN_PHONEMULTILINE_PATH, 
    SN_PHONEMULTILINE_VALUE, &dwPhoneMultiLine);

By looking at the Phone Multi-Line #define values, you can see that the state value is stored in the MultiLine Capabilities value of HKEY_LOCAL_MACHINE\System\State\Phone. A quick look at Figure 3 shows that the state value is 1. As a result, the call to the RegististryGetDWORD function in the previous code example returns 1, indicating that the phone on the current device—in this case is the Windows Mobile 5.0 Smartphone emulator—supports multiple lines.

Click here for larger image

Figure 3. The Phone state values viewed with regedit.exe. Click the thumbnail for a larger image.

Note   In the case of the Windows Mobile 5.0 Smartphone emulator, the radio is a fake radio with service provided by Fake Network. From a programming standpoint, this emulator provides all of the characteristics of having a phone radio, so attempts to make a phone call or to check the status of the radio appear to succeed when, in reality, no phone actually exists. This fake radio is very useful for developing and initial testing of phone-related applications without incurring the cost of placing a mobile phone call or acquiring a device.

For the Phone Radio Present state value, the #define values show that it is stored in the registry value Status under the same key as Phone Multi-Line. If you look at Figure 3 again, it shows that the value stored in the registry for Status is 9437344. This value may look strange and certainly doesn't seem to apply to whether or not the device has a radio.

Unlike the registry value MultiLine Capabilities, which stores a single state value, Status actually stores multiple state values, and each state value is represented as a separate bit. To access the specific state value of interest, you must apply a bitmask. In the case of the Phone Radio Present state value, that bitmask is contained in the #define value SN_PHONERADIOPRESENT_BITMASK. The following code example shows using the bitmask to determine if the current device has a phone radio.

Copy Code

DWORD dwValue;
RegistryGetDWORD(SN_PHONERADIOPRESENT_ROOT, SN_PHONERADIOPRESENT_PATH, 
                 SN_PHONERADIOPRESENT_VALUE, &dwValue);
  BOOL bPhoneRadioPresent = dwValue & SN_PHONERADIOPRESENT_BITMASK;

As you can see, the initial value is still retrieved from the registry by using the RegistryGetDWORD function, but the additional step of applying the bitwise AND operator to the returned value is required to see if the bit corresponding to the state value Phone Radio Present is set.

Not all DWORD state values that require a bitmask are Boolean values. In some cases, a single DWORD is used to store two smaller ranged state values—as in the case of the Main registry value under HKEY_LOCAL_MACHINE\System\Status\Battery. This one registry value represents both the battery strength level and the battery state. These two state values also demonstrate another important issue: these values are enumerations. As enumerations, they each represent a finite set of values. The thing that I find frustrating is that the current implementation of the State and Notifications Broker API doesn't provide any corresponding C/C++ enum declarations or #define values. So you can either place the literal values in your code—leaving anyone who must later support that code to figure out what they mean—or you can provide your own #define declarations. The mobile5sdk.chm help file topic, State and Notifications Broker Base Properties, that I mentioned previously in this article contains the list of possible values for these two state values. The following code example contains #define values that you can use with the battery state and battery strength level state values.

Copy Code

#define BATTERYLEVEL_VERYLOW    0
#define BATTERYLEVEL_LOW       21
#define BATTERYLEVEL_MEDIUM    41
#define BATTERYLEVEL_HIGH      61
#define BATTERYLEVEL_VERYHIGH  81

#define BATTERYSTATE_NORMAL     0
#define BATTERYSTATE_NOTPRESENT 1
#define BATTERYSTATE_CHARGING   2
#define BATTERYSTATE_LOW        4
#define BATTERYSTATE_CRITICAL   8

Using these #define values, the following code example demonstrates accessing the battery state and battery strength level state values.

Copy Code

DWORD dwBatteryMain;
RegistryGetDWORD(SN_POWERBATTERYSTRENGTH_ROOT, 
                 SN_POWERBATTERYSTRENGTH_PATH, 
                 SN_POWERBATTERYSTRENGTH_VALUE, 
                 &dwBatteryMain);

int batteryLevel = (dwBatteryMain & SN_POWERBATTERYSTRENGTH_BITMASK) >> 16;
int batteryState = dwBatteryMain & SN_POWERBATTERYSTATE_BITMASK;

TCHAR tszBatteryLevel[256];
// Build a string description of the battery strength level
switch(batteryLevel)
{
    case BATTERYLEVEL_VERYLOW :
        _tcscpy(tszBatteryLevel, _T("Battery Level: Very Low"));
        break;
    case BATTERYLEVEL_LOW :
        _tcscpy(tszBatteryLevel, _T("Battery Level: Low"));
        break;
    case BATTERYLEVEL_MEDIUM :
        _tcscpy(tszBatteryLevel, _T("Battery Level: Medium"));
    case BATTERYLEVEL_HIGH :
        _tcscpy(tszBatteryLevel, _T("Battery Level: High"));
    case BATTERYLEVEL_VERYHIGH :
        _tcscpy(tszBatteryLevel, _T("Battery Level: Very High"));
        break;
}

TCHAR tszBatteryState[256];
// Build a string description of the battery state
_tcscpy(tszBatteryState, _T("Battery State: "));
if (batteryState & BATTERYSTATE_NORMAL)
    _tcscat(tszBatteryState, _T("Normal "));
if (batteryState & BATTERYSTATE_NOTPRESENT)
    _tcscat(tszBatteryState, _T("Not Present "));
if (batteryState & BATTERYSTATE_CHARGING)
    _tcscat(tszBatteryState, _T("Charging "));
if (batteryState & BATTERYSTATE_LOW)
    _tcscat(tszBatteryState, _T("Low "));
if (batteryState & BATTERYSTATE_CRITICAL)
    _tcscat(tszBatteryState, _T("Critical "));

This code example demonstrates several simple—but important—points. The first point is the opportunity to optimize the retrieval of state values when they share a single registry value. After the RegistryGetDWORD function is called to retrieve the registry value Main for the HKEY_LOCAL_MACHINE\System\State\Battery registry key, applying the respective bitmasks determines both the battery state and battery strength level state values. Reusing the registry value is obviously more efficient than making a second call to the RegistryGetDWORD function by using the SN_POWERBATTERYSTATE_XX #define values, which would return the same registry value that the call using the SN_POWERBATTERYSTRENGTH_XX #define values returned. This optimization is especially helpful in cases where the registry value represents a large number of state values. For example, the Status registry value for the HKEY_LOCAL_MACHINE\System\State\Phone registry key I discussed previously in this article actually holds 25 different state values—meaning that a single call to the RegistryGetDWORD function can retrieve one DWORD value that contains the 25 individual values. Each individual value is determined by simply using the bitwise AND operator to apply the appropriate #define value for each.

The second point demonstrated in the code example is the importance of knowing the value of the bitmask used to access the state value. In the case of battery strength level, the bitmask SN_POWERBATTERYSTRENGTH_BITMASK is 0xFFFF0000, indicating that the value is stored in the upper two bytes of the registry value. To make the result of the bitwise AND operator meaningful, you must shift the value 16 bits (two bytes) to the right. For example, if the result of the bitwise AND is 0x150000 (1,376,256 decimal), shifting the value 16 bits produces 0x15 (21 decimal). Checking the battery strength level #define values tells us that a battery strength level of 21 decimal means that the battery strength level is low.

The third point from the code example has to do with the knowing whether the state enumeration values are simple values or if these values also require the use of a bitmask. In the case of the battery strength level, the state value is a simple value, meaning that of the five #defines values, the battery strength level matches exactly one. With this being the case, the easiest way in the code example to check the current value is to simply use a switch statement. In the case of the battery state, you must use a bitmask to determine the state value itself because multiple battery states may be true at the same time; for example the battery may be charging, but it may still be low. As a result, the code example explicitly checks for each battery state by using a bitwise AND operator.

Accessing State Values from Managed Code (or Managed Code is Bliss)

As is usually the case, using C or C++ gives a developer the most direct access to the behaviors and capabilities of the platform. As is also usually the case, the cost of this direct access is that the C/C++ developer is responsible to handle the details involved in interacting with the platform. On the other hand, managed code puts a greater focus on developer productivity by choosing to encapsulate details within class libraries. I don't know that I've ever seen a case where the difference between these two philosophies is more evident than in the State and Notifications Broker API.

For managed-code developers, static properties in the SystemState class provide access to the standard State and Notifications Broker state values. Whether you are accessing the State and Notifications Broker API from native or managed code, the underlying implementation is identical and the same registry structure and values are being used. The one important difference is that all of the details of interacting with the registry including specific registry locations and the required bitmasks are completely encapsulated in the SystemState class. Managed-code developers simply access the SystemState static property that corresponds to the state value of their interests. The following code example demonstrates accessing the Phone Service Operator Name, Phone Multi-Line Capabilities, and Phone Radio Present state values.

Copy Code

using Microsoft.WindowsMobile.Status;
// …string operatorName = SystemState.PhoneOperatorName;
bool phoneMultiLine = SystemState.PhoneMultiLine;
bool phoneRadioPresent = SystemState.PhoneRadioPresent;

As you can see by the code example, the SystemState properties completely encapsulate the registry and bitmask details. Each property simply accesses the corresponding state value.

In addition to encapsulating the details of accessing the state values, the managed State and Notifications Broker API also makes interpreting the returned state values easier by providing .NET Compact Framework enumerated types for those properties that have enumerated return values, as demonstrated by the following code example.

Copy Code

BatteryLevel batteryLevel = SystemState.PowerBatteryStrength;
BatteryState batteryState = SystemState.PowerBatteryState;

string batteryLevelText;
switch (batteryLevel)
{
    case BatteryLevel.VeryLow:
        batteryLevelText = "Battery Level: Very Low";
        break;
    case BatteryLevel.Low:
        batteryLevelText = "Battery Level: Low";
        break;
    case BatteryLevel.Medium:
        batteryLevelText = "Battery Level: Medium";
        break;
    case BatteryLevel.High:
        batteryLevelText = "Battery Level: High";
        break;
    case BatteryLevel.VeryHigh:
        batteryLevelText = "Battery Level: Very High";
        break;
}

string batteryStateText = "Battery State: ";
if ((batteryState & BatteryState.Normal) == BatteryState.Normal)
    batteryStateText += "Normal";
if ((batteryState & BatteryState.NotPresent) == BatteryState.NotPresent)
    batteryStateText += "Not Present";
if ((batteryState & BatteryState.Charging) == BatteryState.Charging)
    batteryStateText += "Charging";
if ((batteryState & BatteryState.Low) == BatteryState.Low)
    batteryStateText += "Low";
if ((batteryState & BatteryState.Critical) == BatteryState.ChargCriticaling)
    batteryStateText += "Critical";

As you can see, the type of the SystemState.PowerBatteryStrength property is BatteryLevel, and the type of the SystemState.PowerBatteryState property is BatteryState making it very clear what to expect from each property. Notice that the way the enumeration values are tested in managed code is consistent with the same tests in native code; the BatteryLevel values are tested against specific values, whereas the BatteryState values are tested with a bitwise AND operator.

By encapsulating the details of the registry representation, the managed implementation of the State and Notifications Broker API makes accessing the standard state values extremely easy. This doesn't mean that managed-code developers never need to understand the registry structure. When we look at some of the more advanced uses of the State and Notifications Broker API next month, you will find that solidly understanding the State and Notifications Broker registry structure is just as important for managed-code developers as native-code developers.

Receiving Notifications

Acting as a central repository, the State and Notifications Broker certainly makes retrieving system and application information much easier than it was before the State and Notifications Broker API. Centralized state information is a great start, but for our applications to effectively cooperate with the device and the other applications running on those devices, we need to be able to do more than simply retrieve state values; we also need to be notified of changes to the state values. It's these notifications that transform the Windows Mobile platform from a bunch of independent applications into a holistic and cooperative platform of applications that work together as a single meta-application.

Note   The notifications feature of the State and Notifications Broker is extremely rich and flexible; however, I've just about used up all of the space I have for this month's column, so we'll focus on notification basics for now. In next month's column, we'll dig deep into the different notification features and capabilities.
Receiving Notifications in Native Code

change notifications, your application must perform three distinct steps:

  • Register to be notified about changes in one of the state values.
  • Handle the notification event.
  • Retrieve the new state value.

We'll look at how receiving notifications works by using one of the most important notifications to a mobile device application—the number of network connections. If the value is greater than zero, the device has a network connection and, therefore, can perform network-based communications.

The RegistryNotifyWindow function is the simplest way in native code to register for change notifications. The function accepts the registry key and value name of the monitored state value in addition to a window message identifier (ID) and a window handle. As the monitored state value changes, the State and Notifications Broker sends the specified message ID to the window identified by the handle.

The window message ID can be any valid message ID, but it is usually an ID value that is created by calling the RegisterWindowMessage function or by defining a constant based on the WM_USER #define value. For simplicity, we'll define a constant as shown in the following code example.

Copy Code

const DWORD WM_CONNECTIONSNETWORKCOUNT = WM_USER + 1;
Note   If you are new to creating custom window messages or haven't created one in a while, you can find more information about the importance of the WM_USER #define value from the MSDN documentation.

With the message defined, we are now ready to call the RegistryNotifyWindow function. You can call the RegistryNotifyWindow function at almost any point in the application you like—as long as the window represented by the window handle has been created. In this case, we want the notification sent to the main application window, so we can register in either the create (WM_CREATE) message handler or the InitInstance function.

The following code example shows calling the RegistryNotifyWindow function from the InitInstance function.

Copy Code

// Global Notification Handle
HREGNOTIFY g_hNotify = NULL;

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    // ...
    // ...

    g_hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
        NULL, NULL, hInstance, NULL);
    ShowWindow(g_hWnd, nCmdShow);
    UpdateWindow(g_hWnd);

    // Register for changes in the number of network connections
    HRESULT hr = RegistryNotifyWindow(SN_CONNECTIONSNETWORKCOUNT_ROOT,
        SN_CONNECTIONSNETWORKCOUNT_PATH, SN_CONNECTIONSNETWORKCOUNT_VALUE, 
        g_hWnd, WM_CONNECTIONSNETWORKCOUNT, 0, NULL, &g_hNotify);

    return TRUE;
}

Notice that the last parameter to the RegistryNotifyWindow function is a returned handle to the notification. The handle is used to close the notification when it is no longer needed. For easy access later, the application stores the handle in a global variable.

To handle the notification, we simply modify the switch statement that is contained in the window's WndProc function, so the switch statement includes a case condition for the notification's registered message ID. Depending on the data type of the value being monitored, the new data value may or may not be included in the message. For values that are stored in the registry as the REG_DWORD data type (which include all numeric and enumeration values), the new value is passed in the message WPARAM parameter. For string values, the application must call the RegistryGetString function to retrieve the new value. In the case of this example, the Connections Network Count state value is numeric and, therefore, the new value is contained in the WPARAM parameter of the message.

The following code example shows the relevant portions of the WndProc function to handle the notification.

Copy Code

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int nNetworkConnections;
    int wmId, wmEvent;
    
    switch (message) 
    {
        // Number of network connections changed
        case WM_CONNECTIONSNETWORKCOUNT:
            nNetworkConnections = (int) wParam;
            if (nNetworkConnections == 0)
                StopDataTransfer();
            else
                StartOrContinueDataTransfer();
            break;
        case WM_COMMAND:
            // ..
        case WM_PAINT:
            // ..
        case WM_CREATE:
            // ..
        case WM_DESTROY:
            // ..
        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
    }

    return 0;
}

That's all there is to it—the application now responds to changes in available network connectivity. Just as the code example demonstrates, an application can monitor changes in any of the state values by simply registering to receive the notification, handling the notification, and retrieving the current value that, in many cases, is passed as part of the message.

One last thing to remember is that monitoring notifications consumes device resources, so you'll want to call the RegistryCloseNotification function when you no longer need the notification or when the application closes. The only argument to the RegistryCloseNotification function is the handle returned by calling the RegistryNotifyWindow function.

In many cases, you will want the notification for the life of the application, so the most logical place to close the notification handle is when the application closes, as shown in the following code example.

Copy Code

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int nNetworkConnections;
    int wmId, wmEvent;
    
    switch (message) 
    {
        case WM_CONNECTIONSNETWORKCOUNT:
            // ..
        case WM_COMMAND:
            wmId    = LOWORD(wParam); 
            wmEvent = HIWORD(wParam); 
            switch (wmId)
            {
                case IDM_EXIT:
                    // Close notification handle
                    if (g_hNotify)
                        RegistryCloseNotification(g_hNotify);

                    DestroyWindow(hWnd);
                    break;
                default:
                    return DefWindowProc(hWnd, message, wParam, lParam);
            }
        case WM_PAINT:
            // ..
        case WM_CREATE:
            // ..
        case WM_DESTROY:
            // ..
        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
    }

    return 0;
}
Receiving Notifications in Managed Code

As in the case of retrieving values from the State and Notifications Broker, the .NET Compact Framework encapsulates many of the details that are involved in state value change notifications within the SystemState class. In addition to providing the many static properties that are used to access the state values, the SystemState class also provides a Changed instance-based event. To receive a state value change notifications, your application must perform the following two steps:

  • Create an instance of the SystemState class and pass the appropriate SystemProperty enumeration that identifies the value of your interest.
  • Attach a delegate to the new SystemState instance's Changed event.

After these steps are complete, the delegate will be called with each change in the state value.

The following code example shows the C# code to register for notification of changes in the Connections Network Count value.

Copy Code

public partial class FormMain : Form
{
    private void FormMain_Load(object sender, EventArgs e)
    {
         _connectionsNetworkCount = 
               new SystemState(SystemProperty.ConnectionsNetworkCount);
        _connectionsNetworkCount.Changed+=connectionsNetworkCount_Changed;
    }
    // ...
    // ...
}
    SystemState _connectionsNetworkCount;

The _connectionsNetworkCount instance invokes its Changed event on any change in the Connections Network Count state value, which then calls the connectionsNetworkCount_Changed method.

Implementing the connectionsNetworkCount_Changed method is very simple, as shown in the following code example.

Copy Code

void _connectionsNetworkCount_Changed(object sender, 
        ChangeEventArgs args)
{
    int connectionsCount = (int)args.NewValue;
    if (connectionsCount == 0;
        StopDataTransfer();
    else
        StartOrContinueDataTransfer();
}

The new state value is contained in the NewValue property of the ChangeEventArgs parameter. Unlike native code where the new value is only passed in the case of REG_DWORD typed values, managed code always passes the new value to the delegate. The ChangeEventArgs.NewValue property is of course declared as type object and must, therefore, be cast to the appropriate type as shown in the previous code example.

The only remaining consideration is releasing the resources that are associated with monitoring the state value. Like other classes in the .NET Compact Framework that hold unmanaged resources, the SystemState class implements the IDisposable interface and, therefore, has a Dispose method to release those resources.

The following code example releases the SystemState resources as part of the form's Closing event.

Copy Code

private void FormMain_Closing(object sender, CancelEventArgs e)
{
    if (_connectionsNetworkCount != null)
    {
        _connectionsNetworkCount.Dispose();
        _connectionsNetworkCount = null;
    }
}

Conclusion

You now know all you need to take advantage of the State and Notifications Broker as the central source for all device information—whether that information is related to the device itself or to the standard Windows Mobile 5.0 applications. By using the State and Notifications Broker API, you can easily retrieve the current contents of one of the state values and, if you want, you can have the system notify you of changes in that value.

The addition of the State and Notifications Broker opens up a whole new world of device application development. Device applications should not be an independent island unto themselves. With the State and Notifications Broker, you can now build your applications to interact much more closely with the system and the other applications on the system to provide the user with a much more holistic experience.

That does it for this month, but there are still many great State and Notifications Broker features we haven't gotten to yet. Please join me again next month as we cover some of the more advanced State and Notifications Broker features and show how you can integrate your own application's values into the system.

The State and Notifications Broker Part I

Posted by krsuncom
개발이야기2007. 7. 30. 13:33

원문 : 요기

To disable certificate security, a simple registry edit needs to be applied:

Under HKEY_LOCAL_MACHINE\Security\Policies\Policies:

  1. Change the DWORD named "1001" to 1 (recovery note: default is 2)
  2. Change the DWORD named "1005" to 40 (recovery note: default is 16)
  3. Change the DWORD named "1017" to 16 (recovery note: default is 128/132)

This can be done in a couple of ways:

  1. you can use the BreakSoft Mobile Registry Editor from your desktop or laptop Windows computer to edit the registry on the Windows Mobile device
    or
  2. you can use a signed ('trusted') Windows Mobile program. Fortunately a copy of the freeware PHM registry editor was signed by HTC to help with ROM development. This can be downloaded here.
Posted by krsuncom
개발이야기2007. 7. 30. 13:09

I found this great tip for all you Telus users out there on sems.org | Home:
Here is the easy steps:


1. Download and install Device Security Manager Powertoy for Windows Mobile 5.0 from Microsoft. This is a nifty utility to show what security policy is in effect. If you connect your Q to your PC, you'll see two tier security policy is in effect.
2. Download and copy secpolicies.cab to your Q (using ActiveSync, Total Commander, or just browse this site via Pocket Internet Explorer). I got this from Telus support, after following a post on qusers.com.
3. Run and install it. This allows you to install third party SSL Root Certs.
4. If you run Device Security Manager Powertoy for Windows Mobile 5.0 now (it is listed in Start - Programs as "Security Configuration Manager", you'll see now you are using One Tier Prompt. Select Security Off and click Provision. It will install tool.cab to your device and then provision the settings.
If you want to do it the hard way, you can also change registry keys:
[hkey_local_machine\security\policies\policies'>
"0000101b"=dword:00000001
"00001017"=dword:00000090
"00001007"=dword:00000040
"00001005"=dword:00000028
"00001001"=dword:00000001
to the same effect. Interestingly, on many forums, value for 1017 is set as 090 (hex, originally 080), where as the above tool sets it to 10. Also 1005 is set to DE, where many articles I read sets it to 28. The rest is the same. But right after step 3, I was able to manually edit these keys via Resco Regedit or PHM Regedit (HTC Signed copy)

인터넷 많은 게시판들에 보면 블랙잭 blackjack (SCH-M620)에도 가능한 방법이라고 나와있다.

Posted by krsuncom