cancermcs
asked on
loading bitmap in SDI application
Hello
how can i load bitmaps directly on screen in an SDI application(FormView) class?I have to load bitmap from any drive in My computer without selecting from dialog.
cancermcs
how can i load bitmaps directly on screen in an SDI application(FormView) class?I have to load bitmap from any drive in My computer without selecting from dialog.
cancermcs
ASKER
Hi AlexFM
here i did the work...I have a my class name CMyPicture who set the coordinates of bitmap.objvalue is the value comming from table whose required bitmap has to be loaded.but on line showing ***,a debug eror comes out.
what should i do for it.
here is code:
protected:
CMyPicture m_ctrlBmpDig;
public:
CBitmap* m_pBmp1;
CString m_strBmpFileOb;
void CPPCView::OnLoadIndexBitma p(CString objvalue)
{
m_strBmpFileOb = "C:\\Object\\";
m_strBmpFileOb += objvalue;
m_strBmpFileOb += ".bmp";
if(!m_strBmpFileOb.IsEmpty ())
{
m_pBmp1 = new CBitmap();
HBITMAP hBitmap = (HBITMAP)LoadImage(AfxGetA pp()->m_hI nstance,m_ strBmpFile Ob,IMAGE_B ITMAP,0,0, LR_DEFAULT SIZE|LR_LO ADFROMFILE );
if(hBitmap)
m_pBmp1->Attach(hBitmap);
** m_ctrlBmpDig.SetBitmap(m_p Bmp1);
m_ctrlBmpDig.SetWindowPos( NULL,ptB.x ,ptB.y,10, 10,SWP_SHO WWINDOW);
m_ctrlBmpDig.ShowWindow (SW_SHOW);}
}
cancermcs
here i did the work...I have a my class name CMyPicture who set the coordinates of bitmap.objvalue is the value comming from table whose required bitmap has to be loaded.but on line showing ***,a debug eror comes out.
what should i do for it.
here is code:
protected:
CMyPicture m_ctrlBmpDig;
public:
CBitmap* m_pBmp1;
CString m_strBmpFileOb;
void CPPCView::OnLoadIndexBitma
{
m_strBmpFileOb = "C:\\Object\\";
m_strBmpFileOb += objvalue;
m_strBmpFileOb += ".bmp";
if(!m_strBmpFileOb.IsEmpty
{
m_pBmp1 = new CBitmap();
HBITMAP hBitmap = (HBITMAP)LoadImage(AfxGetA
if(hBitmap)
m_pBmp1->Attach(hBitmap);
** m_ctrlBmpDig.SetBitmap(m_p
m_ctrlBmpDig.SetWindowPos(
m_ctrlBmpDig.ShowWindow (SW_SHOW);}
}
cancermcs
Try:
m_ctrlBmpDig.SetBitmap((HB ITMAP)m_pB mp1->m_hOb ject );
m_ctrlBmpDig.SetBitmap((HB
ASKER
i tried it...Similarly i have tried the Example given in MSDN 2000 (in BitBlt) function but its not working...I must also tell u that i have already a device context(.bmp) running in my application over whom i have to show these other bitmaps.,,whats the solution now.
thanks
cancermcs
thanks
cancermcs
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:
PAQ with points refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Tinchos
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
PAQ with points refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Tinchos
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
2) Load required bitmat using LoadImage API with LR_LOADFROMFILE flag. It returns HBITMAP handle.
3) Set this handle to static control using CStatic::SetBitmap function.