Feature
|
Handheld PC
|
Palm-size PC
|
Auto PC
|
H/PC Pro
|
Windows CE version
|
2.00
|
2.01, 2.11
|
2.10
|
2.11
|
SDK version
|
2.0
|
1.0, 1.2
|
2.0 (Beta)
|
3.0
|
SDK size
|
128MB
|
85MB, 139MB
|
37MB
|
206MB
|
Visual C++
|
Yes
|
Yes
|
Yes
|
Yes
|
Visual Basic
|
Yes
|
Yes†
|
No
|
Yes
|
COM
|
Yes
|
Yes
|
Yes
|
Yes
|
ATL
|
Yes
|
Yes††
|
No
|
Yes
|
MFC version
|
4.20
|
4.23
|
N/A
|
4.23
|
†Visual Basic is supported in version 1.2 of the Palm-size PC SDK, but not in version 1.0.
|
||||
††ATL is supported in version 1.2 of the Palm-size PC SDK, but not in version 1.0.
|
Figure 2 Platform SDK Contents
SDK Subfolder
|
Description of Content
|
Atl
|
Contains a Windows CE-specific subset of the ATL that supports only those COM features currently implemented under Windows CE, including in-process servers, ActiveX controls, and so on. Windows CE does not currently support asynchronous monikers, snap-in objects, safety maps, apartment threading, or out-of-process servers. ATL is not supported on the first-generation Palm-size PC (Windows CE 2.01).
|
Emulation
|
Represents the logical file structure of the emulated Windows CE device that runs on the Windows NT desktop. Because Windows CE files reside in an object store, you may not simply copy files into this folder to download them to the emulated device. You must instead use the EMPFILE utility documented in the Platform SDK release notes.
|
include
|
Contains the system header files that represent the APIs supported by the Windows CE operating system.
|
lib
|
Contains the import libraries required to call system functions. Because .LIB files are compiler-dependent, a set of libraries exists for each supported hardware configuration.
|
mfc
|
Contains a Windows CE-specific subset of MFC, including support for CWnd and its derivatives, the Document/View architecture, ActiveX controls, serialization, and the container classes. Due to limitations in Windows CE, MFC for Windows CE does not currently support DAO, ODBC, the multiple-document interface (MDI), OLE features, metafiles, or rich edit controls.
|
PlatMan
|
Contains files used to establish desktop communication with the Windows CE device. Included are files that must reside on the desktop as well as files that must be downloaded to the device itself.
|
Samples
|
Contains sample code that shows proper usage of ATL, MFC, and the Windows CE APIs.
|
Support
|
Contains CABWIZ.EXE, a tool used for creating Windows CE cabinet files, which is the means by which the Application Manager installs your software on a Windows CE device. This folder also contains documentation on the use of the Active Ink control, which provides a convenient means for applications to accept input from a user without using a keyboard.
|
Target
|
Contains REGSVRCE.EXE, a component registration utility similar to the desktop registration utility regsvr32.exe. Also contains platform-specific versions of ASDEV.EXE, a simple Windows CE-based ActiveX control container used for testing ActiveX controls.
|
Figure 7 Supported MFC Features
MFC Feature
|
Windows CE 2.00
|
Windows CE 2.01
|
Windows CE 2.11
|
Windows Sockets
|
Yes
|
Yes
|
Yes
|
Windows Help
|
Yes
|
Yes
|
Yes
|
ActiveX controls
|
Yes
|
No
|
Yes
|
Printing
|
No
|
No
|
Yes
|
CommandBar
|
No
|
Yes
|
Yes
|
Internet Explorer ReBars
|
No
|
Yes
|
Yes
|
Pseudo-CommandBar
|
Yes
|
Yes
|
Yes
|
Status Bar
|
No
|
Yes
|
Yes
|
Figure 8 Building a Toolbar
// On the Palm-size PC screen space is at such a premium that
// we don't have room on the toolbar for separators or a help button.
static TBBUTTON tbButtons[] = {
#ifdef _WIN32_WCE_PSPC
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
#endif
{0, ID_VIEW_REFRESH, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{1, ID_EDIT_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{2, ID_EDIT_FIND, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{3, ID_EDIT_FINDNEXT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1}
};
const int nNumButtons = sizeof(tbButtons)/sizeof(TBBUTTON);
const int nNumImages = 4;
#ifdef _WIN32_WCE_PSPC
const DWORD dwAdornmentFlags = 0;
#else
const DWORD dwAdornmentFlags = CMDBAR_HELP;
#endif
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rSize;
GetWindowRect(rSize);
// The following code is backward compatible with the Handheld
// PC SDK Version 2.0. Later versions of MFC replace the InsertButtons
// and AddAdornments functions (defined in CFrameWnd) with more
// sophisticated code.
if (!InsertButtons(tbButtons, nNumButtons, IDR_MAINFRAME, nNumImages) ||
!AddAdornments(dwAdornmentFlags))
{
TRACE0("Failed to add toolbar buttons\n");
return -1;
}
return 0;
}
Figure 10 Screen Size Detection
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT,
CCreateContext* pContext)
{
CRect rSize;
GetWindowRect(&rSize);
if (rSize.Height() > rSize.Width())
{
CSize start_size(0, AfxGetApp()->GetProfileInt(L"RegView",
L"TreeHeight",
rSize.Height() * 2 / 3));
VERIFY( m_wndSplitter.CreateStatic(this, 2, 1));
VERIFY( m_wndSplitter.CreateView(1, 0,
RUNTIME_CLASS(CDataView),
start_size, pContext) );
VERIFY( m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CRegView),
start_size, pContext) );
}
else
{
CSize start_size(AfxGetApp()->GetProfileInt(L"RegView",
L"TreeWidth",
rSize.Width() / 3), 0);
VERIFY( m_wndSplitter.CreateStatic(this, 1, 2));
VERIFY( m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CDataView),
start_size, pContext) );
VERIFY( m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CRegView),
start_size, pContext) );
}
return TRUE;
}
Figure 13 Updating Button State
BOOL CRegApp::OnIdle(LONG lCount)
{
CMenu* pMenu = m_pMainWnd->GetMenu();
UpdateMenuItems(pMenu);
return CWinApp::OnIdle(lCount);
}
void CRegApp::UpdateMenuItems(CMenu* pMenu)
{
// This funky code is required for MFCCE Version 2.0
// because there's no support for graying out the
// toolbar buttons when a menu item is disabled!!
// The problem does not exist in version 2.01 and later
#if (_WIN32_WCE <= 200)
ASSERT(pMenu != NULL);
UINT nItems = pMenu->GetMenuItemCount();
for (UINT nLoop = 0; nLoop < nItems; nLoop++)
{
MENUITEMINFO info;
info.cbSize = sizeof(info);
info.dwTypeData = NULL;
info.fMask = MIIM_SUBMENU|MIIM_ID;
GetMenuItemInfo(pMenu->GetSafeHmenu(), nLoop, TRUE, &info);
if (info.hSubMenu)
{
CMenu subMenu;
subMenu.Attach(info.hSubMenu);
UpdateMenuItems(&subMenu);
subMenu.Detach();
continue;
}
if (info.wID == 0) // Separator
continue;
CCmdUI state;
state.m_nID = info.wID;
state.m_pMenu = pMenu;
state.m_nIndex = nLoop;
state.m_nIndexMax = nItems;
state.DoUpdate(m_pMainWnd, FALSE);
UINT nState = pMenu->EnableMenuItem(nLoop,
MF_BYPOSITION | MF_ENABLED);
CFrameWnd* pFrame = DYNAMIC_DOWNCAST(CFrameWnd, m_pMainWnd);
ASSERT(pFrame);
HWND hWnd = pFrame->m_hCommandBar;
DWORD dwState = nState & MF_GRAYED ?
TBSTATE_INDETERMINATE : TBSTATE_ENABLED;
::SendMessage(hWnd, TB_SETSTATE, state.m_nID, dwState);
}
#endif
}
Figure 14 Comparing DLL Sizes
MFC Version |
||||
Library
|
Standard Visual C++ 6.0
|
Windows CE 2.0
|
Windows CE 2.01
|
Windows CE 2.11
|
MFCxx.dll
|
973KB
|
286KB
|
257KB
|
285KB
|
OLECExx.dll
|
N/A
|
228KB
|
N/A
|
189KB
|
OLE32x.dll
|
707KB
|
110KB
|
7KB
|
111KB
|
OLEAUTxx.dll
|
585KB
|
154KB
|
133KB
|
133KB
|
VBScript.dll
|
967KB
|
220KB
|
N/A
|
218KB
|