经过注册还是不行?但是我试了其他控件是可以的,还有就是我把CCommCtrl换成CMSComm后,注册控件,后出现创建空文档失败: 主要代码如下: int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {//CMSComm m_commctrl; ............//#define IDC_COMM1 2001 // Create the MSCOMM32 OLE Control. if (!m_commctrl.Create(NULL,0,CRect(0,0,0,0),this,IDC_COMM1)) { TRACE0("Failed to create OLE Communications Control\n"); ::AfxMessageBox ("return -1"); return -1; // fail to create } // Set RThreshold property to 1. The default RThreshold value (0) // causes the OnComm event to NOT fire when a character is detected // in the serial port. m_commctrl.SetRThreshold(1); .......... } 问题出现在哪里?
手工注册如下
Regsvr32 *.ocx
主要代码如下:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{//CMSComm m_commctrl;
............//#define IDC_COMM1 2001
// Create the MSCOMM32 OLE Control.
if (!m_commctrl.Create(NULL,0,CRect(0,0,0,0),this,IDC_COMM1))
{
TRACE0("Failed to create OLE Communications Control\n");
::AfxMessageBox ("return -1");
return -1; // fail to create
} // Set RThreshold property to 1. The default RThreshold value (0)
// causes the OnComm event to NOT fire when a character is detected
// in the serial port.
m_commctrl.SetRThreshold(1);
..........
}
问题出现在哪里?