Quote:
Originally Posted by masterovpuppetz
I wanted know if there's a way in c++ to know what character exists at a particular x,y coordinate.
for eg: suppose i used gotoxy(2,5) and my cursor is now at (2,5) and i want to know what character exists next to my cursor at (3,5). How can i know that?
|
well you can do it if you are in Win98 by directly accessing the video ram buffer located at 0xB8000, in physical memory. The buffer is of the datatype 'short', Each 16-bit element in the text memory buffer is broken into an 'upper' 8-bits and a 'lower' 8-bits. The lower 8 bits of each element tells the display controller what character to draw on the screen. We just have to extract this lower byte
use the following code
Code:
index = (y_value_cur * width_of_screen) + x_value_cur;
unsigned short *where = (unsigned short *)0xB8000 + index;
this code will give you direct access to the location where your cursor is
now to move to next or previous position just increment or decrement the where pointer .