[AD] desktop_color_depth() in windows

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


i noticed that this function needed to be implemented in the 3.9.12
todo.txt, so i checked the mail-list archives and did not find anything
saying it's been done yet, bit a few with people saying that it's broken
under Windows!)
so here's one way to do it:

// returns number of bits per pixel of the Windows desktop
int deskop_color_depth(void)
{
// this function only requires <windows.h>
// actually winuser.h for the function called & wingdi.h for the structure
to store the data to be specific
    DEVMODE devmode ;    // structure to store settings retreived by
EnumDisplaySettings()

    // retreives settings and change corresponding members of DEVMODE
structure
    EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode) ;

    return devmode.dmBitsPerPel ;    // return data from relevant member of
DEVMODE
}


-Justin White

E-Mail: jowhite@xxxxxxxxxx
AIM: Just6979
www.bigfoot.com/~jowhite



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/