[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Creating Dos app with VB

Posted on 2002-07-09
11
Medium Priority
?
171 Views
Last Modified: 2010-05-02
I am creating a Dos Program to make use of some of VBs objects, and am trying to error check it and send a text message to standard out.

Why will print not work in this case?  It is a simple program, and will run without the print statement.

Sub Main()
   Dim strArgs() As String
   
   Dim fName As String
   Dim newName As String
   
   strArgs = Split(Command$, " ")
   
   If strArgs(0) = "" Then
     Print "Error Message"
     
   fName = LCase(strArgs(0))
   newName = LCase(strArgs(1))
     
End Sub

The examples i have seen, the Print command is used like that.

Thanks,

Masterofhisdomain
0
Comment
Question by:masterofhisdomain
[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
11 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 7141808
The "Windows" print command requires a reference object, like a printer, form, or picturebox.

You may instead want to use MsgBox instead of Print in the above case.
0
 

Author Comment

by:masterofhisdomain
ID: 7141826
It will be uses as a DOS program, no GUI at all, i wish it were an option.

I just want to send the output to standard out,

if there was some way to do

Print(STDIO,"Error Message")

That is really all i am trying to accomplish, surely this can't be too hard, but beginning to wonder.

Masterofhisdomain
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7141842
Maybe .net deals with that better.  VB6 doesn't really like the DOS window.  It can use SendKeys to Windows-compliant screens, but the DOS window isn't.  Let me give time for oher experts to respond.  I've seen this done before with API calls but don't have the code handy.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 22

Expert Comment

by:rspahitz
ID: 7141854
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 200 total points
ID: 7141856
This is for a new console window:

http://msdn.microsoft.com/code/default.asp?URL=/code/sample.asp?url=/msdn-files/026/000/112/msdncompositedoc.xml

TimCottee has some code that converts a GUI exe into a Console exe by fiddling with the executable header.  That's all you can do in VB because console programs are not supported in version 6.  VB.NET allows console programs as a native project type.
0
 

Author Comment

by:masterofhisdomain
ID: 7141862
It will be uses as a DOS program, no GUI at all, i wish it were an option.

I just want to send the output to standard out,

if there was some way to do

Print(STDIO,"Error Message")

That is really all i am trying to accomplish, surely this can't be too hard, but beginning to wonder.

Masterofhisdomain
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7141863
"Writing a Console App in Visual Basic"
http://www.montgomerysoftware.com/default.asp?PageID=59
0
 

Author Comment

by:masterofhisdomain
ID: 7141873
It will be uses as a DOS program, no GUI at all, i wish it were an option.

I just want to send the output to standard out,

if there was some way to do

Print(STDIO,"Error Message")

That is really all i am trying to accomplish, surely this can't be too hard, but beginning to wonder.

Masterofhisdomain
0
 

Author Comment

by:masterofhisdomain
ID: 7141876
Sorry about the multiple posts, it seems when you refresh this page it posts.

0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7141898
>when you refresh this page it posts

Yes...at the top of the thread, you'll find a "Reload Question" link which will refresh without a re-post.

--
Another question:
Aer you running an existing DOS app which does not have source code?  If you have the source code, you can probably just drop it into a VB module and do everything from VB!
0
 

Author Comment

by:masterofhisdomain
ID: 7141911
This was what led to my final solution although not one i can say that i like.  It is just the output portion of what you provided.


I found this page, http://nirsoft.tripod.com/vb/console.html

So i guess i will use what i found, until we upgrade to .net or a better solution is found.

Thanks all for the help.

Masterofhisdomain
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 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