Modifying SCEC Files

Open and modify the .cpp file generated by the ATL wizard (for example, SampleSCEC.cpp) by including one or more appropriate _i.c files.

For example:

#include "application_ev_i.c"

#include "buscomp_ev_i.c"

#include "service_ev_i.c"

#include "applet_ev_i.c"

Open the stdafx.cpp file, and add the following code above #include "stdafx.h":

#define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA

Modify the .idl files (for example, SampleSCEC.idl) as follows:

Remove the definition of the interface generated by the ATL wizard. For example, remove the following code:

import "oaidl.idl";

import "ocidl.idl";

import "atliface.idl";

[

object,

uuid (D26E065A-3365-4A41-ACDE-486E98C204A8),

helpstring ("ISampleSCEC Interface"),

pointer_default (unique);

]

Interface ISSampleSCEC : IUnknown{

};

Import the appropriate Siebel .idl files for the event to be implemented.

For example, if you are implementing a business component SCEC, add the following:

import "application_ar.idl";

import "application_ev.idl";

import "buscomp_ev.idl";

Replace the automatically generated interface name (for example, ISampleSCEC) with the appropriate ISHCEXXXEvent interface. For example, if you are implementing a business component SCEC, change the interface name to ISHCEBusCompEvent. The final lines of code resemble the following:

coclass SampleSCEC

{

[default] interface ISHCEBusCompEvent;

};

};

Modify the SampleSCECObj.h file as follows:

Add statements to include SampleSCEC.h and any Siebel templates for the implemented objects. For example:

#include "SampleSCEC.h"

#include "t_siebelscecbc.h"

Add any events that you intend to implement to the class definition. Use the appropriate template according to the event. Possible events and templates are listed in the following table:

Event

Template

Application events

CSiebelSCECAppBase

Business Component events

CSiebelSCECBusCompBase

Applet events

CSiebelSCECAppletBase

Service events

CSiebelSCECServiceBase

For example, to replace the ATL-generated class definition for CSampleSCEC, replace the following code:

class ATL_NO_VTABLE CSampleSCEC :

public CComObjectRootEx<CComMultiThreadModel>,

public CComCoClass<CSampleSCEC, &CLSID_SampleSCEC>,

public ISampleSCEC

with this definition:

class ATL_NO_VTABLE CSampleSCEC :

public CSiebelSCECBusCompBase

<CSampleSCEC, &CLSID_SampleSCEC,

&LIBID_SampleSCECLib, IDR_SAMPLESCEC>

Where:

The first parameter (CSampleSCEC) indicates the class name.

The second and third parameters hold class and library Ids, respectively, and are defined in the <ProjName>_i.c file.

The fourth parameter (IDR_xxx) is defined in the resourceppc.h file.

Replace the ATL-generated interface name (for example, ISampleSCEC) with the appropriate ISHCEXXXEvent interface. For example:

BEGIN_COM_MAP(CSampleSCEC)

COM_INTERFACE_ENTRY(ISHCEBusCompEvent)

END_COM_MAP()

Remove the following:

DECLARE_PROTECT_FINAL_CONSTRUCT()

HRESULT FinalConstruct()

{

return S_OK;

}

void FinalRelease()

{

}

Add the appropriate STDMETHODS that you want to implement. For example, to add InvokeMethod, add the following code:

STDMETHOD (InvokeMethod) (BSTR pMethod, BSTR* args, int nArgs);

Implement the SCEC in the .cpp file (for example, SampleSCECObj.cpp). To implement CSampleSCEC::InvokeMethod, add the following code: