Re: [Dev-C++] Loading a bitmap and getting its handle ???
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <A_B...@gm...> - 2005-01-10 15:21:21
|
Thank you for the hint !!! :)
But now I have an other problem...
I get two different types of handles (HWND and HANDLE).
BitBlt needs for source and destination the handle type HDC.
So the only way to get this code to run seems to cast the two handles to H=
DC.
But BitBlt returns False and nothing is drawn to the window!
void wndAnfang::drawSchein(){
HWND hnd_Window;
HANDLE hnd_BMP;
if(hnd_Window =3D FindWindow("fltk", "AB-Sys")){
if(hnd_BMP =3D LoadImage(NULL, "F:\\Sources\\DevCpp\\Sys\\out\\Schein-=
Small.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)){
bool b =3D BitBlt((HDC)hnd_Window, 0, 0, 300, 300, (HDC)hnd_BMP, 0, =
0, SRCCOPY);
DeleteObject(hnd_BMP);
message("%d %d %d",b,hnd_Picture,hnd_Schein);
}
}
}
Am 10 Jan 2005 um 13:51 hat OROSZI Bal=E1zs geschrieben:
>
> If you want to load a bitmap from a file (.bmp), then you have to look
> for an image library or write your own loader, as the Win32 API doesn't
> support loading bitmaps from files directly.
>
> It can load bitmaps from resources though. See LoadBitmap() for details.
>
> --
> Greetings,
> Bal=E1zs
|