Original Post
Strange thing happened to me when I tried to run just a little program to plot random pixels on the screen, I compiled and got no errors, but when I ran it it freezes up. When I debug it, it says that I have an unhandled exception. The culprit is somewhere in this area.
memset(&ddsd,0,sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
if(FAILED(lpddsprimary->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL)))
return (0);
int mempitch = (int)ddsd.lPitch;
UCHAR *video_buffer = (UCHAR *)ddsd.lpSurface;
//plot 1000 random pixels
for(int index=0; index<1000; index++)
{
UCHAR color = rand()%256;
int x = rand()%640;
int y = rand()%480;
video_buffer[x+y*mempitch] = color;
}
if(FAILED(lpddsprimary->Unlock(NULL)))