Solved

Winsock control and formless (windowless) applications

Posted on 1998-02-08
7
451 Views
Last Modified: 2013-11-13
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
0
Comment
Question by:mnichols
  • 4
  • 3
7 Comments
 
LVL 8

Expert Comment

by:mrmick
ID: 1456473
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
 
LVL 1

Author Comment

by:mnichols
ID: 1456474
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
 
LVL 8

Accepted Solution

by:
mrmick earned 100 total points
ID: 1456475
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 1

Author Comment

by:mnichols
ID: 1456476
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
 
LVL 8

Expert Comment

by:mrmick
ID: 1456477
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
 
LVL 1

Author Comment

by:mnichols
ID: 1456478
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
 
LVL 8

Expert Comment

by:mrmick
ID: 1456479
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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now