Hay! I, in memory of Quick Basic want to write a program that is DOS based. So you can type in <myexe> -<mycommands> and it will do as commanded. Anybody know how to do this? If you do, i would like this data.
You can't make a DOS program with VB.
You can however create a 32-bit console application which is not really the same thing.
A DOS app is a 16-bit program while a Windows Console app is 32-bit and can also use the Windows API functions something a DOS program never can do.
The main difference is that you can't run this from DOS, i.e Windows must be started.
Most people would say that a DOS app and a 32-bit console app is the same thing because they look the same but that is not true.
You can use a consol by calling some of the consol API functions like GetStdHandle to retrieve handles for StdOut and StdIn.
WriteConsol to write to StdOut.
ReadConsol to read from StdIn.
You might also need the following API functions:
GetConsoleScreenBufferInfo
GetConsoleCursorInfo
GetConsoleMode
SetConsoleMode
You might also need to write your own callback function to handle cases when the user press Ctrl+C or Ctrl+Break.
You'll use SetConsoleCtrlHandle for this.
You'll also need to handle redirection yourself so for example if the user types:
YourAppName >c:\MyFile.txt
All outputs are redirected to C:\MyFile.txt
But even after you have done all this it's not enough because when you compile the application VB will compile it as a windowing application.
Even though you're creating a console and writes all output to this console your application will create a new console and not use the one that started your application.
To use the current console you have to change the header in your EXE file.
Attached is a small program you can use on your exe to change it from a windowing app to a console app.
I dont understand how i can use these APIs. Is there any possibility that you give me a more....definitive use for all these APIs? I know that they are useful. Just dont know how to use them. Can you post some quick instructions on what these API calls' use is and how to use them?