⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 robot.h

📁 Visual_C++[1].NET_Bible1 Visual_C++宝典书中的全部源码
💻 H
字号:
// Robot.h : Declaration of the CRobot

#pragma once
#include "resource.h"       // main symbols


// IRobot
[
	object,
	uuid("9913C8F7-CE4A-4C25-A112-6AFCC4201FD5"),
	dual,	helpstring("IRobot Interface"),
	pointer_default(unique)
]
__interface IRobot : IDispatch
{
	[propget, id(1), helpstring("property BatteryLife")] HRESULT BatteryLife([out, retval] LONG* pVal);
	[propput, id(1), helpstring("property BatteryLife")] HRESULT BatteryLife([in] LONG newVal);
	[id(2), helpstring("method Speak")] HRESULT Speak([in] BSTR bstrSpeech);
};



// CRobot
[
	coclass,
	threading("apartment"),
	vi_progid("RobotServer.Robot"),
	progid("RobotServer.Robot.1"),
	version(1.0),
	uuid("3208C53E-41AF-4841-A0D3-C162FB786FAF"),
	helpstring("Robot Class")
]
class ATL_NO_VTABLE CRobot : 
	public IRobot
{
public:
	CRobot() : m_nBatteryLife(100)
	{
	}

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}
	
	void FinalRelease() 
	{
	}

public:

	STDMETHOD(get_BatteryLife)(LONG* pVal);
	STDMETHOD(put_BatteryLife)(LONG newVal);
private:
	long m_nBatteryLife;
public:
	STDMETHOD(Speak)(BSTR bstrSpeech);
};

⌨️ 快捷键说明

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