Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Win32 (http://www.go4expert.com/forums/win32/)
-   -   A Small Help (http://www.go4expert.com/forums/a-small-help-t61/)

alok 27Jul2004 15:58

A Small Help
 
this is samll code for dynamically loading the Bitmap Resource in Vc++ Program

hdc = BeginPaint(hWnd, &ps);hdc = GetDC(hWnd); // remove this statementhbitmap = (HBITMAP)LoadImage(NULL,szFileName,IMAGE_BITMAP,0, 0,LR_DEFAULTSIZE|LR_LOADFROMFILE);if(hbitmap==NULL ){ // add thisMessageBox(hWnd,"coudnt load ", "error ", MB_OK);break; // replace it with return statement} // add this// this doesnt return NULL , so the image is getting loaded properly ????HDC hdcMem = CreateCompatibleDC(hdc); GetObject(hbitmap ,sizeof(bmp), &bmp);SelectObject(hdcMem, hbitmap); BitBlt(hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); DeleteDC(hdcMem);EndPaint(hWnd, &ps);


All times are GMT +5.5. The time now is 04:04.