应该有具体的函数
在MSDN搜索LoadBitmap的用法看看。
HBITMAP LoadBitmap(
  HINSTANCE hInstance, 
  LPCTSTR lpBitmapName
); This function loads the specified bitmap resource from the executable file for a module.hInstance 
[in] Handle to the instance of the module for which the executable file contains the bitmap that you want to load. 
lpBitmapName 
[in] Long pointer to a null-terminated string that contains the name of the bitmap resource that you want to load. 
Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can be used to create this value. The maximum value for the resource identifier is 32000. 

解决方案 »

  1.   

    MFC中没直接显示.bmp文件的函数。
    如果你要打开位图显示在窗口上,要先了解一下.bmp文件的格式,读取.bmp文件中相关信息,再用windows的函数把图片显示出来。
    参考CBitmap
      

  2.   

    LoadImage Function--------------------------------------------------------------------------------Loads an icon, cursor, animated cursor, or bitmap.SyntaxHANDLE LoadImage(          HINSTANCE hinst,
        LPCTSTR lpszName,
        UINT uType,
        int cxDesired,
        int cyDesired,
        UINT fuLoad
    );
    #include <windows.h>
    #include <stdio.h>char *strFileName[]=
    {
        "d:\\1.bmp",
        "d:\\4.bmp",
        "d:\\8.bmp",
        "d:\\16.bmp",
        "d:\\24.bmp",
        "d:\\32.bmp"
    };void DumpInfo(char *szFileName,UINT uType) {
        HBITMAP
    hBitmap=(HBITMAP)LoadImageA(NULL,szFileName,IMAGE_BITMAP,0,0,uType);
        BITMAP bm;
        GetObject(hBitmap,sizeof(bm),&bm);
        printf("%s\t%d\n",szFileName,bm.bmBitsPixel);
    }int main()
    {
        
        printf("Flag=LR_LOADFROMFILE\n");
        for(int i=0;i<6;i++)
        {
            DumpInfo(strFileName[i],LR_LOADFROMFILE);
        }    printf("Flag=LR_LOADFROMFILE|LR_CREATEDIBSECTION\n");
        for(int i=0;i<6;i++)
        {
            DumpInfo(strFileName[i],LR_LOADFROMFILE|LR_CREATEDIBSECTION);
        }
        return 0;
    }
      

  3.   

    使用opencv,有个函数cvLoadImage( , );
    可直接装载IPP库的各种格式图象文件,自动按文件扩展名进行识别