Valhalla Legends Forums Archive | Visual Basic Programming | Creating Objects in Classes

AuthorMessageTime
FrostWraith
Is it possible to directly call the ocx that is used in creating an object and create the object without including the actual control within your project?  I need this because of my limited user account at school will make VB crash if I try to include those controls.  I suppose if this isn't possible, I will need to move onto a lower level language soon as I have lately been pissed at VB's limitations.
December 13, 2006, 3:12 AM
Myndfyr
It depends.  If you're using Windows XP at school, it is possible to use a technology called Registration-Free COM that was discussed in the MSDN Magazine issue I linked you to.  Whereas COM (which is the underlying technology behind ActiveX and .ocx files) has traditionally required you to introduce several registry entries (which you apparently are being rebuffed by since you're at school), Windows XP supports the use of Application Manifests, which are XML files that enable an application to opt for local rather than registry-based settings.  (These files also enable support for technologies like Side-by-Side versioning and Windows XP Visual Styles).

Unfortunately the article deals primarily with using Reg-Free COM from .NET applications in Visual Studio 2005 since that's what Microsoft is really pushing these days.  Still, the sample code should include an application manifest.

Note that this will help you with running the application - I don't know what you could do for developing one, except maybe tack on an application manifest to the Visual Basic 6 IDE.
December 13, 2006, 9:31 AM
TheMinistered
IIRC, I think its possible to reference the ocx as if it were a dll.  Then you should be able to create instances of objects, where the classes are located in the ocx library.  Try this, I don't have vb6 installed atm and I'm double checking the technique with other sources atm.  I'll let you know when I find out and if there is any other way around this.

Also, if this is indeed possible, some ocxs fire events.  One example being winsock,  DataArrival, SendComplete, etc.  If you want to handle these events even though you created the object manually here is how you do it.
[code]
Private WithEvents Object as Class
...
Set Object = New Class
...
[/code]

You should be able to process events now... I'll be back with the info on possibility of this soon as I can, until then gl.
January 3, 2007, 4:11 PM

Search