|
Start with SetConsoleTextAttribute...
Best Regards....
and for ever
Carlos Antollini.
|
|
|
|
|
My Help Says:
The SetConsoleTextAttribute function sets the foreground (text) and background color attributes of characters written to the screen buffer.
I could be wrong but doesnt SetConsoleTextAttribut change the foreground and background of the text characters? I want to change the entire screen to a color. Can SetConsoleTextAttribute do that and I am reading it wrong?
<marquee>Raffi
|
|
|
|
|
use SetConsoleTextAttribute to change the background color
Now simulate a "CLS"
once you clear the screen, your screen will entirely be of the bg color you set
as to simulating the "CLS" the easy way is to out put 25*80 spaces; then use SetConsoleCursorPosition to position the cursor on top
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Try using FillConsoleOutputAttribute to fill the console with the preferred colorattributes
/moliate
printf("Hello World ");
HANDLE hStdout = GetStdHandle( STD_OUTPUT_HANDLE);
WORD wColor = BACKGROUND_BLUE |
FOREGROUND_RED |
FOREGROUND_GREEN |
FOREGROUND_INTENSITY;
COORD coord;
coord.X = 0;
coord.Y = 0;
FillConsoleOutputAttribute(
hStdout,
wColor,
80*50,
coord,
NULL);
|
|
|
|
|
that worked. ty very much!
<marquee>Raffi
|
|
|
|
|
i subclassed the CListBox and override this two functions
BOOL CListBoxTrans::OnEraseBkgnd(CDC* pDC)
{
// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen
return true;
//return CListBox::OnEraseBkgnd(pDC);
}
HBRUSH CListBoxTrans::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Attribute des Gerätekontexts hier ändern
// TODO: Pinsel ungleich NULL zurückgeben, falls die Behandlungsroutine des übergeordneten nicht aufgerufen werden soll
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)::GetStockObject(NULL_BRUSH);
//return NULL;
}
So now my ListBox is transparent , but if i have to scroll the box or i select an item in the box
the transparent effect is damaged . There is a really missmatch on the listbox .
What do i have to do , that selecting items and scrolling will work in my transparent ListBox ?
|
|
|
|
|
If your listbox is transparent then you should be telling the parent to repaint in the way that you require. Invalidate the rectangle in the parent where the transparent control is.
Though there is another way, rather than have your listbox transparent, which can cause you extra typing because of z order painting problems, pass the background rectangle (on move or resize of the parent) to the child (your control) and stick the background in. Then of cause you are back in a world where the listbox can take care of itself.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Hi all,
What is best way to enable or disable button in toolbar ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
CToolBarCtrl::EnableButton
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hi Nish,
But i used CToolBar class ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
use CToolBar::GetToolBarCtrl to get the underlying CToolBarCtrl object
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
So GetToolBarCtrl() is function for using CToolBarCtrl class ...
Thanks alooooooooot for your helps
I have other theory question, which is better to use ?
CToolBarCtrl or CToolBar
Thanks again for your helps !
Best Regards
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hadi_Rezaie wrote:
I have other theory question, which is better to use ?
CToolBarCtrl or CToolBar
See this URL
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_methods_of_creating_a_toolbar.asp
It explains the differences and suggests when you should use what.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
I want to knnow how you can use CDC::LineTo in conjunction with Alpha Blending.
My first approach was to do the LineTo into a temporary CDC and then use alpha blending
to copy it to the intended CDC, but when I do so I also copy the black background of my CDC.
I'm stuck!
|
|
|
|
|
Look at the WDJ site, I have an article with code for download there regarding alpha blending. Your other option is GDI+, again my articles here cover that side of things. To alpha blend your line, you'd be better off doing your own code to calculate the line and doing the blend directly. Otherwise you're bound to blend on bits you didn't draw to, and you know the value to blend already ( the colour of the line ).
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
hi all,
how can i get the ip of my internet/network adapter using the mfc libs ?
is there perhaps a regestry value which is set if i connect to the internet ?
please send me an email if u have a clue : weazel22@gmx.de
thanx and greetinx,
weazel
|
|
|
|
|
|
How do i set the ip address to local network adapter
|
|
|
|
|
How do i set the ip address to local network adapter using SNMP
|
|
|
|
|
How do i set the ip address to local network adapter using SNMP API
|
|
|
|
|
I havent tried this out :-
But it might work
Try calling GetSockName on a connected CSocket
Nish
p.s. you wanted an MFC solution
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
I have to edit controls on a dialog.
They are going to handle hours (the first edit control) and minutes (next edit control).
My question is that I want to catch EVERYTHING that is done in that edit box!
eg:
If I write 24 and max value is 24 a message box will appear and tell the user that 23 is maximum value for that edit box, and I want it to appear while the user is trying to type isn some text in the edit box. Exactly with other too!
HEELP!!
------------------------------
CodeCracker - That's me!
------------------------------
|
|
|
|
|
Well, EN_CHANGE is definitely the way to go. Several months ago I posted a message about a request similar to yours: check it out. It contains some code for an CEdit -derived control that performs in-place checking of the user input. Easy task to adapt it to your needs.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
OnChange for the control allows you to check per key.
It means though that you have to grab the text of the box, check it, then indicate the error to the user.
For a box that with a maximum of two characters its fast enough, though it can be equally argued that for a box with two characters checking OnExit or when the return key is pressed is just the same.
If your text could be long the OnChange check may be most desirable since the user may need to know before going too far ahead.
In this case the first possible method is wastefull, that is, collecting all text and checking it all every time
H
He
Hel
Hell
Hello
Hello W
etc
For a 256 character line, there is a lot of waste.
So, it is better to remember where you have already checked and where the cursor currently is. If you look at CEdit you will find possitional data available to you which you can use for this within the ::OnChange()
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Hi I have a Mapped Directory say "P:\myfolder" and I want to find the actuall ServerName and its Domain Name. I know that WNetGetUniversalName() will give me the Server Name but how do I get the Domain Name? Can any one help??
The Blade Runner
|
|
|
|