Solved

Console application in VB6

Posted on 2004-10-01
8
304 Views
Last Modified: 2010-05-02
How do I make a console application using Sub Main() ?

I'd need something like:

Public Sub Main()
dim o as myObject
set o=createobject("myobjeclib.object")
...
o.method
PrintToConsole o.property
..
set o=Nothing
End Sub
0
Comment
Question by:gregajesih
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 10

Accepted Solution

by:
Clif earned 100 total points
ID: 12199985
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12200370
There are plenty of examples in VB where you create a new console and then write to it.

If you what you are looking for is a VB app that can write to the DOS window from where it was run then you are out of luck.

~IM
0
 

Author Comment

by:gregajesih
ID: 12200686
Well, almost. Thanks. But I did not mention that I'd appreciate that application is run within the same cmd window.
So a session stating which program was run and print command$ would be something like:

c:\>console.exe "some_text"
Console.exe program v1.0
some_text

c:\>
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12200709
It can't be done in VB6.

~IM
0
 
LVL 10

Expert Comment

by:Clif
ID: 12200744
I beg to differ.

The code example from the site I posted indeed writes to the console (ie DOS screen)
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 50 total points
ID: 12200781
You are right Clif.

The code you provided does indeed write to a console...but it is a console created by the application.

What gregajesih is looking for is a way for the app to write the same DOS window from which it was called.  If you open up a DOS prompt and run the program by typing in its name, then the app should be able to output to that same window.

I have yet to see an example of this done in VB6.

~IM
0
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 100 total points
ID: 12203930
If you need a true console application why not use Visual Studio to create one in C?
All you need do is write the functionality in VB and have it translated here or in the C topic area.

I agree that a true console app is not supported in VB.  It would be easier to learn a few lines in C than hacking through a VB console interface.
0
 
LVL 12

Expert Comment

by:jkaios
ID: 12216425
VB.Net is got a nice one!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

726 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