Simple Client
Before we can discuss the different techniques for using distributed components, we need to create a simple client application, which will be a new project that we’ll name OCRClient. To keep things simple, we’ll use MFC to create a simple dialog application. Follow these directions:
To create a new project, launch the
Newdialog box by selectingNewfrom theFilemenu.Choose the preferred location for the project and type
OCRClientin the project edit-box.Select
MFC AppWizard(exe)and clickOKto proceed, and you’ll see theMFC AppWizard - Step 1dialog box.Choose
Dialog basedas the type of application, so that theMFC AppWizardwill generate the code necessary for a dialog application for you.Click
Finishand theMFC AppWizardwill generate the skeleton of a dialog application.
The code generated for this application is straightforward and won’t be explained in this book. In brief, the generated COCRClientApp class models our simple application. When the application starts, it creates a dialog box and displays it until a user dismisses it, at which time the application ends. This dialog is represented by the COCRClientDlg class, which is generated by the MFC AppWizard when you create a dialog application. A dialog application is driven by the single InitInstance function of the generated COCRClientApp class.
BOOL COCRClientApp::InitInstance()
{
. . .
COCRClientDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
. . .
}As you can see from the generated code ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access