Click to See Complete Forum and Search --> : fore and background color in DOS !console...
sail3005
Feb 13th, 2001, 04:54 PM
How can I change the fore and background color of a program for DOS? Not console, just plain old DOS? I have searched the forums. but only found out how to do it using windows.h.
I really need to be able to do it in a 16-bit dos program, and can't find out how anywhere.
like with using something like printf, or cout. And then how to change the whole BG color?
Thanks A LOT
Sulo
Feb 15th, 2001, 03:59 PM
#include <conio.h> //borland?
textcolor(); // foreground 1-15
textbackground(); //background 1-15
//you need to clearscreen after setting colors.
clrscr();
HarryW
Feb 15th, 2001, 04:12 PM
Yeah, that's for Borland EZWins, not consoles.
sail3005
Feb 15th, 2001, 05:37 PM
man, it must be really hard to do. I am supriesd that no one knows, because a lot of dos programs do it. Maybe they aren't programmed in C/C++ though.
Help
Feb 15th, 2001, 07:37 PM
To change the background color for dos it must be done in registry. ( only way I know how )
Key: [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
Value Name: DefaultColor
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default)
change the number to different numbers to get different colors.
Im not sure if this is what you wanted.
:)
HarryW
Feb 15th, 2001, 08:03 PM
Sail, that's DOS, not consoles. You don't have the same kind of access to graphics stuff in a Windows console.
sail3005
Feb 15th, 2001, 08:14 PM
Thanks for the help, Help. But the program i am trying to make is for a bootdisk, so it will have to be able to work without windows installed.
HarryW
Feb 15th, 2001, 08:34 PM
Oh sorry, I too misunderstood (or misread actually) your post. I don't know how to do it in DOS, but it might well depend on the graphics hardware.
I remember Parksie had a way to get a pointer to the video memory in DOS a while ago, I wonder if it's still kicking around somewhere.
sail3005
Feb 15th, 2001, 09:43 PM
i took a pretty thurough look by searching before i posted, but i guess i'll try a "Super" or manual search to see if i can find it. If you know where it might be, could you point me in the right direction?
kourosh
Feb 16th, 2001, 10:44 AM
Hi, I have asked this question before but nobody seems to understand it or maybe the way i asked it was wrong. Anyhow how do you write 16-bit programs for dos? I mean just dos so it can be run in dos not dos console?? I really appreciate if some body help me. Although I wanted to know is it possible to do it in MSC++? Some code would be really helpfull
HarryW
Feb 16th, 2001, 10:50 AM
You can't do it in MSVC++. You'll need an older compiler, one that was around when DOS was prominent.
kourosh
Feb 16th, 2001, 10:57 AM
How can I get it. By the way is the coding going to be the same?
Originally posted by Help
To change the background color for dos it must be done in registry. ( only way I know how )
That's not the only way; you can do it using the SetConsoleTextAttribute API.
sail3005
Feb 16th, 2001, 04:20 PM
I have found a number of 16-bit c/c++ compilers, but the only one that is even worth using is Borland Turbo C++ 3.0. It works great for making DOS programs.
I would love to get my hands on a copy of VC++ for win3.1, because this would be able to compile for 16-bit, and would have a better interface than the dos Turbo C++.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.