:
Thank you ASMGURU.
:
: i have study a bit of the function from the link given by you.
: Yet i need to put more effort to understand it as i m not that
: familiar with masm32 bit.
: Previously only deal with masm16.
:
: Lets say i wish to set the color for area start with
:
coordinate 0010h until 0439h. Is it possible for
: me to do that by using FillConsoleOutputAttribute Function? as i
: notice its decription says that colour only cover area which contain
: string with it. But my purpose is colour the background on my own
: desired area.
:
: I can set the background colour start with coordinate 0010h until
: 0439h by using the macros below.
:
:
SET_WINDOW MACRO COLOUR, START_XY, END_XY
:
: mov ax,0600h ; scroll window
: mov bh,COLOUR ; background, font
: mov cx,START_XY ; coordinate start point
: mov dx,END_XY ; coordinate end point
: int 10h
: ENDM
:
:
: Yet i can't use this bcoz it is in real mode.
: Masm32 run in protected mode.
:
: But can i modify the macro so that it can run in masm32?
: If that is impossible, i will try hard to understand the
: FillConsoleOutputAttribute.
:
: Sorry that if i kips on repeating the question as i m still have to
: digest the link that given by ASMGURU.
:
: MASM32 is confusing... -.-!!
:
: Thanks again!!!
:
: Regards,
: CIelle
:
I see, when you say coordinate - you mean the row,col pair of values stored in a register.
In short, you need a new macro, even better - a new function, because macro will be quite long, because it will be a loop.
So, lets look at FillConsoleOutputAttribute():
invoke FillConsoleOutputAttribute, hConsole, color,\
nChars, coord, addr dwFilled
hConsole = a handle to Console returned by call to GetStdHandle().
color = an attribute you want to apply on console characters.
nChars = how many characters you want to highlight.
coord = row,col of a location you want to begin highlighting.
dwFilled = a DWORD variable which will be set to real character count of filled characters. Usually not used - just pass some address.
Example: you need to highlight a rectangle with:
left column = 10
top row = 4
right column = 50
bottom row = 12
You need to call the function for each row in that rectangle. Number of rows = 1+(12-4) = 9. nChars parameter is a rectangle width = 1+(50-10) = 41. So, you need a loop of 9 times and you need to pass the proper coord parameter for each row.