Solved

Change GUID in VStudio C++ OCX

Posted on 2004-10-05
2
1,275 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:rmichels
2 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 12235000
You can generate new GUIDs and replace existing. Sequence doesn't matter - GUIDs are not compared in COM.
For example, Visual Basic generates new GUIDs for COM Library in every build if "No compatibility" option is selected. The result is completely new COM component (even if it has the same name).
0
 
LVL 6

Accepted Solution

by:
nabehs earned 125 total points
ID: 12235201
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.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 125
Detect CR LF to each line 12 160
fizzArray  challenge 1 83
Use of condition with 'serial' in ansible 2 60
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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