Click here to Skip to main content
12,948,385 members (69,858 online)
Click here to Skip to main content
Add your own
alternative version


28 bookmarked
Posted 28 Aug 2003

Login: Automation Server

, 28 Aug 2003 GPL3
Rate this:
Please Sign up or sign in to vote.
An automation server that verifies the user ID and password from a MS-Access database for the remote client.


OLE Automation simplifies the task of automating applications. On one hand it enables an application to manipulate objects implemented in another application and on the other hand, it helps an application to expose objects that can be manipulated by other applications.

OLE automation is built on top of COM and has become quite popular in recent years as most of the Microsoft applications like Excel, DevStudio, Access and Word have started supporting it. The stage is set where customers expect every application to support OLE automation. As VC++ programmers, it is therefore in our interest to open our COM component and applications to outside world via OLE automation. [VC++, COM and Beyond.]

Here we would build an automation server that can verify the user ID and password, allow us to add new user, remove existing user and edit user information. The automation component uses marshalling/DCOM to communicate to the client located on the same/remote machine. We would use MS-Access as our database holder. This example also shows us a method to access remote database, although this may me not the best method to do so.


This tutorial assumes that you are familiar with Visual C++/MFC, COM, Automation and other technologies used in this tutorial like ADO, etc. Though there is no need to understand their underpinnings in great detail, you should at least have a working knowledge of what these underpinnings mean.


DevStudio provides a lot of support to build an automation component, but unfortunately it assumes the application to be an SDI/MDI or a dialog based application. We would build a dialog based application and then remove all the dialog based support.

  • Create a dialog based MFC project selecting 'Automation' in step 2 of 4, like you have done previously.
  • Delete the dialog based resources, dialog based files [$ProjectName]Dlg.cpp/h, DlgProxy.cpp/h and remove all the occurrences of that dialog from the [$ProjectName].cpp file.
  • Add the following statement after the call to COleTemplateServer::RegisterALL() in the C[$ProjectName]App::InitInstance() function.
    return TRUE;
  • Launch the class wizard, it will prompt us to remove the dialog related files from its database. Comply with its wishes until it is happy.
  • Compile the project now, it should compile without any error.
  • Launch the class wizard again and add a new class to the project derived from the CCmdTarget base class. Choose the automation support "Createable by type ID" and specify Login.CRemoteLogin as the type id.

    Add New Class.

  • Use the automation property sheet of the class wizard to add new methods to the newly created class.

    Add New Method.

  • Compile the application and run it, the server will immediately terminate after adding the necessary registry entries.

Automation Client

There is also a sample client application located here.


Here we have successfully built an automation server that can verify the user ID and password, allow us to add new user, remove existing user and edit user information. This server can be easily extended to DCOM (Distributed Component Object Model) for a networked environment to exploit the benefits of distributed computing with remote database management. Though this may not be the correct method for using and managing a remote database, there may be more better methods too. But the purpose of this article is just to help you to understand the mysteries of automation better. Your valuable suggestions are always welcome, to make this article better.


This code is provided "as is" with no expressed or implied warranty. You can use and abuse this code without any restriction. If you use this source code in a commercial product, acknowledgment is not required but would be appreciated.


  • VC++, COM and Beyond.

    Author: Yashavant Kanetkar & Sudesh Saoji.

    ISBN: 81-7635-206-8

    Publisher: BPB Publications.

    User Level: Beginning-Intermediate.

    This book provides an in-depth coverage of cutting edge technologies like Document/View Architecture, OLE, COM, DCOM, Active X, Open GL, Printing and Print Previewing, HTML Help System, Programming the disk and Screen Savers.

  • Teach Yourself Database Programming with Visual C++ ® 6 in 21 Days.

    Author: Lyn Robison.

    ISBN: 81-7635-196-2

    Publisher: Techmedia (For Indian Subcontinent).

    User Level: Beginning-Intermediate.

    Topics covered include: Explore effective database design techniques, Develop client/server applications using SQL, ODBC, ADO and OLE DB, Harness the power of database servers and Build scalable database applications using Microsoft Transaction Server.


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Priyank Bolia
Software Developer (Senior)
India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralTRACE Pin
jackKo11-Feb-05 5:14
memberjackKo11-Feb-05 5:14 
GeneralRe: TRACE Pin
Priyank Bolia17-Feb-05 1:50
memberPriyank Bolia17-Feb-05 1:50 
GeneralRe: TRACE Pin
jackKo17-Feb-05 3:12
memberjackKo17-Feb-05 3:12 
GeneralRe: TRACE Pin
Priyank Bolia17-Feb-05 4:52
memberPriyank Bolia17-Feb-05 4:52 
GeneralRe: TRACE Pin
Priyank Bolia17-Feb-05 5:04
memberPriyank Bolia17-Feb-05 5:04 
GeneralRe: TRACE Pin
Priyank Bolia17-Feb-05 5:13
memberPriyank Bolia17-Feb-05 5:13 
Generalerror while compiling the loginServer Pin
Anand Kumar3-Sep-03 0:46
memberAnand Kumar3-Sep-03 0:46 
GeneralRe: error while compiling the loginServer Pin
Priyank Bolia4-Sep-03 21:14
memberPriyank Bolia4-Sep-03 21:14 
GeneralRe: error while compiling the loginServer Pin
Anand Kumar5-Sep-03 23:55
memberAnand Kumar5-Sep-03 23:55 
GeneralEhem..... Pin
snyp29-Aug-03 3:08
membersnyp29-Aug-03 3:08 
GeneralRe: Ehem..... Pin
John M. Drescher29-Aug-03 9:06
memberJohn M. Drescher29-Aug-03 9:06 
GeneralRe: Ehem..... Pin
Priyank Bolia29-Aug-03 21:20
memberPriyank Bolia29-Aug-03 21:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170524.1 | Last Updated 29 Aug 2003
Article Copyright 2003 by Priyank Bolia
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid