Solved

Who can my commtrol of ActiveX work?

Posted on 1998-12-22
4
485 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

829 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