if (hRet != DD_OK) { MessageBox(" CreateSurface DirectDrawSurface对象 FAILED","FAILED",MB_OK); return ; } // Get a pointer to the back buffer ddscaps.dwCaps = DDSCAPS_BACKBUFFER ; hRet = g_pDDSPrimary->GetAttachedSurface(&ddscaps, &m_pBackBuff) ;
// Get the screen size and save it as a rect ZeroMemory(&ddsd, sizeof(ddsd)) ; ddsd.dwSize = sizeof(ddsd) ; hRet = g_pDDSPrimary->GetSurfaceDesc(&ddsd) ; if (! (SUCCEEDED(hRet) && (ddsd.dwFlags & DDSD_WIDTH) && (ddsd.dwFlags & DDSD_HEIGHT)) ) { MessageBox(TEXT("GetSurfaceDesc() failed to get surface width & height"), TEXT("Error"), MB_OK | MB_ICONSTOP) ; return ; } SetRect(&m_RectScrn, 0, 0, ddsd.dwWidth, ddsd.dwHeight) ; // Reset some buffer drawing flags, values etc. //m_iCount = 0 ; //m_bFrontBuff = TRUE ; //m_bInExclMode = TRUE ; hRet = g_pDDSPrimary->QueryInterface(IID_IDirectDrawColorControl, (LPVOID *)&m_pControl);
给我一个吧.我想看看效果.thx:)
你说的情况可能是Debug被删除了,你可以参照其他的project的选项新建一个debug版本编译选项
但是如何恢复不知道啊
真是一群菜鸟,在[Build]->[Set Active Configuration],把它改为 debug 一切就OVER,晕死,你们这样整,何时才能搞出明堂哟!
回答跟你的ID倒是蠻配的:)
DDSCAPS ddscaps; //DDSCAPS2
HRESULT hRet;
LPDIRECTDRAW pDD;
hRet = DirectDrawCreate(NULL, &pDD, NULL);
if (hRet != DD_OK)
{
MessageBox("DirectDrawCreate FAILED","FAILED",MB_OK); //GetActiveWindow(),
return ;
}
hRet = pDD->QueryInterface(IID_IDirectDraw2, (LPVOID *) & g_pDD);
if (hRet != DD_OK)
{
MessageBox(" QueryInterface FAILED","FAILED",MB_OK);
return ;
}
hRet = g_pDD->SetDisplayMode(1024, 768,32,0,DDSDM_STANDARDVGAMODE); //m_pDDObject
if (FAILED(hRet))
{
MessageBox(TEXT("SetDisplayMode(640, 480, 8) failed"),TEXT("Error"), MB_OK | MB_ICONSTOP) ;
return ;
}
hRet = g_pDD->SetCooperativeLevel(::GetActiveWindow(), DDSCL_NORMAL);
if (hRet != DD_OK)
{
MessageBox("SetCooperativeLevel FAILED","FAILED",MB_OK);
return ;
} // Create the primary surface with 1 back buffer
ZeroMemory(&ddsd, sizeof(ddsd)) ;
ddsd.dwSize = sizeof(ddsd) ;
ddsd.dwFlags =DDSD_CAPS; //DDSD_CAPS | DDSD_BACKBUFFERCOUNT ;
ddsd.ddsCaps.dwCaps =DDSCAPS_PRIMARYSURFACE; //DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP |DDSCAPS_COMPLEX ;
ddsd.dwBackBufferCount = 1 ;
hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL) ;
if (hRet != DD_OK)
{
MessageBox(" CreateSurface DirectDrawSurface对象 FAILED","FAILED",MB_OK);
return ;
}
// Get a pointer to the back buffer
ddscaps.dwCaps = DDSCAPS_BACKBUFFER ;
hRet = g_pDDSPrimary->GetAttachedSurface(&ddscaps, &m_pBackBuff) ;
// Get the screen size and save it as a rect
ZeroMemory(&ddsd, sizeof(ddsd)) ;
ddsd.dwSize = sizeof(ddsd) ;
hRet = g_pDDSPrimary->GetSurfaceDesc(&ddsd) ;
if (! (SUCCEEDED(hRet) && (ddsd.dwFlags & DDSD_WIDTH) && (ddsd.dwFlags & DDSD_HEIGHT)) )
{
MessageBox(TEXT("GetSurfaceDesc() failed to get surface width & height"),
TEXT("Error"), MB_OK | MB_ICONSTOP) ;
return ;
}
SetRect(&m_RectScrn, 0, 0, ddsd.dwWidth, ddsd.dwHeight) ;
// Reset some buffer drawing flags, values etc.
//m_iCount = 0 ;
//m_bFrontBuff = TRUE ;
//m_bInExclMode = TRUE ;
hRet = g_pDDSPrimary->QueryInterface(IID_IDirectDrawColorControl, (LPVOID *)&m_pControl);
// 这里获取失败呀!晕,这个问题是怎么回事呀!
if (hRet != DD_OK)
{
MessageBox(" Create DirectDrawColorControl对象 FAILED","FAILED",MB_OK);
return ;
}
回复人: fanqing(火影忍者+26%) ( ) 信誉:68 2005-02-22 10:54:00 得分: 0
楼上(木头)在build菜单的configurations中将debug项删除就可以了.
是吗? 俺也搞不懂了,没有见过,呵呵
Project->settings->改变一下编译参数,比如 NDEBUG->DEBUG
....