Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Change GUID in VStudio C++ OCX

Posted on 2004-10-05
2
Medium Priority
?
1,360 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

650 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