Com interop question

C

Cat_Vasiliy

Hello.

Look i have an .idl file
like this:


import "comcat.idl";
import "oaidl.idl";
import "ocidl.idl";
import "objidl.idl";

//==============================================================================
// IOPCShutdown

[
object,
uuid(F31DFDE1-07B6-11d2-B2D8-0060083BA1FB),
// async_uuid(32E8D701-A335-4fc1-8F4B-663F505C7D62),
pointer_default(unique)
]
interface IOPCShutdown : IUnknown
{
HRESULT ShutdownRequest(
LPCWSTR szReason
);
}

//=============================================================================
// IOPCCommon

[
object,
uuid(F31DFDE2-07B6-11d2-B2D8-0060083BA1FB),
// async_uuid(32E8D702-A335-4fc1-8F4B-663F505C7D62),
pointer_default(unique)
]
interface IOPCCommon : IUnknown
{

HRESULT SetLocaleID(
[in] LCID dwLcid
);

HRESULT GetLocaleID(
[out] LCID *pdwLcid
);

HRESULT QueryAvailableLocaleIDs(
[out] DWORD * pdwCount,
[out, size_is(,*pdwCount)] LCID ** pdwLcid
);

HRESULT GetErrorString(
[in] HRESULT dwError,
[out, string] LPWSTR * ppString
);

HRESULT SetClientName(
[in, string] LPCWSTR szName
);
}

//==============================================================================
// IOPCServerList
//
// The OPCEnum.EXE object provided by the OPC Foundation supports the

// IOPCServerList interface via DCOM to allow clients to determine
available
// OPC servers on remote machines

[
object,
uuid(13486D50-4821-11D2-A494-3CB306C10000),
// async_uuid(32E8D703-A335-4fc1-8F4B-663F505C7D62),
pointer_default(unique)
]
interface IOPCServerList : IUnknown
{
HRESULT EnumClassesOfCategories(
[in] ULONG cImplemented,
[in,size_is(cImplemented)] CATID rgcatidImpl[],
[in] ULONG cRequired,
[in,size_is(cRequired)] CATID rgcatidReq[],
[out] IEnumGUID ** ppenumClsid
);

HRESULT GetClassDetails(
[in] REFCLSID clsid,
[out] LPOLESTR* ppszProgID,
[out] LPOLESTR* ppszUserType
);

HRESULT CLSIDFromProgID(
[in] LPCOLESTR szProgId,
[out] LPCLSID clsid
);
};

//==============================================================================
// IOPCEnumGUID
//
// The OPCEnum.EXE object now has an interface
// IOPCServerList2 which uses IOPCEnumGUID rather than
// the standard MS IEnumGUID. This was done to work
// around problems with the MS version on certain
// system configurations. IOPCEnumGUID is impelmented
// in OPCEnum.EXE.

[
object,
uuid(55C382C8-21C7-4e88-96C1-BECFB1E3F483),
// async_uuid(32E8D704-A335-4fc1-8F4B-663F505C7D62),
pointer_default(unique)
]
interface IOPCEnumGUID : IUnknown
{
typedef IOPCEnumGUID * LPOPCENUMGUID;

HRESULT Next(
[in] ULONG celt,
[out, size_is(celt), length_is(*pceltFetched)] GUID * rgelt,
[out] ULONG *
pceltFetched
);

HRESULT Skip(
[in] ULONG celt
);

HRESULT Reset();

HRESULT Clone(
[out] IOPCEnumGUID **ppenum
);
}

//==============================================================================
// IOPCServerList2

[
object,
uuid(9DD0B56C-AD9E-43ee-8305-487F3188BF7A),
// async_uuid(32E8D705-A335-4fc1-8F4B-663F505C7D62),
pointer_default(unique)
]
interface IOPCServerList2 : IUnknown
{
HRESULT EnumClassesOfCategories(
[in] ULONG cImplemented,
[in,size_is(cImplemented)] CATID rgcatidImpl[],
[in] ULONG cRequired,
[in,size_is(cRequired)] CATID rgcatidReq[],
[out] IOPCEnumGUID ** ppenumClsid
);

HRESULT GetClassDetails(
[in] REFCLSID clsid,
[out] LPOLESTR* ppszProgID,
[out] LPOLESTR* ppszUserType,
[out] LPOLESTR* ppszVerIndProgID
);

HRESULT CLSIDFromProgID(
[in] LPCOLESTR szProgId,
[out] LPCLSID clsid
);
};

//==============================================================================
// Type Library

[
uuid(B28EEDB1-AC6F-11d1-84D5-00608CB8A7E9),
version(1.10),
helpstring("OPC Common 1.10 Type Library")
]
library OPCCOMN
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");


//==========================================================================
// Standard Interfaces

interface IEnumString;
interface IEnumUnknown;
interface IEnumGUID;
interface IConnectionPointContainer;
interface IConnectionPoint;


//==========================================================================
// OPC Synchronous Interfaces

interface IOPCCommon;
interface IOPCShutdown;
interface IOpcServerList;
interface IOPCServerList2;
interface IOPCEnumGUID;


//==========================================================================
// Standard Asynchronous Interfaces

// interface ICallFactory;
// interface ICancelMethodCalls;
// interface IAsyncManager;
// interface ISynchronize;
// interface IWaitMultiple;


//==========================================================================
// OPC Asynchronous Interfaces

// interface AsyncIOPCCommon;
// interface AsyncIOPCShutdown;
// interface AsyncIOpcServerList;
// interface AsyncIOPCServerList2;
// interface AsyncIOPCEnumGUID;
};

I want to write a COM server and i want to use ShutdownRequest
function as event to client.
Help me please.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top