Re: SetPixel not working on Vista
On Oct 20, 9:09 am, Paul <energymo...@gmail.com> wrote:
Hi,
SetPixel on Vista is acting strange. Certain areas it cannot draw on.
If I draw the entire window, then we can see the areas it can draw to,
which is vertical areas/bars that are a few hundred pixels wide. The
code works fine on my XP PC. So I thought there might be some window
app behind it preventing it from drawing in certain areas, but found
nothing. Changing the desktop to a solid color did nothing. Any ideas
what could be causing this? Here's the code,
void CTest1View::OnPaint()
{
CPaintDC dc(this); // device context for painting
if(IsIconic()){
return;
}
long x,y;
for(y=0; y < 1024; y++) {
for(x=0; x < 1024; x++) {
dc.SetPixel(x,y,0xff);
}
}
}
and another example,
void CTest2View::OnPaint()
{
CPaintDC dc(this); // device context for painting
if(IsIconic()){
return;
}
long x,y;
PAINTSTRUCT ps;
BeginPaint(&ps);
for(y=0; y < 1024; y++) {
for(x=0; x < 1024; x++) {
dc.SetPixel(x,y,0xff);
}
}
EndPaint(&ps);
}
Also I tried dc,
int save = dc.SaveDC(); // place this near start of code
...
dc.RestoreDC(save); // place this near end of code
Also I tried calling OnDraw the common way within OnPaint-- same
results.
I've tried everything I know. Change the window size. Regardless, the
above code always draws vertical bars that are black, white, black,
white, about ~ 200 pixels per bar.
Thanks for any suggestions.
Paul
Ha ha, would you believe it, after search for hours how to solve this
issue, just moments after my above post I found some info on this
Vista issue,
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedb=
ackID=452578
Well, looks like it's a Windows Vista issue. Okay, I'll stay away from
SetPixel, as it was used only to see if a function was working, but
being a bit stuborn I wanted to dig down and get the SetPixel to work.
Regards,
Paul