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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Winsock without a Form

Status
Not open for further replies.

TimJr

Programmer
Feb 22, 2002
21
0
0
US
I'm trying to have a DLL create a client winsock without using a Form.
The reason for this is that I would like to have the DLL "Run Unattended". This is a option box which if selected, I've found, enhances perform of the DLL.

Is it possible to use the Winsock Active X control without a form?
 
Have you tried setting a reference to its library in teh references box instead of the components box?

If you can't find it, just browse to the ocx or dll.

If it works then just declare the winsock 'withevents' and see how it goes. I've done this with an activex control before, which worked fine.
Greetings,
Rick
 
If it works for 1 it should work for all -- RIGHT?
YEH RIGHT!

I'll give it a shot.

Thanks!
 
Have you ever try to create de Winsock object in runtime? You can create a property in your class that could contain the Winsock object, and you can create the object in then Init event of the class, like:


Public WSock As Object

Private Sub Class_Initialize()
Set WSock = CreateObject("MSWinsock.Winsock")
End Sub
Private Sub Class_Terminate()
Set WSock = Nothing
End Sub

You could access to all the methods of properties of the Winsock control without having a reference, i.e., if then name of your class is WSManager, you will create an object where is your option box, like, (Dim objWSM as New WSManager), and finally, you can call the Connect method thus: objWSM.WSock.Connect, or ever method or property from the Winsock object.

Good luck!
 
>If it works for 1 it should work for all

Just reword that to: If it works for 1 it should work for some

As Rick suggests, trying it out is normally the quickest way to find out which ones it works for; some of the controls absolutely require a hosting form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top