Click to See Complete Forum and Search --> : Error "Fail to create empty document", MSCOMM32.ocx problem


TOHCS
May 17th, 1999, 01:15 AM
I used the mscomm32.ocx in a SDI application and create an instance control dynamically in the CMainFreame. The code are as below:

//add in code to MainFrame.cpp
// add eventsink map to hook OnComm event
BEGIN_EVENTSINK_MAP(CMainFrame, CFrameWnd)
ON_EVENT(CMainFrame, ID_COMMCTRL, 1 /* OnComm */, OnComm1, VTS_NONE)
END_EVENTSINK_MAP()

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//addin code
if(!m_commctrl.Create(NULL,0,CRect(0,0,0,0),this,ID_COMMCTRL))
{
TRACE0("Failed to create OLE Communication Control\n");
return -1;
}

}
void CMainFrame::OnComm1()
{
}
//---------------
//addin code in mainframe.h
#define ID_COMMCTRL 2001 // Ctrl ID for comm control

protected: // control bar embedded members
CMSComm m_commctrl;

// Generated message map functions
protected:
afx_msg void OnComm1();

DECLARE_EVENTSINK_MAP()
My program work well on PC which have VC but given an error "Fail to create empty document" on PC whcih don't have VC installed. I'm sure that I already copied all needed dll and mscomm32.ocx files to system directory and also regster the mscomm32.ocx to the registry.

If a dialog bax application is develop then no error shown on the PC without VC++ . If any one know what wrong in my program, please help me in this. Thank you.

Robert Rolls
May 17th, 1999, 04:09 AM
It's a licensing issue - you need to create the control on the client machine supplying the license key in the create call! The Dlg works because it save the license info in the DLGINIT block within the rc file.