GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


LoadBitmap by jnighthawk
HBITMAP cBuffer::LoadBitmap(string szFileName)
{
    // Load the bitmap and return the handle to the bitmap we just loaded
    char * szTemp = new char[szFileName.length() + 1];
    strcpy(szTemp, szFileName.c_str());
    MessageBox(hWnd, szTemp, "Test", MB_OK);
    HBITMAP hbmapTemp = (HBITMAP)LoadImage(NULL, szTemp, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    //HBITMAP hbmapTemp = (HBITMAP)LoadImage(NULL, "images\\RedTile.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    delete [] szTemp;
    //HBITMAP hbmapTemp = (HBITMAP)LoadImage(NULL, szFileName.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    if(hbmapTemp) {
        DJBitmap DJBTemp;
        DJBTemp.hBitmap = hbmapTemp;
        DJBTemp.szName = szFileName.substr(7, szFileName.length() - 11);
        Bitmaps.push_back(DJBTemp);
    }
    return hbmapTemp;
}


            if(!Buffer.LoadBitmap("images\\RedTile.bmp")) {
                MessageBox(hWnd, "Failed to load RedTile.bmp.", "Fatal Error", MB_OK);
                return 0;
            }