Link to home
Start Free TrialLog in
Avatar of msiman
msiman

asked on

How the ClassID of an OCX is determined?

Does someone know how the compiler decides what ClassId to give a certain OCX?
and how it guards that the number stays unique?
Avatar of simonbennett
simonbennett

It uses a 128 bit 'random' generator that uses the system time, serial number, HD identifier and free bytes on the HD to produce the alphanumeric 'GUID' (globally unique identifier) - the same process can be seen for example in MS Access replication. The chanes of a duplicate are supposidly 10 to the power of 21 of a dupe occuring.

All Hail To Billy
Avatar of msiman

ASKER

So why everywhere i install my OCX, it keeps its
ClassID?

Thats because it is created when it is compiled. Once created the GUID does not change. That process uses information from the development machine.
..sorry, depending on your compatability settings - i.e No Compatability will keep the guid the same for example...
Avatar of msiman

ASKER

OK...
I will refine my question, so i raised a little the points.
I want to be able to change the CLassID of an OCX manually.
is it possible? if yes, then  how?

Nope. And if you did it would be risky...
Avatar of msiman

ASKER

sorry, but it must be possible. the compiler does it,
what can't I?
the ClassID is stored somewhere, right? so
it can be changed with the appropriate editor....
and i want to do so...
ASKER CERTIFIED SOLUTION
Avatar of simonbennett
simonbennett

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of msiman

ASKER

first' it doesn't work.
i created 2 OCXes, and wrote a program that calls one of them,
then i erased the first one, renmaed the second to be
the first, change its GUID to the GUID of the first one,
and i got an error. both had the same programming interface.
second, i am much more interested to know wheree the GUID is stored in the file...