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
Solved

Console application in VB6

Posted on 2004-10-01
8
303 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
8 Comments
 
LVL 10

Accepted Solution

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

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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 85

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 85

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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