$Id$

This is an short example to show how to integrate TAO and MFC base GUI
applications.  The server is an MFC-based GUI application, which
spawns an additional thread to invoke the ORBs event queue.  The
client is a Win32 console application.

The following are the steps used to integrate a Win32-GUI application
and TAO by adding an additional thread for the ORB:

Step 1: Creating a MFC-Application wizard-based project

Step 2: Set the following project settings

	- C++ Settings / Preprocessor

		ACE_HAS_DLL=1, ACE_HAS_MFC=1

	- Use the MFC-based librarys of ACE & TAO

		e.g. link acemfcd.lib TAOmfcd.lib for the Debug-version!

Step 3: Add a threadfunction for the ORB

	The ORB has to be started in a separat thread. So introduce a
	threadfunction to spawn a separate thread by
	e.g. ACE-Thread-Manager.  In this function you implement all
	the necessary stuff to start an ORB!

Step 4: Add the thread invocation in the Application

	- Initialize ACE

	- Spawn the thread for the ORB

	At first you have to initialize ACE by calling

		ACE::init()

	as soon as possible in your application. Good places are in
	the constructor or in the InitInstance() memberfunction of the
	application-calls.  In addition you have to spawn the thread
	to run the ORB, e.g.  ACE_Thread_Manager::instance()->spawn
	(spawn_my_orb_thread);

Step 5: Overwrite the default destructor of the Application-Class

	- Get a reference to the ORB use in the thread

	- Shut down the ORB

	- Wait for the shutdown of the ORB-thread

	- Call ACE::fini() to close the ACE::init()-call

	To shut down the ORB in it's separate thread you need to call
	the ORB::shutdown() method of the ORB references in the
	thread. To get an reference to this special ORB create an
	additional CORBA::ORB_var and initialize it the the same
	ORB-name than you initialized the ORB in the thread. So you
	get a reference to the same ORB.

Have fun,

	Martin Botzler <martin.botzler@mchp.siemens.de>



