我来看别人的项目,看到一个 类CMSComm,看不除是怎么添加的:因为看上去不像从MFC CLASS的,也 像 是Generic CLASS类的 ;也不像是Form class类型的 !这个类的头文件里面居然没有 构造函数和析构函数;为什么啊?从那生成的啊???
   我 把头文件复制下来了 :
        #if !defined(AFX_MSCOMM_H__4E6FD5FA_DD10_4C62_BBFE_C739C75B1449__INCLUDED_)
#define AFX_MSCOMM_H__4E6FD5FA_DD10_4C62_BBFE_C739C75B1449__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++// NOTE: Do not modify the contents of this file.  If this class is regenerated by
//  Microsoft Visual C++, your modifications will be overwritten./////////////////////////////////////////////////////////////////////////////
// CMSComm wrapper classclass CMSComm : public CWnd
{
protected:
DECLARE_DYNCREATE(CMSComm)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x648a5600, 0x2c6e, 0x101b, { 0x82, 0xb6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }// Attributes
public:// Operations
public:
void SetCDHolding(BOOL bNewValue);
BOOL GetCDHolding();
void SetCommID(long nNewValue);
long GetCommID();
void SetCommPort(short nNewValue);
short GetCommPort();
void SetCTSHolding(BOOL bNewValue);
BOOL GetCTSHolding();
void SetDSRHolding(BOOL bNewValue);
BOOL GetDSRHolding();
void SetDTREnable(BOOL bNewValue);
BOOL GetDTREnable();
void SetHandshaking(long nNewValue);
long GetHandshaking();
void SetInBufferSize(short nNewValue);
short GetInBufferSize();
void SetInBufferCount(short nNewValue);
short GetInBufferCount();
void SetBreak(BOOL bNewValue);
BOOL GetBreak();
void SetInputLen(short nNewValue);
short GetInputLen();
void SetNullDiscard(BOOL bNewValue);
BOOL GetNullDiscard();
void SetOutBufferSize(short nNewValue);
short GetOutBufferSize();
void SetOutBufferCount(short nNewValue);
short GetOutBufferCount();
void SetParityReplace(LPCTSTR lpszNewValue);
CString GetParityReplace();
void SetPortOpen(BOOL bNewValue);
BOOL GetPortOpen();
void SetRThreshold(short nNewValue);
short GetRThreshold();
void SetRTSEnable(BOOL bNewValue);
BOOL GetRTSEnable();
void SetSettings(LPCTSTR lpszNewValue);
CString GetSettings();
void SetSThreshold(short nNewValue);
short GetSThreshold();
void SetOutput(const VARIANT& newValue);
VARIANT GetOutput();
void SetInput(const VARIANT& newValue);
VARIANT GetInput();
void SetCommEvent(short nNewValue);
short GetCommEvent();
void SetEOFEnable(BOOL bNewValue);
BOOL GetEOFEnable();
void SetInputMode(long nNewValue);
long GetInputMode();
};//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_MSCOMM_H__4E6FD5FA_DD10_4C62_BBFE_C739C75B1449__INCLUDED_)源文件的一部分:
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++// NOTE: Do not modify the contents of this file.  If this class is regenerated by
//  Microsoft Visual C++, your modifications will be overwritten.
#include "stdafx.h"
#include "mscomm.h"/////////////////////////////////////////////////////////////////////////////
// CMSCommIMPLEMENT_DYNCREATE(CMSComm, CWnd)/////////////////////////////////////////////////////////////////////////////
// CMSComm properties/////////////////////////////////////////////////////////////////////////////
// CMSComm operations
   

解决方案 »

  1.   

    VS 自动生成的,使用 ActiveX 控件的话..
      

  2.   

    那个是 添加的 ActiveX控件 
    看看这个 网页
    http://www.vckbase.com/document/viewdoc/?id=1193
      

  3.   

    我用的是vc6.0怎么生成的 啊 ?能说 具体一点吗??ActiveX 我 不 懂,你告诉我 具体 是怎么实现的??拜托了 
      

  4.   

    打开“Project->Add To Project->Components and Controls->Registered Activex Controls”,然后选择控件:Microsoft Communication Control,version 6.0插入到当前的工程中。这样就将类 CMSComm 的相关文件 mscomm.cpp 和 mscomm.h 一并加入到了工程中。编程时只需将控件对话中的 MSComm 控件拖至你的应用对话框中就OK了。
      

  5.   

    程序本身也说明:VC++自动生成的通信控件.是Cwnd的派生类.具体操作,4楼说得清楚!
      

  6.   

    使用MSComm控件时,VC自动生成的。