CSDN博客

img bohut

得到显存的大小

发表于2004/10/26 10:04:00  1990人阅读

分类: VC/MFC

#include <ddraw.h>
#pragma comment(lib, "guids.lib")

 LPDIRECTDRAW2 lpdd;
 HRESULT ddrval;
 
 CoInitialize(NULL); 
 
 ddrval = CoCreateInstance(CLSID_DirectDraw,
  NULL, CLSCTX_ALL, IID_IDirectDraw2, (void**)&lpdd);
 
 
 if(!FAILED(ddrval))
 {
  ddrval = IDirectDraw2_Initialize(lpdd, NULL);
 }
 
 DDCAPS ddcaps;
 
 ddcaps.dwSize = sizeof DDCAPS;
 lpdd->GetCaps(&ddcaps, NULL);
 
 lpdd->Release();
 
 DWORD dwMem = ddcaps.dwVidMemTotal;

 int iMem = dwMem/1024/1024;

 CString strMem;
 strMem.Format(_T("display memory is %d MB"),iMem);

 AfxMessageBox(strMem);
 
 CoUninitialize();

阅读全文
0 0

相关文章推荐

img
取 消
img