BOOL LoadBitmap (LPCTSTR lpszresourcename) bool LoadBitmap (UNIT nIDResource)
Loads an anchor map by specifying a resource name or resource ID. However, the resource specified by the program cannot be directly identified by the path and name of the bitmap. If the function call succeeds, it returns a value other than 0, otherwise 0
Cbitmap::loadbitmap () cannot be opened as a file, the reason is not known, although provided LPCTSTR lpszResourceName (Host Note: This parameter is the DLL or EXE resource name, not the file name), gives another method, is also commonly used. Take a look at the following code: CBitmap bmp; Hbitmap hbmp;//bitmap handle hbmp= (HBITMAP):: LoadImage (NULL, "bitmap1.bmp", image_bitmap,0,0, Lr_loadfromfile);// Open bitmap resource bmp from File bitmap1.bmp. Attach (hbmp);//Binding
To display bitmaps:
CDC dcmemory; cbitmap* poldbmp; Dcmemory.createcompatibledc (PDC); Poldbmp = Dcmemory.selectobject (bitmap); Pdc->bitblt (0,0,500,500,&dcmemory,0, 0,srccopy); Dcmemory.selectobject (poldbmp);
For a bitmap resource that the program loads well:
CBitmap bitmap; CDC dcmemory; Bitmap. LoadBitmap (IDB_BITMAP1); Dcmemory.createcompatibledc (PDC); Dcmemory.selectobject (&BITMAP); Pdc->bitblt (0,0,699,919,&dcmemory,0,0,srccopy);