Click here to Skip to main content
12,394,978 members (62,467 online)
Click here to Skip to main content

Stats

912.1K views
18.4K downloads
417 bookmarked
Posted

A Complete ActiveX Web Control Tutorial

, 21 Jun 2006
This article is intended to help you get up to speed quickly with developing an ActiveX control. It will show you the basic concepts you need to know about ActiveX, such as methods, properties, and events, and how to communicate between an ActiveX control and a web page.
MyActiveX
MyActiveX
MyActiveX.def
MyActiveXCtrl.bmp
ProcessingProgressBar.gif
Release
mt.dep
MyActiveX.ocx.intermediate.manifest
MyActiveX.tlb
myactivex.inf
release
MyActiveX.exp
MyActiveX.lib
MyActiveX.ocx
#pragma once
#include "maindialog.h"

// MyActiveXCtrl.h : Declaration of the CMyActiveXCtrl ActiveX Control class.


// CMyActiveXCtrl : See MyActiveXCtrl.cpp for implementation.

class CMyActiveXCtrl : public COleControl
{
	DECLARE_DYNCREATE(CMyActiveXCtrl)

// Constructor
public:
	CMyActiveXCtrl();

// Overrides
public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();
	virtual DWORD GetControlFlags();

// Implementation
protected:
	~CMyActiveXCtrl();

	DECLARE_OLECREATE_EX(CMyActiveXCtrl)    // Class factory and guid
	DECLARE_OLETYPELIB(CMyActiveXCtrl)      // GetTypeInfo
	DECLARE_PROPPAGEIDS(CMyActiveXCtrl)     // Property page IDs
	DECLARE_OLECTLTYPE(CMyActiveXCtrl)		// Type name and misc status

	// Subclassed control support
	BOOL IsSubclassedControl();
	LRESULT OnOcmCommand(WPARAM wParam, LPARAM lParam);

// Message maps
	DECLARE_MESSAGE_MAP()

// Dispatch maps
	DECLARE_DISPATCH_MAP()

// Event maps
	DECLARE_EVENT_MAP()

// Dispatch and event IDs
public:
	enum {
		eventidParameterLoaded = 1L,
		dispidLoadParameter = 3L,
		dispidOutputParameter = 2,
		dispidInputParameter = 1
	};
public:
	CMainDialog m_MainDialog;
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
protected:
	void OnInputParameterChanged(void);
	CString m_InputParameter;
	void OnOutputParameterChanged(void);
	CString m_OutputParameter;
	void LoadParameter(void);

	void FireParameterLoaded(void)
	{
		FireEvent(eventidParameterLoaded, EVENT_PARAM(VTS_NONE));
	}
};

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

Share

About the Author

David Marcionek
Web Developer
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160721.1 | Last Updated 21 Jun 2006
Article Copyright 2006 by David Marcionek
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid