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

📄 dispsimple.cpp

📁 Thinkinc++English 电子书籍,英文版
💻 CPP
字号:
// DispSimple.cpp : implementation file
//

#include "stdafx.h"
#include "Simple5.h"
#include "DispSimple.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDispSimple

IMPLEMENT_DYNCREATE(CDispSimple, CCmdTarget)

CDispSimple::CDispSimple()
{
	EnableAutomation();
	
	// To keep the application running as long as an OLE automation 
	//	object is active, the constructor calls AfxOleLockApp.
	
	AfxOleLockApp();
}

CDispSimple::~CDispSimple()
{
	// To terminate the application when all objects created with
	// 	with OLE automation, the destructor calls AfxOleUnlockApp.
	
	AfxOleUnlockApp();
}


void CDispSimple::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CCmdTarget::OnFinalRelease();
}


BEGIN_MESSAGE_MAP(CDispSimple, CCmdTarget)
	//{{AFX_MSG_MAP(CDispSimple)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CDispSimple, CCmdTarget)
	//{{AFX_DISPATCH_MAP(CDispSimple)
	DISP_FUNCTION(CDispSimple, "Add", Add, VT_I4, VTS_I4 VTS_I4)
	DISP_FUNCTION(CDispSimple, "Upper", Upper, VT_BSTR, VTS_BSTR)
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IDispSimple to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {F5B5509F-946E-49C7-A9A6-305758CD5EA1}
static const IID IID_IDispSimple =
{ 0xf5b5509f, 0x946e, 0x49c7, { 0xa9, 0xa6, 0x30, 0x57, 0x58, 0xcd, 0x5e, 0xa1 } };

BEGIN_INTERFACE_MAP(CDispSimple, CCmdTarget)
	INTERFACE_PART(CDispSimple, IID_IDispSimple, Dispatch)
END_INTERFACE_MAP()

// {E7EB0655-974A-47A5-B66A-10D3D321E45D}
IMPLEMENT_OLECREATE(CDispSimple, "Simple5.DispSimple", 0xe7eb0655, 0x974a, 0x47a5, 0xb6, 0x6a, 0x10, 0xd3, 0xd3, 0x21, 0xe4, 0x5d)

/////////////////////////////////////////////////////////////////////////////
// CDispSimple message handlers

long CDispSimple::Add(long n1, long n2) 
{
	return n1 + n2;
}

BSTR CDispSimple::Upper(LPCTSTR str) 
{
	CString strResult(str);
	strResult.MakeUpper();

	return strResult.AllocSysString();
}

⌨️ 快捷键说明

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