?
Solved

loading bitmap in SDI application

Posted on 2003-11-13
6
Medium Priority
?
385 Views
Last Modified: 2012-05-04
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
0
Comment
Question by:cancermcs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9745723
1) Add static control with SS_BITMAP style to the FormView dialog template
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.
0
 

Author Comment

by:cancermcs
ID: 9762249
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::OnLoadIndexBitmap(CString objvalue)
{


      m_strBmpFileOb = "C:\\Object\\";
      m_strBmpFileOb += objvalue;
      m_strBmpFileOb += ".bmp";

      if(!m_strBmpFileOb.IsEmpty())
      {
      

            m_pBmp1 = new CBitmap();      
            HBITMAP hBitmap = (HBITMAP)LoadImage(AfxGetApp()->m_hInstance,m_strBmpFileOb,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);

            if(hBitmap)
      m_pBmp1->Attach(hBitmap);
               
**       m_ctrlBmpDig.SetBitmap(m_pBmp1);
                                                m_ctrlBmpDig.SetWindowPos(NULL,ptB.x,ptB.y,10,10,SWP_SHOWWINDOW);
          m_ctrlBmpDig.ShowWindow (SW_SHOW);}
                  
}
cancermcs
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9762271
Try:

m_ctrlBmpDig.SetBitmap((HBITMAP)m_pBmp1->m_hObject );
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cancermcs
ID: 9776484
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
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10249172
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
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10308142
PAQed, with points refunded (40)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question