mercredi 5 février 2020

bmp file does not load from resources

I can not set a .bmp file from resource as wallpaper.

My code:

void changewallpaper()
{
    HRSRC imageResHandle = NULL;
    HGLOBAL imageResDataHandle = NULL;
    void *pImageFile = NULL;

    imageResHandle = FindResourceA(NULL, "IDB_WALLPAPER", "BITMAP");
    imageResDataHandle = LoadResource(NULL, imageResHandle);
    pImageFile = LockResource(imageResDataHandle);

    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID)pImageFile, SPIF_UPDATEINIFILE);
}

My resource.rc file:

IDB_WALLPAPER BITMAP "Wallpaper.bmp"

Does anyone know what I am doing wrong?

(Where can I learn more on how to work with resources other than windows documentation?)

Thank you!

Aucun commentaire:

Enregistrer un commentaire