3 This is an short example to show how to integrate TAO and MFC base GUI
4 applications. The server is an MFC-based GUI application, which
5 spawns an additional thread to invoke the ORBs event queue. The
6 client is a Win32 console application.
8 The following are the steps used to integrate a Win32-GUI application
9 and TAO by adding an additional thread for the ORB:
11 Step 1: Creating a MFC-Application wizard-based project
13 Step 2: Set the following project settings
15 - C++ Settings / Preprocessor
17 ACE_HAS_DLL=1, ACE_HAS_MFC=1
19 - Use the MFC-based librarys of ACE & TAO
21 e.g. link acemfcd.lib TAOmfcd.lib for the Debug-version!
23 Step 3: Add a threadfunction for the ORB
25 The ORB has to be started in a separat thread. So introduce a
26 threadfunction to spawn a separate thread by
27 e.g. ACE-Thread-Manager. In this function you implement all
28 the necessary stuff to start an ORB!
30 Step 4: Add the thread invocation in the Application
34 - Spawn the thread for the ORB
36 At first you have to initialize ACE by calling
40 as soon as possible in your application. Good places are in
41 the constructor or in the InitInstance() memberfunction of the
42 application-calls. In addition you have to spawn the thread
43 to run the ORB, e.g. ACE_Thread_Manager::instance()->spawn
44 (spawn_my_orb_thread);
46 Step 5: Overwrite the default destructor of the Application-Class
48 - Get a reference to the ORB use in the thread
52 - Wait for the shutdown of the ORB-thread
54 - Call ACE::fini() to close the ACE::init()-call
56 To shut down the ORB in it's separate thread you need to call
57 the ORB::shutdown() method of the ORB references in the
58 thread. To get an reference to this special ORB create an
59 additional CORBA::ORB_var and initialize it the the same
60 ORB-name than you initialized the ORB in the thread. So you
61 get a reference to the same ORB.
65 Martin Botzler <martin.botzler@mchp.siemens.de>