Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / MFC

MFC GDI+ ActiveX Arrow Control For Excel

Rate me:
Please Sign up or sign in to vote.
4.11/5 (7 votes)
23 Oct 200410 min read 103.1K   3.8K   52  
An article on how to create an ActiveX control for Excel, and the technique to create an arrow using GDI+, some secondary school mathematics here, and some technique to link cell with Excel.
// ActiveXArrow.cpp : Implementation of CActiveXArrowApp and DLL registration.

#include "stdafx.h"
#include "ActiveXArrow.h"

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


CActiveXArrowApp NEAR theApp;

const GUID CDECL BASED_CODE _tlid =
		{ 0xfeb5e01b, 0xea8, 0x43e8, { 0x89, 0xa7, 0x22, 0x64, 0x72, 0x3e, 0x70, 0x2d } };
const WORD _wVerMajor = 1;
const WORD _wVerMinor = 0;


////////////////////////////////////////////////////////////////////////////
// CActiveXArrowApp::InitInstance - DLL initialization

BOOL CActiveXArrowApp::InitInstance()
{
	BOOL bInit = COleControlModule::InitInstance();

	if (bInit)
	{
		// TODO: Add your own module initialization code here.
	}

	return bInit;
}


////////////////////////////////////////////////////////////////////////////
// CActiveXArrowApp::ExitInstance - DLL termination

int CActiveXArrowApp::ExitInstance()
{
	// TODO: Add your own module termination code here.

	return COleControlModule::ExitInstance();
}


/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry

STDAPI DllRegisterServer(void)
{
	AFX_MANAGE_STATE(_afxModuleAddrThis);

	if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
		return ResultFromScode(SELFREG_E_TYPELIB);

	if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
		return ResultFromScode(SELFREG_E_CLASS);

	return NOERROR;
}


/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry

STDAPI DllUnregisterServer(void)
{
	AFX_MANAGE_STATE(_afxModuleAddrThis);

	if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
		return ResultFromScode(SELFREG_E_TYPELIB);

	if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
		return ResultFromScode(SELFREG_E_CLASS);

	return NOERROR;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Hong Kong Hong Kong
HI, my name is Hing, I am from Hong Kong.

I am graduated from the Hong Kong University of Science and Technology and my major is computer engineering.

I worked for few companies in my life and gained experience in different field:

Programming: C/C++, C#, Dephi, ActiveX, GDI+, Assembly
Hardware/electronic: Car device, GPS, HDTV/MPEG-2, electronic clock/watch, TENX, PICS, ARM9, ARM Linux ... etc

Comments and Discussions