account.h

来自「演示了在VC中如何生成和调用com程序,代码简洁,方便.」· C头文件 代码 · 共 42 行

H
42
字号
// Account.h : Declaration of the CAccount

#ifndef __ACCOUNT_H_
#define __ACCOUNT_H_

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CAccount
class ATL_NO_VTABLE CAccount : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CAccount, &CLSID_Account>,
	public IDispatchImpl<IAccount, &IID_IAccount, &LIBID_BANKLib>
{
public:
	CAccount()
	{
		CurrentValue = 0;
	}

DECLARE_REGISTRY_RESOURCEID(IDR_ACCOUNT)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CAccount)
	COM_INTERFACE_ENTRY(IAccount)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()

// IAccount
public:
	STDMETHOD(get_CurrentAccount)(/*[out, retval]*/ double *pVal);
	STDMETHOD(put_CurrentAccount)(/*[in]*/ double newVal);
	STDMETHOD(Withdraw)(/*[in]*/double x);
	STDMETHOD(Deposit)(/*[in]*/double x);

protected:
	double CurrentValue;
};

#endif //__ACCOUNT_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?