Determine and Changing the Class ID in Visual Basic 6

Visual Basic is very old programming language but still sometimes we need it like a good old friend.

I will demonstrate how to Determine and Changing the Class ID in Visual Basic 6

Determining the VB6 OCX ClassID

To determine the OCX `ClassID` you have to search in the in `Registry` by control name.


For e.g. if you have control name ABC.ocx if you search it by name you will get the `ClassID`.

Note: You can find the Windows Registry by typing the command ‘regedit’ in  Run.

Changing a VB6 OCX ClassID

If you have made some changes in the `ActiveX` and want new `ClassID` you have to set the `Version`
`Compatibility: No Compatibility`,

in *Properties -> Component ->Version Compatibility



ActiveX Registration App


I was working on a project in which I have to modify the ActiveX and then register it via the Command Prompt. Which very awkward and time-consuming. Therefore I have created this ActiveX registration App:


  • Visual Studio 2008
  • Language: C#
  • Dot Net Framework 3.5


Just Unzip and start use and enjoy.

and please share with others.

and don’t forget to comment or recommend.



How to add a method to an ActiveX (ocx)

In the programming world, there are many ways to perform a task.

Prerequisites: Language: C++ and I have used VisualStudio2008.

First, create a Project (MFC ActiveX control). Then to add a method to your ActiveX control you have to follow the following steps:

  1.  Declare the function in the header file.


int Connect(int timeout);

2. Add the definition in the CPP file.

int CSLWebLinkCtrl::Connect(int timeout)

// Your logic here.

return 0;
3. Expose your methods in the .idl file

[id(4), helpstring(“method Connect”)] int Connect(int timeout);
Hope it will help you. 🙂