2012-12-27 11 views
5

Impossibile understnand ciò che è sbagliato con questo codice:HBITMAP bitmap conversione

HBITMAP bm = 0; 
BITMAP Bitmap; 
bm = (HBITMAP)LoadImage (0, path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); 
int error = GetObject(&Bitmap, sizeof(BITMAP ), &bm); 

La LoadImage funzione restituisce puntatore non nullo. Tuttavia, GetObject restituisce 0, che indica un errore. Voglio ottenere informazioni sulla dimensione e dati immagine dal puntatore HBITMAP (il puntatore può essere passato come parametro, quindi non posso cambiare il modo in cui carico il file bitmap).

risposta

8

Forse mettendo i parametri nei posti giusti vi aiuterà:

HBITMAP bm = 0; 
BITMAP Bitmap; 
bm = (HBITMAP)LoadImage (0, path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); 
int error = GetObject(bm, sizeof(BITMAP), &Bitmap); // << NOTE ORDERING 

Vedere la documentazione sul GetObject() per maggiori informazioni.

+0

Grazie, funziona :) – maximus

+0

@maximus Nessun problema. felice di aiutare. – WhozCraig

Problemi correlati