代码已经不能再简了,求各位带我入门吧.
void CTestDlg::OnOK() 
{
// TODO: Add extra validation here
LPDIRECTDRAW pDDObj;
int iResult;
//建立一个DirectDraw对象
iResult=DirectDrawCreate(NULL,&pDDObj,NULL);
//设置应用程序对操作系统的控制程度
iResult=pDDObj->SetCooperativeLevel(NULL,DDSCL_NORMAL);
//设置显示器的显示模式
iResult=pDDObj->SetDisplayMode(800,600,8); DDSURFACEDESC ddsd; //Surface descriptor
LPDIRECTDRAWSURFACE pDDSPrimary; //Surface 有三种:Primary Surface,Back Buffer,off-screen buffer,现在创建主surface
ddsd.dwSize=sizeof(ddsd);
ddsd.dwFlags=DDSD_CAPS; //表示ddsd.ddsCaps是make sense
ddsd.ddsCaps.dwCaps =DDSCAPS_PRIMARYSURFACE; //指明创建的是Primary Surface
iResult=pDDObj->CreateSurface(&ddsd,&pDDSPrimary,NULL); HDC hdc; //设备句柄
pDDSPrimary->GetDC(&hdc);
SetBkColor(hdc,RGB(0,0,0));
SetTextColor(hdc,RGB(255,255,255));
TextOut(hdc,0,0,"hello",5);
pDDSPrimary->ReleaseDC(hdc); pDDSPrimary->Release();
pDDObj->Release();
         //CDialog::OnOK();
}