SMILEY/SMILEYDG

The SMILEY and SMILEYDG samples demonstrate how easy it is to use Windows CE MFC support to handle ActiveX controls. The sample consists of the SMILEY ActiveX control inserted into the SMILEYDG control container. The sample allows you to modify properties, call methods, and handle events from the SMILEY control.

SMILEYDG uses regular Windows calls to modify the ActiveX control's caption in CSmileyDlg::OnInitDialog. The caption is displayed directly above the control and is set to "Smile!" by default. SMILEYDG hooks up a check box that is tied to the ActiveX control's "Sad" property. Finally, it includes its own EVENTSINK map and handles the ClickIn and ClickOut events from the ActiveX control.

You can interact with the SMILEY sample in one of two ways.

If you click the Sad check box, you will set the "Sad" Automation property in the ActiveX control. This will cause the smiley face to smile or frown, depending upon the value of the check box.

If you click the face itself, the ActiveX control will fire a ClickIn event, which the dialog handles by calling the control's "Wink" automation method. If you click outside the face, the ActiveX control will fire a ClickOut event, which the dialog handles by returning the face to normal.

This sample demonstrates the following keywords:

CDC::DrawIcon CWnd::GetFont
CDC::GetSafeHdc CWnd::IsIconic
CDialog::DoModal CWnd::OnLButtonDblClk
CMenu::AppendMenu CWnd::OnPaint
CRect::Height CWnd::OnSysCommand
CRect::Width CWnd::SendMessage
CString::IsEmpty CWnd::SetFont
CString::LoadString GetSystemMenu
CWinApp::InitInstance GetSystemMetrics
CWnd::Create LoadIcon
CWnd::DoDataExchange SetWindowText
CWnd::GetClientRect AfxGetApp

You can find the SMILEY project files in the Wce\Samples\Mfc\SMILEY directory.

You can find the SMILEYDG project files in the Wce\Samples\Mfc\SMILEYDG directory.

For information on the Windows CE platforms that support this sample, see MFC for Windows CE Samples.