Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Console application in VB6

Posted on 2004-10-01
8
Medium Priority
?
309 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 300 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 150 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 300 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

618 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