应该有具体的函数
在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.
在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.
解决方案 »
- MFC的注释宏
- 关于串口通讯中的WaitCommEvent函数
- 如何实现MP3边播放边解密?
- VC中怎样在一个指定的文件夹里获取一个文件的文件名?
- 请问:如何使用下拉框实现获取本地驱动器列表?
- 在一个长时间的循环中,如何做到点击窗体,界面还能正常显示.
- 怎样把Windows2000的COM+1.0升级为COM+2.0? 在那里下载什么安装包呢?
- AfxBeginThread()函数调用出现问题。
- 急问:基于TCP的socket传输媒体流数据问题的解决
- 新人求教,学孙鑫Vc深入详解第8章遇到问题添加好属性表单这个菜单项后点击无法弹出模态对话框
- MFC是怎么为CDialog处理Tab键的
- 如何获取QQ窗口RichEdit文本框中的内容(已经句柄)
如果你要打开位图显示在窗口上,要先了解一下.bmp文件的格式,读取.bmp文件中相关信息,再用windows的函数把图片显示出来。
参考CBitmap
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;
}
可直接装载IPP库的各种格式图象文件,自动按文件扩展名进行识别