Click here to Skip to main content
15,895,709 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 311.3K   8.7K   226  
Explains how to develop applications that support plug-ins
#pragma once
#include "afxcmn.h"

#include "PlugSDI.h"

#include "DLLManager.h"
#include "ListCtrlEx.h"

// CPlugInSelectDialog dialog

class CPlugInSelectDialog : public CDialog
{
	DECLARE_DYNAMIC(CPlugInSelectDialog)

public:
	CPlugInSelectDialog(CWnd* pParent = NULL);   // standard constructor
	virtual ~CPlugInSelectDialog();

// Dialog Data
	enum { IDD = IDD_PLUG_IN };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
	// Used to hold the list of images for the plug-in list items
	CImageList *m_pImageList;
	// Used to hold the list of images for the plug-in list header
	CImageList *m_pImageHdrSmall;
	// Used to hold the valid filenames (Full Path) of DLLs found
	CStringList m_szListValidFilenames;
	// Used to hold the plug-in Name as reported by the Plug-In manager
	CStringList m_szPlugInName;
	// Used to hold the only the plug-in filename (Not full path) of DLLs currently "loaded"
	CStringList m_szListDLLCurrentlyLoaded;

public:
	virtual BOOL OnInitDialog();
	// Used to hold the Plug In list control object
	CListCtrlEx m_PlugInList;
	// Used to fill the list control with available Plug Ins
	void FillPlugIns(void);
	// Used to find all available DLLs and store them in a list
	int FindDLLs(CPlugSDIApp *pApp);
	// Used to load all available DLLs
	bool LoadDLLs(CPlugSDIApp *pApp, CStringList *szListSelectedDLLs);

protected:
	// Used to hold the number of Plug Ins (DLLs) found
//	int m_nNumberOfDLLs;
	// Used to hold pointers to loaded DLLs
//	DLLManager	*m_pLoadedDLLs;

public:
	// Used to modify list control's header items
	void ModifyHeaderItems(void);
	afx_msg void OnBnClickedPlugInLoad();
};

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