Click to open or copy the SMILEY project files.
The SMILEY sample is a simple ActiveX control container designed to show how easy it is to use MFC support to handle ActiveX controls. The sample consists of the SMILE ActiveX control inserted into the SMILEY control container. The sample allows you to modify properties, call methods, and handle events from the SMILE control.
SMILEY 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. SMILEY 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.
To build the sample requires you to first build the SMILE ActiveX control in the SMILECTL subdirectory beneath SMILEY. If you are building this sample on Windows 95®, you should build the non-Unicode version.
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 (formerly OLE 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:
AfxGetApp; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::DoModal; CMenu::AppendMenu; CRect::Height; CRect::Width; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWnd::Create; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetFont; CWnd::IsIconic; CWnd::OnLButtonDblClk; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::SendMessage; CWnd::SetFont; GetSystemMenu; GetSystemMetrics; LoadIcon; SetWindowText