how convert GDIplus::color to colorref?

how convert GDIplus::color to colorref?
1
2
3
4
5
6
point Point=PixelLine[PosY];
                Color *color;
                img->GetPixel(PosY,PosX,color);
                COLORREF clr;
                clr=color->ToCOLORREF();
                ::SetPixel(hdcDestination,Point.x,Point.y,clr);

the '::SetPixel' terminate the program: "Process returned -1073741819 (0xC0000005) execution time : 0.922 s
Press any key to continue."
what i'm doing wrong?
(i tested if is that the problem)
you have the right idea, you just do not understand pointers :)

try this:
Color color;
img->GetPixel(PosY,PosX,&color);
COLORREF clr =color.ToCOLORREF();



spoiler:
do you see what you did wrong?
the function does NOT get memory for the pointer... your code has a pointer but no object, and you try to dereference that pointer and it crashes. In my version, you have the object, pass its address (as a pointer), and its valid...
Last edited on
thank you so much for all.. works fine
Topic archived. No new replies allowed.