Click here to Skip to main content
15,897,334 members
Articles / Desktop Programming / ATL

Pluggable Components using Component Categories - Part II

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
18 Sep 20037 min read 82.8K   1.1K   46  
An article on using component categories to create pluggable components
// CommunicationsTestDlg.h : header file
//

#if !defined(AFX_COMMUNICATIONSTESTDLG_H__AE17A693_0273_43D0_97B1_DAB62B6DB666__INCLUDED_)
#define AFX_COMMUNICATIONSTESTDLG_H__AE17A693_0273_43D0_97B1_DAB62B6DB666__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Communications.h"

extern GUID guidLib;

/////////////////////////////////////////////////////////////////////////////
// CCommunicationsTestDlg dialog

class CCommunicationsTestDlg : public CDialog,
							public IDispEventImpl<1, CCommunicationsTestDlg, &DIID__ICommunicationEvents, &guidLib, 1, 0>
{
// Construction
public:
	CCommunicationsTestDlg(CWnd* pParent = NULL);	// standard constructor
	virtual ~CCommunicationsTestDlg();

// Dialog Data
	//{{AFX_DATA(CCommunicationsTestDlg)
	enum { IDD = IDD_COMMUNICATIONSTEST_DIALOG };
	CEdit	m_wndLog;
	CEdit	m_wndData;
	//}}AFX_DATA
	CComPtr<ICommunication>	m_pComm;
	CString m_strParams;
	CLSID	m_CLSID;
	
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCommunicationsTestDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CCommunicationsTestDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnSend();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	//}}AFX_MSG
	afx_msg void __stdcall OnCommConnected();
	afx_msg void __stdcall OnCommSend();
	afx_msg void __stdcall OnCommReceive(/*LPCTSTR*/ BSTR bstrData);
	afx_msg void __stdcall OnCommClose();
	DECLARE_MESSAGE_MAP()

public:
	BEGIN_SINK_MAP(CCommunicationsTestDlg)
		SINK_ENTRY_EX(1, DIID__ICommunicationEvents, 1 /* OnConnected */, OnCommConnected)
		SINK_ENTRY_EX(1, DIID__ICommunicationEvents, 2 /* OnSend */, OnCommSend)
		SINK_ENTRY_EX(1, DIID__ICommunicationEvents, 3 /* OnReceive */, OnCommReceive)
		SINK_ENTRY_EX(1, DIID__ICommunicationEvents, 4 /* OnClose */, OnCommClose)
	END_SINK_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_COMMUNICATIONSTESTDLG_H__AE17A693_0273_43D0_97B1_DAB62B6DB666__INCLUDED_)

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
United States United States
I started programming at 15 with a TI-82 calclator in Z80 assembly (oh, those were the days . . .) I am pretty much a self taught programmer. I've taught myself Visual Basic, C/C++, Java, and am currently working on C#. I also like to experiment with system administration and security issues, and occassionally I work on web design. For the last 4 years, I have worked for Leitch, Inc. as a Software Engineer and graduated from Old Dominion University with bachelor's degrees in Computer Science, Mathematics, and Business Management in December of 2004.

Comments and Discussions