COMDemo.h
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:2k
- // COMDemo.h : Declaration of the CCOMDemo
- #pragma once
- #include "resource.h" // main symbols
- // _ICompletedEvents
- [
- dispinterface,
- uuid("B2CBBCD3-2993-4148-8EF4-356EACFD834B"),
- custom(0F21F359-AB84-41e8-9A78-36D110E6D2F9,
- "Wrox.ProCSharp.COMInterop.Server.ICompletedEvents"),
- helpstring("_ICompletedEvents Interface")
- ]
- __interface _ICompletedEvents
- {
- [id(1)] void Completed(void);
- };
- // IMath
- [
- object,
- uuid("2158751B-896E-461d-9012-EF1680BE0628"),
- dual,
- helpstring("IMath Interface"),
- pointer_default(unique),
- custom(0F21F359-AB84-41e8-9A78-36D110E6D2F9,
- "Wrox.ProCSharp.COMInterop.Server.IMath")
- ]
- __interface IMath : IDispatch
- {
- [id(1)] HRESULT Add([in] LONG val1, [in] LONG val2, [out, retval] LONG* result);
- [id(2)] HRESULT Sub([in] LONG val1, [in] LONG val2, [out, retval] LONG* result);
- };
- // ICOMDemo
- [
- object,
- uuid("015ED275-3DE6-4716-A6FA-4EBC71E4A8EA"),
- dual, helpstring("ICOMDemo Interface"),
- pointer_default(unique),
- custom(0F21F359-AB84-41e8-9A78-36D110E6D2F9,
- "Wrox.ProCSharp.COMInterop.Server.IWelcome")
- ]
- __interface IWelcome : IDispatch
- {
- [id(1)] HRESULT Greeting([in] BSTR name, [out, retval] BSTR* message);
- };
- // CCOMDemo
- [
- coclass,
- threading("apartment"),
- vi_progid("COMServer.COMDemo"),
- progid("COMServer.COMDemo.1"),
- version(1.0),
- custom(0F21F359-AB84-41e8-9A78-36D110E6D2F9,
- "Wrox.ProCSharp.COMInterop.Server.COMDemo"),
- uuid("2388AAA8-AD72-4022-948D-555316F708E8"),
- event_source("com"),
- helpstring("COMDemo Class")
- ]
- class ATL_NO_VTABLE CCOMDemo :
- public IWelcome, public IMath
- {
- public:
- CCOMDemo()
- {
- }
- __event __interface _ICompletedEvents;
- void FireCompleted()
- {
- __raise Completed();
- }
- DECLARE_PROTECT_FINAL_CONSTRUCT()
- HRESULT FinalConstruct()
- {
- return S_OK;
- }
-
- void FinalRelease()
- {
- }
- public:
- STDMETHOD(Greeting)(BSTR name, BSTR* message);
- STDMETHOD(Add)(LONG val1, LONG val2, LONG* result);
- STDMETHOD(Sub)(LONG val1, LONG val2, LONG* result);
- };