Win32 API (GetConsoleScreenBufferInfo)
Posted on 1998-03-26
I had been told by my friend (hellome) to send this question because he is not enough point.
Regarding to the use of the win32 api (GetConsoleScreenBufferInfo), Abel (the expert from expert-exchange) had give the comment as below :
(Unless you make the console yourself, you cannot use this function. If you want that information from another application and you can't get the hConsoleInput, you'll have to do some seriously difficult tricks (especially when doing that from VB). At the other hand, when you create the console yourself, it's very handy information, as clifABB points out, for copying the screencontents of the DOS-window somehow. If this is what you want, I can provide you an example for using it.)
What hellome actually want is, to get the screen contents of the Dos Window but not the screen properties of the Dos Window. For example: compiling the java file(App.java) by using the javac.exe.
This can be done in VB5 by just calling the shell function. However, if any compilation error, the error messages will display in the Dos Window and this window will disappear immediately after the compilation. So, in order to get the error messages from Dos Window, he had tried several methods including this :
shell "c:\jdk1.1.1\bin\javac App.java >c:\tmp.txt"
shell"command.com /cc:\jdk1.1.1\bin\javac App.java >c:\tmp.txt"
Unfortunately, both also unable to get the output error messages from Dos Window. (tmp.txt file is empty).
So, if the win API (GetConsoleScreenBufferInfo) can get the output of the Dos Window then can Abel give the example how to use it.
Or may be someone know the solution, please help me. Thank you.
my email : email@example.com