• Welcome to Valhalla Legends Archive.
 

Creating Objects in Classes

Started by FrostWraith, December 12, 2006, 09:12 PM

Previous topic - Next topic

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.

MyndFyre

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

TheMinistered

#2
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.

Private WithEvents Object as Class
...
Set Object = New Class
...


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.