Winsock control and formless (windowless) applications

I'm trying to use the Winsock control in an application that has no forms (windows). My goal here is to be able to write server applications that load no windows into memory. Code samples and explanations would be helpful. Thanks.
--
Matt Nicholson
mnichols@cs.fit.edu
LVL 1
mnicholsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrmickCommented:
Matt, I assume you're writing a service that doesn't have a stdout or stdin.  To accomplish this you still must use a form, just don't show it.

What's the status on the Controlling Dos Window question?

0
mnicholsAuthor Commented:
Actually this project has nothing to do with controlling DOS windows. And being this is a Visual Basic project, there isn't such a thing as stdin or stdout. I've experimented with the WithEvents keyword when creating a Winsock control, and it appears to turn it into an object, but I can't quite get it to work. Also, I can't use the New keyword to create a new instance of the control, which I think is the key to getting it to work. Dropping a control on a window that has no visual inputs and is never shown is quite silly-- wastes memory. Besides, I'm trying to write an Active DLL, which isn't supposed to have forms anyways. I'm sure there's a way to do it, so I'm leaving the question open.

The DOS window controlling problem is still in the back of my head somewhere. I really want to accomplish it in Visual Basic so it's still up in the air if anyone wants to answer it.
--
Matt Nicholson
mnichols@cs.fit.edu
0
mrmickCommented:
Matt, by design, ActiveX controls MUST be placed on a from.

What I meant by no stdin and stdout is that when you install an app as a service on an NT machine, the app can either be interactive (have a console, read keyboard input etc) or have network access - but not both at the same time.  A service is usually written to survive even if nobody is logged in, thus, there is no console (window) for output or means of accepting user input except through a separate interface made available in the control panel.

I do not assume what you're doing now has anything to do with Dos, that remark was in reference to the other question that you asked and I answered several weeks ago.

... as for your " quite silly waste of memory" issue... you don't have to use the winsock control at all.  You can get all of the winsock's functionality straight from the API WSA calls, but it's much more difficult.  It would save you a few bytes of memory, but it will cost you many hours of development time.

If you are building a service for NT, I can tell you from experience because I have several that I've developed currently running on my server - the smallest VB program ran as a service will have about 2.5 MB of ram allocated to it by NT.  A hidden form will cost you about an extra 100 bytes.  I'm talking about the Form class not the code on the form because the code that handles the Winsock events would have to be there even if you could create a winsock object.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mnicholsAuthor Commented:
If you believe that hidden windows aren't anything to be concerned about as far as memory is concerned, then okay. I just thought it would be an accomplishment to be able to use controls without using forms. Thanks for the help.
--
Matt Nicholson
mnichols@cs.fit.edu
0
mrmickCommented:
Matt,

The form will add bytes to the project, but very minimal compared to the bytes allocated anyway.  Of course, I'm talking about an empty form - which is essentially what we're talking about because anything associated with the objects on the form (the winsock control) would be necessary even if you could create the objects without the form.

Why the "C"?
0
mnicholsAuthor Commented:
Well, the answer was acceptable, but not the one I was looking for. A code sample that would tell me exactly how to accomplish my task would deserve an A. Sorry, but I'm very demanding when it comes to answers
0
mrmickCommented:
hmmm...

I thought I covered the explanation part pretty well.  You expected a code example of placing a control on a form?  My answer may not have been what you wanted - but it was the correct answer to your question.

Very demanding?  Do you realize that those who answer questions here do not get paid?

I'll try to keep in mind, before I offer an answer to one of your questions again, that you have a tendency to slap those who help you when you don't like the answer - even when the answer is correct.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.