Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference a component thru code?

Status
Not open for further replies.

ZemogSC

Programmer
Sep 29, 2003
30
US
Hey all,
I'm writing a console app (this question does not have anything to do with creating a console app, I am aware of the issues involved with that) and have a small problem. As a console app, the project has no forms. So, I cannot use the components to add the winsock functionality. If I do create the app normally (GUI not console) with a form , this is at the top portion of the form code (when viewed in a seperate text editor):

Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"

From what I see there, it is defining a registered object, and the file name is MSNWINSCK.OCX.

But as a "component" it needs to be placed on a form. I tried adding it at as "reference", but that failed because the "component" exists (even though it is not "checked").

Is there a way to make the same type of reference to the object that is placed in the header of the form, into a module?

Basically, how do I reference this object using code?

Any help would be appreciated.
 
> I am aware of the issues

If you are aware of the issues then you should also be aware that there is nothing in a console app that precludes it from having windows (or, in VB's case, forms); they don't have to be visible...

However, if you really don't want to even have a non-visible form, consider a late bind with CreateObject("mswinsock.winsock") (since the winsock control is one of several controls that does not require hosting on a form)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top