Loadin bitmap image from file not resources
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Loadin bitmap image from file not resources

Hybrid View

  1. #1
    Join Date
    Jul 2011

    Loadin bitmap image from file not resources

    Hi guys,
    I need to load a bitmap image from the file and show it in the screen in MFC. The following code load the image from a resource but I want to load it from a file.
    void CScViewView::OnDraw(CDC* pDC)
    CScViewDoc* pDoc = GetDocument();
    if (!pDoc)

    CBitmap bmpCar;
    CDC mdcCar;
    CSize szeBitmap;
    szeBitmap.cx = 1276;
    szeBitmap.cy = 1024;
    CBitmap *bmpOld = mdcCar.SelectObject(&bmpCar);
    pDC->BitBlt(0, 0, 1276, 1024, &mdcCar, 0, 0, SRCCOPY);
    SetScrollSizes(MM_TEXT, szeBitmap);

    I replaced the LoadBitmapW with this bmpCar.LoadBitmap((LPCTSTR) "mybitmap.bmp"), but it does not work.
    Thanks for you help in advance.

  2. #2
    Join Date
    Aug 2000
    New York, NY, USA

    Re: Loadin bitmap image from file not resources

    LoadBitmap Function
    The LoadBitmap function loads the specified bitmap resource from a module's executable file. This function has been superseded by the LoadImage function.
    And LoadImage() can load from file.
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!

HTML5 Development Center