LoadImage问题。
代码:CImageListpImgList;pImgList.Create(16,16,ILC_COLOR|ILC_MASK,0,4);HBITMAPhBmp;hBmp=...
代码:
CImageList pImgList;
pImgList.Create(16,16,ILC_COLOR|ILC_MASK,0,4);
HBITMAP hBmp;
hBmp=(HBITMAP)LoadImage(AfxGetInstanceHandle(),"F:\\Lang\\English.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
CBitmap* pBmp=CBitmap::FromHandle(hBmp);
pImgList.Add(pBmp,RGB(255,0,0));
m_L001.SetImageList(&pImgList,2);
m_L001.InsertColumn(0,"Test",LVCFMT_LEFT,200);
m_L001.InsertItem(0,"TestText",0);
说明:
m_L001为CListCtrl
LoadImage函数没有返回错误,但hBmp在调试时其值如0x0951182{unused=???}
LoadImage函数如果最后一项添加LR_CREATEDIBSECTION则提示内存不足
目的:为了在相关对话框中的CListCtrl中显示图片及说明
问题:按上述代码无法显示,请问如何解决?
如果要获取并显示多个不同的图片文件该如何做? 展开
CImageList pImgList;
pImgList.Create(16,16,ILC_COLOR|ILC_MASK,0,4);
HBITMAP hBmp;
hBmp=(HBITMAP)LoadImage(AfxGetInstanceHandle(),"F:\\Lang\\English.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
CBitmap* pBmp=CBitmap::FromHandle(hBmp);
pImgList.Add(pBmp,RGB(255,0,0));
m_L001.SetImageList(&pImgList,2);
m_L001.InsertColumn(0,"Test",LVCFMT_LEFT,200);
m_L001.InsertItem(0,"TestText",0);
说明:
m_L001为CListCtrl
LoadImage函数没有返回错误,但hBmp在调试时其值如0x0951182{unused=???}
LoadImage函数如果最后一项添加LR_CREATEDIBSECTION则提示内存不足
目的:为了在相关对话框中的CListCtrl中显示图片及说明
问题:按上述代码无法显示,请问如何解决?
如果要获取并显示多个不同的图片文件该如何做? 展开
2个回答
2011-07-06
展开全部
Declare Function LoadImage& Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long)
Declare Function LoadImageBynum& Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As Long, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long)
关于参数的详细资料到这里查看:
位置在“位图、图标和光栅运算函数”第二页
Private Const LR_COLOR As Long = &H2
Private Const LR_COPYDELETEORG As Long = &H8
Private Const LR_COPYFROMRESOURCE As Long = &H4000
Private Const LR_COPYRETURNORG As Long = &H4
Private Const LR_CREATEDIBSECTION As Long = &H2000
Private Const LR_DEFAULTCOLOR As Long = &H0
Private Const LR_DEFAULTSIZE As Long = &H40
Private Const LR_LOADFROMFILE As Long = &H10
Private Const LR_LOADMAP3DCOLORS As Long = &H1000
Private Const LR_LOADTRANSPARENT As Long = &H20
Private Const LR_MONOCHROME As Long = &H1
Private Const LR_SHARED As Long = &H8000
Private Const LR_VGACOLOR As Long = &H80
另外,站长团上有产品团购,便宜有保证
Declare Function LoadImageBynum& Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As Long, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long)
关于参数的详细资料到这里查看:
位置在“位图、图标和光栅运算函数”第二页
Private Const LR_COLOR As Long = &H2
Private Const LR_COPYDELETEORG As Long = &H8
Private Const LR_COPYFROMRESOURCE As Long = &H4000
Private Const LR_COPYRETURNORG As Long = &H4
Private Const LR_CREATEDIBSECTION As Long = &H2000
Private Const LR_DEFAULTCOLOR As Long = &H0
Private Const LR_DEFAULTSIZE As Long = &H40
Private Const LR_LOADFROMFILE As Long = &H10
Private Const LR_LOADMAP3DCOLORS As Long = &H1000
Private Const LR_LOADTRANSPARENT As Long = &H20
Private Const LR_MONOCHROME As Long = &H1
Private Const LR_SHARED As Long = &H8000
Private Const LR_VGACOLOR As Long = &H80
另外,站长团上有产品团购,便宜有保证
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询