Is this possible? Thanks in advance!
Is this possible? Thanks in advance!
Why would you want to?
Out of curiosity, why did you feel the need to ask why?
When you say "in DOS", you probably mean "in a console application". It's not really DOS, it's just a DOS-like environment simulated by Windows. Linux has a console environment too. Adrianxw wrote a really good tutorial on console programming, and if this is possible, it's more than likely covered there. Do a board search and see if you can find it - it's recommended quite often.
It's not possible to do in the same character cell unless you redefine the ASCII characters with new bitmaps. That would require an interrupt and since console doesn't support them - the answer is....you cannot do this in console. The best you can do is draw a line under the word on the next line and use double spacing so the next line does not overwrite it.
The only way I know you might be able to get away with this in another screen mode is to go poking around in video memory. However text mode does not allow pixel writes, only cell writes so if the cell bitmap does not have an underline, you are SOL.
Text mode is not written per pixel, it's written per cell so B800:0000 corresponds to the first letter, and B800:0002 corresponds to the first color ((background << 4)+foreground).
Windows probably won't even give a pointer to the memory.
Last edited by VirtualAce; 01-02-2006 at 09:37 PM.
Seriously out of luck?you are SOL.
Windows' console does not make use of the graphics card's text mode. It is, in fact, impossible to have areas of the screen in text mode and others in pixel mode. So even if you could obtain a pointer to the character buffer, modifying it wouldn't have any effect.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
the console window is just another window -- it has a HWND associated with it. So if you get the HWND you should be able to change its default font. If you learn how to change fonts in standard Windows you should be able to do that in a console window too.
Which may allow you to underline all the text - but surely not a selected word.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Of course you can. Just how do you think MS-Word or any other word processor does it (use more than one font). Do it in command window the same way. I haven't actually tried it, but I assume it will work.Originally Posted by CornedBee
Last edited by Ancient Dragon; 01-02-2006 at 10:05 PM.
I thought that's what I said. Text mode is not graphics mode. The card doesn't even allow access to pixels, it has nothing to do with Windows.Windows' console does not make use of the graphics card's text mode. It is, in fact, impossible to have areas of the screen in text mode and others in pixel mode.
Text mode is not written per pixel, it's written per cell so B800:0000 corresponds to the first letter, and B800:0002 corresponds to the first color ((background << 4)+foreground).
Windows probably won't even give a pointer to the memory.
You can save the text in a file, and run a normal Windows program to open the file and display the text, or easier: convert it to a Windows program