This should help with the programming, you might be able to edit this code to get the results needed.
http://www.gamedev.net/index.php?app=co ... mMainBar=1
Codes from the website:
Get current resolution:
- Code: Select all
void GetDesktopResolution( int & width, int & height, int & bpp)
{
#ifdef __CARBON__
CFDictionaryRef desktopVideoMode = CGDisplayCurrentMode( kCGDirectMainDisplay );
if( !CFNumberGetValue( (CFNumberRef)CFDictionaryGetValue( desktopVideoMode, kCGDisplayWidth ),
kCFNumberIntType,
&width ) ||
!CFNumberGetValue( (CFNumberRef)CFDictionaryGetValue( desktopVideoMode, kCGDisplayHeight ),
kCFNumberIntType,
&height ) ||
!CFNumberGetValue( (CFNumberRef)CFDictionaryGetValue( desktopVideoMode, kCGDisplayBitsPerPixel ),
kCFNumberIntType,
&bpp ) )
{
// error, return default values
// ...
}
#elif WIN32
DEVMODE desktopVideoMode;
ZeroMemory( reinterpret_cast( &desktopVideoMode ), sizeof( desktopVideoMode ) );
if( EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &desktopVideoMode ) )
{
m_desktopWidth = desktopVideoMode.dmPelsWidth;
m_desktopHeight = desktopVideoMode.dmPelsHeight;
m_desktopBpp = desktopVideoMode.dmBitsPerPel;
}
else
{
// error, return default values
// ...
}
#else
#error unsupported platform
#endif
}
Get ammount of Video ram installed:
- Code: Select all
#ifdef WIN32
#include
#include // Needs DirectX SDK(>=5), or at least ddraw.h in your path
typedef int (WINAPI *MYPROC)(GUID *,LPDIRECTDRAW *,IUnknown *);
#else
#include
#include
#endif
const int GetInstalledVRAM( void )
{
#ifdef __CARBON__
AGLRendererInfo info;
GLint vram( 0 );
info = aglQueryRendererInfo ( NULL, 0 );
while ( info != NULL )
{
if( aglDescribeRenderer( info, AGL_VIDEO_MEMORY, &vram ) == GL_TRUE )
{
// Return megabytes
return static_cast( vram / (1024 * 1024) );
}
info = aglNextRendererInfo( info );
}
return 0;
#elif WIN32
HINSTANCE DDrawDLL;
int vram ( 0 );
DDrawDLL = LoadLibrary( "ddraw.dll" );
if( DDrawDLL != NULL )
{
MYPROC DDrawCreate;
LPDIRECTDRAW DDraw;
HRESULT hres;
DDrawCreate = ( MYPROC ) GetProcAddress( DDrawDLL, "DirectDrawCreate");
if( ( DDrawCreate != NULL )
&& !FAILED( DDrawCreate( NULL, &DDraw, NULL ) ) )
{
DDCAPS caps;
memset(&caps,0,sizeof(DDCAPS));
caps.dwSize = sizeof(DDCAPS);
hres = IDirectDraw2_GetCaps( DDraw, &caps, NULL );
if( hres == S_OK )
{
// Return megabytes
vram = caps.dwVidMemTotal / (1024 * 1024);
}
IDirectDraw_Release( DDraw );
}
FreeLibrary( DDrawDLL );
}
return vram;
#else
#error Unsupported platform
#endif
}
For more please read the website link