Im getting an error usng setpixel (And how do I use COLORREF?)
Can anyone give me an example of either? :)
Printable View
Im getting an error usng setpixel (And how do I use COLORREF?)
Can anyone give me an example of either? :)
Use this:
Use COLORREF to create the color you want to draw with.Code:COLORREF green = RGB(0,255,0); // Create the color green
SetPixel(hdc,234,300,green); // Plot the pixel
Thanks :D
uh oh....just tested it
Quote:
error C2275: 'HDC' : illegal use of this type as an expression
You didn't use
SetPixel(HDC,234,300,green);
or
HDC = ...
right.
Post some code.
the error applies to this code:
Code:SetPixel(HDC,50,50,color); // Plot the pixel
Well the error is very obvious. HDC is a datatype like (not exactly the same but it is a datatype) int,double.
You can't use a datatype as an expression.
int a = int //same error
You have to declare a variable of that type first.
int b = 5;
int a = b;
In your case
Code:HDC myDC = GetDC(somehwnd);
SetPixel(myDC,50,50,color); // Plot the pixel
you're the man :D