Solved

Change GUID in VStudio C++ OCX

Posted on 2004-10-05
2
1,308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

719 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