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

📄 sort1.cpp

📁 《VC++ 编程技巧与示例 .rar》各个示例代码绝对可用
💻 CPP
字号:
// Sort1.cpp : implementation file
//

#include "stdafx.h"
#include "ASDll.h"
#include "Sort1.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSort

IMPLEMENT_DYNCREATE(CSort, CCmdTarget)

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

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


void CSort::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(CSort, CCmdTarget)
	//{{AFX_MSG_MAP(CSort)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CSort, CCmdTarget)
	//{{AFX_DISPATCH_MAP(CSort)
	DISP_PROPERTY_NOTIFY(CSort, "LargerNumerber", m_largerNumerber, OnLargerNumerberChanged, VT_R8)
	DISP_FUNCTION(CSort, "Sort", Sort, VT_R8, VTS_R8 VTS_R8)
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

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

// {C6A9D8F3-C356-11D3-9462-0000000038B2}
static const IID IID_ISort =
{ 0xc6a9d8f3, 0xc356, 0x11d3, { 0x94, 0x62, 0x0, 0x0, 0x0, 0x0, 0x38, 0xb2 } };

BEGIN_INTERFACE_MAP(CSort, CCmdTarget)
	INTERFACE_PART(CSort, IID_ISort, Dispatch)
END_INTERFACE_MAP()

// {C6A9D8F4-C356-11D3-9462-0000000038B2}
IMPLEMENT_OLECREATE(CSort, "ASDll.Sort", 0xc6a9d8f4, 0xc356, 0x11d3, 0x94, 0x62, 0x0, 0x0, 0x0, 0x0, 0x38, 0xb2)

/////////////////////////////////////////////////////////////////////////////
// CSort message handlers

double CSort::Sort(double x0, double x1) 
{
	// TODO: Add your dispatch handler code here
	CString str;
	double t;
	t=x1;
	if(x0>x1)
	{
		t=x0;
		x0=x1;
		x1=t;
	}
	m_largerNumerber=t;
	str.Format ("DLL自动化服务器:大数为:%f",t);
	AfxMessageBox(str);
	return t;
}

void CSort::OnLargerNumerberChanged() 
{
	// TODO: Add notification handler code

}

⌨️ 快捷键说明

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