Click here to Skip to main content
15,898,010 members
Articles / Desktop Programming / ATL

Hello World in COM using ATL

Rate me:
Please Sign up or sign in to vote.
4.41/5 (30 votes)
21 Apr 20042 min read 198.1K   4.7K   56  
The objective of this tutorial is to demonstrate how to build a COM Server and an MFC Client using Visual C++ 6.0. We are going to develop a COM server that takes in a string as input parameter and returns the string prefixed with a "Hello".
// mfcclientDlg.h : header file
//

#if !defined(AFX_MFCCLIENTDLG_H__1638ED46_43E1_11D6_89B2_00010302158B__INCLUDED_)
#define AFX_MFCCLIENTDLG_H__1638ED46_43E1_11D6_89B2_00010302158B__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CMfcclientDlg dialog

class CMfcclientDlg : public CDialog
{
// Construction
public:
	CMfcclientDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CMfcclientDlg)
	enum { IDD = IDD_MFCCLIENT_DIALOG };
	CString	m_edit;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMfcclientDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CMfcclientDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	virtual void OnOK();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_MFCCLIENTDLG_H__1638ED46_43E1_11D6_89B2_00010302158B__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
Product Manager
India India
Imran is a software professional with 9 years of development experience and has worked on JAVA, VB6, VC6, C# & some JavaScript.

He is interested in Hi-Performance code, OO Methodology, OS API's, Optimizing Windows, Tweaking IE.

For the last few years Imran has specialized in developing robust, hi-performance applications & GUI's (Swing) for MNC's.

http://techspot121.blogspot.com/

Comments and Discussions