Compaq iPAQ h3760 Datenblatt Seite 73

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 75
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 72
ENEE408G Fall 2003 (Update 09/23/2003)
Mobile Computing and Pocket PC Programming
72
(1) WinCE uses Unicode by which each character is represented by 2 bytes. The
easiest way to convert char to Unicode is to use the _T() function. For
example, to convert “filenamein” to Unicode, you can simply use
_T(“filenamein”). To declare a Unicode array, you should use TCHAR
instead of char.
(2) You also can convert string between ANSI character and Unicode by calling
C run-time functions.
(i) mbstowcs - Convert a multi-byte (ANSI) string to wide character string
(Unicode)
(ii) wcstombs - Convert a wide character string to multi-byte string
A small example is listed in the below table.
WCHAR szwcBuffer[100];
Char szBuffer[100];
Char* lpszConvert = “ANSI string to convert”;
WCHAR* lpszwcConvert = _T(“Unicode string to convert”);
Int nChars;
nChars = mbstowcs(szwcBuffer, lpszConvert, 100);
nChars = wcstombs(szBuffer, lpszwcConvert, 100);
(e) Q: How can I detect the events of hardware control buttons, such as navigation
buttons, on the Pocket PC front panel?
A: Hardware control buttons are treated as keyboard keys. Pressing a hardware
control keys results in WM_KEYDOWN and WM_KEYUP messages as well as a
WM_CHAR message if the virtual key matches a Unicode character. Here is an
example using WM_KEYDOWN. Click View Æ ClassWizard from eVC menu
bar, double click WM_KEYDOWN in the messages list box. You can edit codes
by pressing “Edit Code”.
void CHardwareKeyDemoDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch(nChar){
case VK_LEFT:
MessageBox(_T("Left navigation key is pressed"));
break;
case VK_RIGHT:
MessageBox(_T("Right navigation key is pressed"));
break;
case VK_UP:
MessageBox(_T("Up navigation key is pressed"));
break;
case VK_DOWN:
MessageBox(_T("Down navigation key is pressed"));
break; }
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
(f) Q: How can I debug programs?
A: Under Windows Programming environment, we do not have a command
prompt window to print out data using printf or cout. There are several ways
to debug Windows programs.
Seitenansicht 72
1 2 ... 68 69 70 71 72 73 74 75

Kommentare zu diesen Handbüchern

Keine Kommentare