Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Colors in c++

Meister_DewMeister_Dew Member Posts: 5
[b][red]This message was edited by Meister_Dew at 2007-1-23 19:42:4[/red][/b][hr]
Ive had some trouble finding a way to put certain colored pixels in the 'console application' (looks like the dos-prompt screen) window instead of the 'windows application' window.
I found the SetPixel function and i keep getting errors like "error c2373: 'setpixel': redefinition; blah blah blah".

This is my sample...

//the header needed
#include

using namespace std;

int main()
{
int Xpos,Ypos;

// not really sure what is supposed to go to the 'HDC hdc' spot
SetPixel(HDC hdc, Xpos, Ypos, RGB(255,0,0)); // red color at x and y
// position
return 0;
}

this is just a sample to understand how to use this function.
if you have any tips regarding this is appreciated
thanks...

[size=3]"I am a [/size]Slave,[size=2] and a[/size] [size=4][red]Master[/red][/size][size=2]"-[italic]Slipknot[/italic][/size]


Comments

  • veliusvelius Member Posts: 456
    First error I see is the 'using namespace std;' as you're not using any C++ headers and therefore no need for namespace and the compiler will error on that line.

    HDC is a handle to a Device Context. I don't think you can actually do what you're trying to do with the console window via SetPixel().


    : [b][red]This message was edited by Meister_Dew at 2007-1-23 19:42:4[/red][/b][hr]
    : Ive had some trouble finding a way to put certain colored pixels in the 'console application' (looks like the dos-prompt screen) window instead of the 'windows application' window.
    : I found the SetPixel function and i keep getting errors like "error c2373: 'setpixel': redefinition; blah blah blah".
    :
    : This is my sample...
    :
    : //the header needed
    : #include
    :
    : using namespace std;
    :
    : int main()
    : {
    : int Xpos,Ypos;
    :
    : // not really sure what is supposed to go to the 'HDC hdc' spot
    : SetPixel(HDC hdc, Xpos, Ypos, RGB(255,0,0)); // red color at x and y
    : // position
    : return 0;
    : }
    :
    : this is just a sample to understand how to use this function.
    : if you have any tips regarding this is appreciated
    : thanks...
    :
    : [size=3]"I am a [/size]Slave,[size=2] and a[/size] [size=4][red]Master[/red][/size][size=2]"-[italic]Slipknot[/italic][/size]
    :
    :
    :

    [hr]
    We'll be an army of theives
    Of self-freed slaves
    Of mild-mannered maids
    We'll fight with whispers and blades
    So get ready, a new day is dawning
    - The New Wild West -- Jewel

Sign In or Register to comment.