[RESOLVED] vb6 create objects without registration
I got an applications source code I found which uses references to controls. I want to be able to make the application portable and be able to run on other systems even if the controls are not installed or registered into the windows directory.
Several months back I found a way to use DLL and OCX in an application without referencing them in design time. this worked out very sucessful with my own programs, but I can't seem to work out how to use it with this. I'm trying to load TabCtl32.ocx at runtime with SSTab control using this code
Code:
Dim SSTab As Object
Set SSTab = CreateObjectFromFile("TabCtl32.ocx", "SSTab")
If SSTab Is Nothing Then Debug.Print " couldnt create object" Else Debug.Print "Created"
If I run this it says that it has been created, but I have no idea how to make it add tabs to my application. I can't work out how to add the object to my form.
The original article is no longer online. The attached zip file contains the articles files with example project.
1. The control should require registration if it is an ActiveX control, which it is.
2. Does this post help at all? Another problem you may encounter is after you successfully add the control, will be getting events for the control like click and mouse events for example.
Edited:
Why not just reference/add it in your project, build a Setup.exe and have it installed on the target PCs? Much easier and doing so will ensure it exists to be used.
Last edited by LaVolpe; Feb 1st, 2009 at 11:27 AM.
Insomnia is just a byproduct of, "It can't be done"
There are a couple of versions of that floating around, perhaps all by the same guy. I never cared for them because they are "desperation ploys" in my opinion. You can't use the Form or UserControl designers in the IDE with those techniques at all, you have to add the created controls to the Form/UserControl at runtime, you can't use design-time properties and property pages, wiring up events is a mess... the list goes on and on and on.
Beginning with WinXP there is an approved method of doing this. However Microsoft never bothered to create any VB6 IDE extensions to support it directly even though they developed the technique for VB6 to help alleviate DLL Hell. The only Microsoft tools with any support for it are in Visual Studio .Net versions starting with 2005 (I believe), where it is used to support COM Interop.
Microsoft has a number of articles on the subject of Registration-Free COM but they do not deal with the subject from a VB6 perspective directly. They offer little in the way of "how to" information of use to a VB6 programmer.
I know of two 3rd party tools for providing this capability:
As the names more than suggest, a key to this involves application and assembly manifests. Most VB6 programmers are probably only familiar with manifests in terms of a single use: selecting "XP styles" by loading the Common Controls version 6. But a lot more than just the CC6 element can go into an application manifest.
The concepts are simple enough, but the details are numerous and somewhat difficult to root out from published documentation. However I am a little surprised that there aren't additional tools for creating VB6 Reg-Free COM manifests yet. I can only assume that the VB6 community has shrunk to a point that few people are actually deploying applications to non-development machines anymore.
But to reiterate and amplify:
Reg-Free COM requires Windows XP (Home or Pro) or later. Some functionality is incomplete until XP SP2 (or Server 2003 R2). However from there onward it is stanadrd in Windows and fully supported in Vista, Server 2008, and has been tested and found working in Windows 7 Public Beta.
Re: [RESOLVED] vb6 create objects without registration
Originally Posted by aztectrev
I got an applications source code I found which uses
Set SSTab = CreateObjectFromFile("TabCtl32.ocx", "SSTab")
If SSTab Is Nothing Then Debug.Print " couldnt create object" Else Debug.Print "Created"[/CODE]
Any help would be appreciated
Thanks a million for your contribution.
Wonderful solution.
Re: [RESOLVED] vb6 create objects without registration
What's so wonderful about that solution? It creates an "SSTab" object at runtime but how do you place it on a form and populate it with other controls?
As far as I know, in order to add a new control on a form at runtime you need to use the "Controls.Add" method but that requires the control's ProgId as a parameter and you do not have a ProgId if the control is not registered.
Last edited by VanGoghGaming; Aug 2nd, 2024 at 07:06 PM.
Re: [RESOLVED] vb6 create objects without registration
Originally Posted by VanGoghGaming
What's so wonderful about that solution? It creates an "SSTab" object at runtime but how do you place it on a form and populate it with other controls?
As far as I know, in order to add a new control on a form at runtime you need to use the "Controls.Add" method but that requires the control's ProgId as a parameter and you do not have a ProgId if the control is not registered.
The point is not about headed component on headless style.
I was looking for CreateObjectFromFile() VB6 function to to add unregistered directshow filters on my video graph.