FreeBASIC  0.91.0
io_readxy.c
Go to the documentation of this file.
1 /* console SCREEN() function (cursor position query) */
2 
3 #include "../fb.h"
4 #include "fb_private_console.h"
5 
6 FBCALL unsigned int fb_ConsoleReadXY( int col, int row, int colorflag )
7 {
8  TCHAR character;
9  WORD attribute;
10  DWORD res;
11  COORD coord;
12 
13  fb_hConvertToConsole( &col, &row, NULL, NULL );
14 
15  coord.X = (SHORT) col;
16  coord.Y = (SHORT) row;
17 
18  if( colorflag ) {
19  ReadConsoleOutputAttribute( __fb_out_handle, &attribute, 1, coord, &res);
20  return ((unsigned int)attribute) & 0xfffful;
21  }
22  else {
23  ReadConsoleOutputCharacter( __fb_out_handle, &character, 1, coord, &res);
24  return ((unsigned int)character) & (sizeof(TCHAR) == 1? 0xfful : 0xfffful);
25  }
26 }