#74354 - 2003-04-08 03:00 PM
Utility: Get cursor and console information
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
First off let me say that I have no idea which forum this should be in so I'm posting here as it is mainly in response to this post.
SCRNDUMP.EXE
- Do you need to read the data on the console?
- Do you need to check the console height, or width?
- Do you need to get the cursors current position?
You do? Well then look no further, scrndump.exe is the answer to your problems. This small utility which you can download from here will do all these things for you.
If you call the executable with no parameters, it will dump the contents of the current console to a file in a format which can be CALLed by a KiXtart script. You may specify a file name if you don't want to use the default "scrndump.kix"
If you only want to know the cursor position use:
code:
scrndump.exe -cursor
The position is returned as an error level. You can get the console size by running:
code:
scrndump.exe -size
The numbers are encoded as (X*1000)+Y and (Width*1000)+Height respectively.
Here is a simple example of how you would use it to determine the cursor location after an arbitrarty DOS command has been run:
Global $iX,$iY ; Declare global variables
Shell "scrndump.exe -size" ; Get the console size udfTranslateCoord(@ERROR) ; Translate the coordinates "Console width=" $iX ? "Console height=" $iY ?
Shell "dir" ; Run a DOS command Shell "scrndump.exe -cursor" ; Get the Cursor position udfTranslateCoord(@ERROR) ; Translate the coordinates ? "Cursor X coord=" $iX ? "Cusror Y coord=" $iY ?
Function udfTranslateCoord($iCoord) $iX=$iCoord mod 1000 $iY=($iCoord-$iX)/1000 EndFunction |
The output would be: quote:
G:\dev\scrndump>kix32 demo.kix Console width=50 Console height=80 Makefile demo.kix scrndump.c scrndump.exe scrndump.kix
Cursor X coord=5 Cusror Y coord=0
Actually, I may have X and Y the wrong way round but you get the idea.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 581 anonymous users online.
|
|
|