Question : Change GUID in VStudio C++ OCX

Hi

A seeming simple thing, but I can't find a reference on how to do this.

I wrote and ActiveX control in Visual Studio 6.  I want to break off from the current interface and create a newly referenced control...new name, new GUID.

The ODL file has lines as follows:

[ uuid(11518DD5-DD1F-11D4-9B28-000000000000), version(1.1),
.
.
.
library RICHTEXTBOXLib
{
      importlib(STDOLE_TLB);
      importlib(STDTYPE_TLB);

      //  Primary dispatch interface for CRichTextBoxCtrl

      [ uuid(11518DD6-DD1F-11D4-9B28-000000000000),
.
.
.
      //  Event dispatch interface for CRichTextBoxCtrl

      [ uuid(11518DD7-DD1F-11D4-9B28-000000000000),
        helpstring("Event interface for RichTextBox Control") ]
.
.
.
      //  Class information for CRichTextBoxCtrl

      [ uuid(11518DD8-DD1F-11D4-9B28-000000000000),

Can I just generate a new set of GUIDs and replace these?  Are the sequential aspects of these existing GUIDS important?

Thanks

Answer : Change GUID in VStudio C++ OCX

you will need more than just replacing the guids in odl file:

1. First of all, yes, you need to replace all guids in odl file

2. Change the version of the control in guid file, for example version(1.0) to version(2.0)

3. In Ctl file (i.e. RichTextBoxCtl.cpp) change the following:

(A) IMPLEMENT_OLECREATE_EX macro to the new guid of the control in odl file. the guid you will need here from the odl file is the last guid in the odl file which is the control guid. You need also to change the control name from RICHTEXTBOX.1.0 for example to RICHTEXTBOX.2.0 in the same macro

(B) change the following guid definitions in the ctl file
const IID BASED_CODE IID_DRichTextbox =
            { the guid of the properties interface in the odl file (2nd guid) };
const IID BASED_CODE IID_DRichTextboxEvents =
            { the guid of the events interface in the odl file (3rd guid)};
Note you need to reformat the guid here, for example: a guid of
1AB2BB44-F870-4AC2-A912-094AA5666BE1 becomes:
{ 0x1ab2bb44, 0xf870, 0x4ac2, { 0xa9, 0x12, 0x9, 0x4a, 0xa5, 0x66, 0x6b, 0xe1 } }

3. In the app file (i.e. RichTextbox.cpp), you need to change the type library guid:
const GUID CDECL BASED_CODE _tlid =
            { the guid of the type library in the odl file (1st guid) };
const WORD _wVerMajor = 1; // change the version to the new version
const WORD _wVerMinor = 0;

4. change the guid for the default property page (i.e. RichTextboxPPg.cpp) to the new guid (you will need to create a new guid for the property page)
check IMPLEMENT_OLECREATE_EX macro

This should do it and create a fresh control.
Random Solutions  
 
programming4us programming4us