CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: MSComm32.OCX

  1. #1
    Join Date
    May 1999
    Posts
    8

    MSComm32.OCX

    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.


  2. #2
    Join Date
    Feb 2000
    Location
    Sydney Australia
    Posts
    5

    Re: MSComm32.OCX

    I beleive this is a runtime lisencing issue. Only when the ocx is inserted onto a dialog or form view will it work on a machine without VC++ or VB etc.

    Best regards,

    strud

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured