Solved

Who can my commtrol of ActiveX work?

Posted on 1998-12-22
4
461 Views
Last Modified: 2008-02-26
The following code run on computers which installed VC5.0, it works.
*************************************************
CCommCtrl   m_commctrl;
if (!m_commctrl.Create(NULL,0,CRect(0,0,0,0),this,ID_COMMCTRL))
      {
            AfxMessageBox("Failed to create OLE Communications Control");
            return -1;      // fail to create
      }
*****************************************
But on other computers which not installed VC, it failed. I did the register of activeX of Microsoft Comm Control 5.0 on all the computers. What is the solution? Thank you very much!
0
Comment
Question by:hua120298
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
murrayc earned 20 total points
ID: 1180816
The control needs to be licensed. Use the other form of Create(), using a license string read with the Licreqst sample/utility. See Q151771 in the MS Knowledge Base, which should show you where to get Licreqst.

For instance:

WCHAR pwchLicenseKey[] =
{
0x0001,      0x0001,      0x0001,      0x0001,      0x0001,      0x0001,      
0x0001,      0x0001,      0x0001,      0x0001,      0x0001,      0x0001,      
0x0001,      0x0001,      0x0001,      0x0001,      0x0001,      0x0001,      
0x0001, 0
}; // I have changed it to all 0x0001, rather than publish it on the web, but I think it is the same on all PCs.

CString strLicense(pwchLicenseKey);
BSTR bstrLicense = strLicense.AllocSysString();

bTest = m_MSCommWrapper.Create(_T("MSComm"),WS_CHILD, CRect(0,0,10,10), this, IDC_MSCOMM, NULL, FALSE, bstrLicense);

Note that Visual Basic includes run-time licenses automatically when you put an MSCommCtrl on a form.
0
 

Author Comment

by:hua120298
ID: 1180817
Hi, murrayc,
I still donot know where the "Q151771 in the MS Knowledge Base" is. would you give me the web address?

Thanks.
0
 

Author Comment

by:hua120298
ID: 1180818
I tried the licence, but it still cannot work unless I change the licence string to NULL.

What is the reason?
0
 

Expert Comment

by:murrayc
ID: 1180819
Search for Q151771 at http://search.microsoft.com/default. Search in "Support & the Knowledge Base".

Maybe you already have Licreqst. If so, make sure that you add a terminating null if you use it in the above technique.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now