更新时间:2015-11-14 22:00:23浏览次数:1+次
在C/C++语言中可以用这样的结构来描述:
typedef struct .GUID
{
DWORD Data1;
WORD Data2;
WORD Data3;
WORD Data4[8];
}GUID;
首先我们看看IUnknown的定义:
interface IUnknown
{
HRESULT QueryInterface([in]REFIID iid,[out]void **ppv);
ULONG AddRef(void);
ULONG Release(void);
}
为了方便理解和对照,我们同时给出IUnknown的C++定义的形式:
class IUnknown
{
public:
virtual HRESULT _stdcall QueryInterface(const IID& iid,void **ppv)=0;
virtual HRESULT _stdcall AddRef()=0;
virtual HRESULT _stdcall Release()=0;
};
IDictionary *pIDictionary = CreateObject(CLIST_Dictionary,IID_Dictionary);////创建对象
if(pIDictionary ==NULL)
return;
BOOL retValue = pIDictionary->LoadLibrary("...");
if(retValue ==FALSE)
{
pIDictionary->release();
return ;
}
....
ISpellCheck *pISpellCheck;
HRESULT result=pIDictionary->QuaryInterface(IID_SpellCheck,(void **)&pISpellCheck);
if(result!=S_OK)
{
pIDictionary->Release();
return ;
}
pIDictionary->Release();
pISpellCheck->Release();
................
代码内存结构图:
查找函数实现代码:
相关资讯