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
New
dialog box by selectingNew
from theFile
menu.Choose the preferred location for the project and type
OCRClient
in the project edit-box.Select
MFC AppWizard(exe)
and clickOK
to proceed, and you’ll see theMFC AppWizard - Step 1
dialog box.Choose
Dialog based
as the type of application, so that theMFC AppWizard
will generate the code necessary for a dialog application for you.Click
Finish
and theMFC AppWizard
will 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 ...
Get Learning DCOM now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.