关于HBITMAP
请看下面的代码:
CFileDialog filedlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "图像(*.bmp)|*.bmp ");
UINT returndata=filedlg.DoModal();
HBITMAP h_bitmap=(HBITMAP)::LoadImage(AfxGetApp()-> m_hInstance,(LPCTSTR)filedlg.GetFileName(),IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
我这样写了之后,
最后得到了一个HBITMAP,我想把这个句柄转成ID
行不行啊,请大家指点一下。本人刚学VC两个多月。
[解决办法]
转成ID ??
首选,你这个ID是用在什么地方的
是资源吗,那是不可能的
你要实现什么
[解决办法]
CBitmap::FromHandle
static CBitmap* PASCAL FromHandle( HBITMAP hBitmap );
Return Value
A pointer to a CBitmap object if successful; otherwise NULL.
Parameters
hBitmap
Specifies a Windows GDI bitmap.
Remarks
Returns a pointer to a CBitmap object when given a handle to a Windows GDI bitmap. If a CBitmap object is not already attached to the handle, a temporary CBitmap object is created and attached. This temporary CBitmap object is valid only until the next time the application has idle time in its event loop, at which time all temporary graphic objects are deleted. Another way of saying this is that the temporary object is only valid during the processing of one window message.
CBitmap Overview | Class Members | Hierarchy Chart
--------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.