#include "nsISupports.idl"
[scriptable,uuid(8CE2C123-8386-44EC-AACB-04D8EAFF58B5)]
interface IMyComponent : nsISupports
{
long Add(in long a , in long b);
};
/*Component.h*/
#pragma once
#ifndef _MY_COMPONENT_H_
#define _MY_COMPONENT_H_
#include "IMyComponent.h"
#define MY_COMPONENT_CONTRACTID "@wangwei/XPCOMSample/MyComponent;1"
#define MY_COMPONENT_CLASSNAME "A Simple XPCOM Sample"
#define MY_COMPONENT_CID {0x8ce2c123, 0x8386, 0x44ec, { 0xaa, 0xcb, 0x04, 0xd8, 0xea, 0xff, 0x58, 0xb5 }}
class MyComponent : public IMyComponent
{
public:
NS_DECL_ISUPPORTS //声明ISuppotrs接口的方法,包含mRefCnt
NS_DECL_IMYCOMPONENT //声明IMyComponent接口方法
MyComponent(void);
~MyComponent(void);
};
#endif
/*MyComponent.cpp*/
#include "Component.h"
MyComponent::MyComponent(
xpcom组件样例
最新推荐文章于 2023-01-09 12:46:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)