Solved

Console application in VB6

Posted on 2004-10-01
8
297 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
 
LVL 85

Expert Comment

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

~IM
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

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

14 Experts available now in Live!

Get 1:1 Help Now