This BlueScreened my PC, but usually it just kills XP's GDI.
// This BlueScreened my PC, but usually it just kills XP's GDI.
#define Quote_It( It ) #It
#define DD_Path( __X ) Quote_It( \
C:\\Program Files\\Microsoft DirectX SDK (December 2005)\\__X )
#include DD_Path( Include\\DDraw.H )
#pragma comment( lib , DD_Path( Lib\\x86\\DDraw.LIB ) )
#pragma comment( lib , DD_Path( Lib\\x86\\DXguid.LIB ) )
int __stdcall WinMain( HINSTANCE, HINSTANCE, char*, int ) {
LPDIRECTDRAW DD; LPDIRECTDRAW7 DirectDraw;
DirectDrawCreate( 0, & DD, 0 );
DD->QueryInterface( IID_IDirectDraw7, (VOID**) & DirectDraw );
DirectDraw->SetCooperativeLevel( 0, DDSCL_NORMAL );
DDSURFACEDESC2 Z = { sizeof Z, DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH };
// DDSCAPS_VIDEOMEMORY wouldn't freeze/BlueScreen Win XP's GDI
Z.ddsCaps.dwCaps = DDSCAPS_TEXTURE ;
int CacheH = 64, CacheW = CacheH / 2 ;
HFONT Fnt = CreateFont( CacheH, 0,0,0,0,0,0,0,0,0,0,0,0,0 );
int W = 32000, H = 2, X = - CacheW ;
LPDIRECTDRAWSURFACE7 Oops ; Z.dwWidth = W, Z.dwHeight = H ;
DirectDraw->CreateSurface( & Z, & Oops, 0 );
HDC DC ; Oops->GetDC( & DC ); SelectObject( DC, Fnt );
#define Loop( N ) int J = - 1 , LLL = N ; while ( ++ J < LLL )
Loop( W / CacheW ) TextOut( DC, X += CacheW, 0, "X", 1 );
return 1 ; }