Siebel Object Interfaces Reference > Accessing Siebel COM Data Server with C++ >

Building the Siebel COM Client in C++


Use the following procedure to build a Siebel COM client in C++ that uses the Microsoft Foundation Class (MFC) library.

To build the Siebel COM client in C++

  1. In Microsoft Visual C++, choose File > New > Project.
  2. Select the MFC AppWizard (exe) project type.
  3. In the Project name field, enter SiebelCOM, and then click OK.

    The MFC AppWizard starts.

  4. Select the Dialog-based option and then click Next.
  5. In the "What other support would you like to include?" frame, check Automation and clear ActiveX Controls, and then click Next. Click Next again.
  6. Click Finish.

    Microsoft Visual C++ displays the project information, as shown in the following illustration.

  7. Click OK.

    The Application Wizard generates the standard MFC code that serves as the skeleton for this project. Headers and libraries necessary to support COM automation are included. Refer to the Microsoft Visual Studio [MSDN] documentation for a detailed description of the MFC libraries.

  8. The newly created dialog box appears in the workspace. You can resize the box and change the text in the label by editing its properties. Right-click the label in the dialog box to edit its properties. Modify the dialog box so that it looks something like the following illustration.
  9. Choose View > ClassWizard > Automation.
  10. Click Add Class > From a type library.
  11. Navigate to the C:\Sea750\client\bin folder. Choose sobjsrv.tlb.
  12. In the Confirm Classes dialog box, make sure all five Siebel classes are selected, and then click OK. Click OK again to close the Class Wizard.
  13. Add code to communicate with the Siebel COM Server.
    1. In the workspace window, click the FileView tab.
    2. Expand the Source Files and Header Files folders, as shown in the following illustration.
    3. Double-click the SiebelCOMDlg.h file.

      The code window opens, as shown in the following illustration.

    4. Enter the code that is highlighted in boldface in Figure 13 into the SiebelCOMDlg.h file.
Figure 13.  Code for SiebelCOMDlg.h
Click for full size image
  1. Choose File > Open and select the SiebelCOMDlg.cpp file. Add the code that is highlighted in boldface in Figure 14 to the OnInitDialog procedure.
Figure 14.  Code to Be Added to OnInitDialog Routine in SiebelCOMDlg.cpp
Click for full size image

In the same file, add the code that is highlighted in boldface in Figure 15 and Figure 16 to the OnOKDialog procedure. Make sure that the line beginning with sApp.LoadObjects points to the location of the CFG file you intend to use. In the line beginning with sApp.Login, make sure that you have entered a valid logon name and password.

Figure 15.  Code to be Added to OnOKDialog Routine in SiebelCOMDlg.cpp
Click for full size image
Figure 16.  Code to Be Added to OnOKDialog Routine in SiebelCOMDlg.cpp
Click for full size image

When you have finished creating your program, test it to make sure it works properly.

Siebel Object Interfaces Reference