Open Dialog with Bitmap Preview

Here is how the dialog looks like:

How to include in your project

  1. Copy BmpDlg.cpp and BmpDlg.h into your project directory.
  2. Copy BmpDlg.rc into your res directory
  3. Add this line to your project's rc2 file:
    #include "BmpDlg.rc"
  4. Add BmpDlg.cpp to your project.

How to use

The dialog is used just as a regular FileOpen dialog.

It has one additional member variable m_showpreview that you can store in the registry to make the "Show Preview" setting persistent.

Some notes

This class illustrates the use of Hook procedures and additional templates for this kind of dialogs. It can be used as a template to create dialogs with other, more specific, previews.

Download Source.



Comments

  • Anyone can help me how to add this Source Code?

    Posted by nhat72 on 03/01/2006 07:55pm

    I have try to add this Source Code to my project in Visual Studio, but it seem like it doesn't recognize the new source code added! So, please show me somethings

    Reply
  • Has anyone fixed the flicker problem yet?

    Posted by Legacy on 02/15/2003 12:00am

    Originally posted by: Bruce

    Such a wonderful class, I simply love it for displaying
    
    bitmaps, and it is highly expandable. However it has an
    annoying flicker while blitting the bitmaps. If anyone has
    fixed this problem, will you please share the code. Thank
    you Luis Ortega and thank you to the person who stops the
    flicker.

    Reply
  • RE: 24bit RGB bitmap problem

    Posted by Legacy on 11/11/2002 12:00am

    Originally posted by: wang

    the problem is:
    when we use:
    CBmpDialog::hpreview = (HBITMAP)LoadImage(AfxGetInstanceHandle(), filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);

    Here we use default size(real size) of the bitmap, so the StretchBlt function will stretch the bitmap. On most of display adapter, the pixels will be extruded as your discription.
    My method is: before you call LoadImage, you caclulate the bitmap size, and scale to suitable size. and then use the scale size instead the "0, 0". it'll be more beautiful.
    Remember: we cann't use StretchBlt anymore. choose BitBlt instead.


    Reply
  • 24bit RGB bitmap problem

    Posted by Legacy on 11/05/2002 12:00am

    Originally posted by: Igor Rosenberg

    Hi,
    your code work fine (thanks), but I have a problem with 24bit RGB bitmap. It's displyed, but the colors are wrong.
    Especialy, if I use a picture with lots of colors.
    Thanks for help.

    Reply
  • Changing Color of Common Dialog boxes

    Posted by Legacy on 01/22/2002 12:00am

    Originally posted by: Ravinder Bassi

    how to change color of open and save as dialog boxes

    Reply
  • Changing Color of Common Dialog boxes

    Posted by Legacy on 01/22/2002 12:00am

    Originally posted by: Ravinder Bassi

    how to change color of open and save as dialog boxes

    Reply
  • Terima kasih

    Posted by Legacy on 08/13/2001 12:00am

    Originally posted by: Acep Sumarna

    Saya hanya dapat mengucapkan terima banyak kasih kepada Anda yang telah memberikan sebuah pelajaran yang berharga ini. 
    
    Saya harap Anda senantiasa dapat membantu saya.

    ttd
    Acep Sumarna

    Reply
  • Could you include a demo project

    Posted by Legacy on 01/30/2001 12:00am

    Originally posted by: fgt cubed

    Could you include a demo project

    Reply
  • How to put the dialog in the center of the window?

    Posted by Legacy on 07/25/2000 12:00am

    Originally posted by: risingsun

    The dialog is not in the center, isn't it?

    Reply
  • The normal OpenFile Dialog is still appear.

    Posted by Legacy on 02/11/2000 12:00am

    Originally posted by: Virasak

    I did follow the step to add those file to my project. However, I saw only normal OpenFile Dialog appear whenever I clicked Open on toolbar. Is there any advice for me?

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

Most Popular Programming Stories

More for Developers

RSS Feeds