|
-
May 24th, 1999, 09:45 AM
#1
How to load jpeg/gif/bmp images to a imagebox when clicking on a listbox
I have a dialogbox with a listbox and image control and couple of textboxes. The listbox lists some image file names from the local hard drive. I need to have the imagebox show the image I click on from listbox. The following code dosen't work. s_pfilelist is aCListBox object and s_pImg is a CImage object.
void CPicExampleView::OnSetfocusFilelist()
{
CString sz;
m_pfilelist.GetText(m_pfilelist.GetCurSel(), sz);
HBITMAP hBitmap=LoadBitmap(AfxGetInstanceHandle(),sz.GetBuffer(100));
CPictureHolder pictholder;
pictholder.CreateFromBitmap(hBitmap);
//Pass dispatch pointer to CPictureHolder
m_pImg.SetPicture(pictholder.GetPictureDispatch());
}
Please help me. Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|