Click here to Skip to main content
15,886,110 members
Articles / Desktop Programming / MFC

Plug-In framework using DLLs

Rate me:
Please Sign up or sign in to vote.
4.84/5 (39 votes)
25 Jun 200211 min read 309.8K   8.7K   226  
Explains how to develop applications that support plug-ins
// Plug_In_1.h : main header file for the Plug_In_1 DLL
//

#pragma once

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"		// main symbols

// CPlug_In_1App
// See Plug_In_1.cpp for the implementation of this class
//

class CPlug_In_1App : public CWinApp
{
public:
	CPlug_In_1App();
	~CPlug_In_1App();

// Overrides
public:
	virtual BOOL InitInstance();
	virtual int ExitInstance();

// Member variables
private:
	CToolBar *m_pwndToolBar;

public:
	// Used to set the pointer to main app's ToolBar object
	void SetToolBarPointer(CToolBar *pwndToolBar);
	// Used to add button to main app's toolbar
	void AddButtonToToolBar();
	// Used to remove button from main app's toolbar
	void RemoveButtonFromToolBar();
	// Used to call OnCmdMsg method of the App object
	void SendCmdMsgToPlugIn(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);

public:
	// Used by main app to get info about the button added by this DLL
	UINT GetToolBarButtonInfo(void);
	// Used to get the handle to the icon or the Plug-In
	HICON* GetPlugInIcon(void);
    DECLARE_MESSAGE_MAP()
	// Used to handle command messages sent by main app
	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
};

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
India India
Living in New Delhi (India). Did my Engg (Comp. Science) in 2000, and since then working on and off with VC++. It's my passion, and would really love to learn it to the very detail. Presently working as a software engg in a Telecom based firm. I've got around 3yrs experience in NMS (network management systems). Well thats all about me for now. Feel free to contact me...

Comments and Discussions