Standard File Open dialog with preview

This article describes a completely object oriented standard file open dialog with preview. No custom hook function, just common MFC message maps. The dialog has a CDibStatic member, which displays the preview image when available. The CDibStatic class encapsulates a static control that displays images and is described in an article in the static controls section.

This is how the dialog looks like:

The template for the dialog is a normal developer studio dialog template. Note however, the use of the stc32 static control. As it hasn't any text in it, it is invisible unless you select it. This static control will serve as a place holder for the standard file dialog controls, thus establishing the position of the newly added controls in respect to the standards. If there is no stc32 control specified in the template, all the new controls will be placed below the standard controls. Otherwise, the common file dialog will look at the size of the stc32 control to attempt to fit all the standard controls in it. If it is not big enough, it is resized to make room for the standard controls, and then the new controls are repositioned with respect to the resized stc32 control.

Palette support is included within the dialog class. It is implemented using handlers for the WM_QUERYNEWPALETTE and WM_PALETTECHANGED windows messages, so you have to ensure in your program that the dialog receives these messages. If the palette never changes, the image is painted with the right palette selected the first time. Since the standard dialogs are modal, the palette changes can be due only to other applications (unless you change it in another thread), thus realizing palette when gaining focus should always maintain the right colors. You can realize the palette at any time you wish by sending a WM_QUERYNEWPALETTE message to the CDibStatic control, for instance.

This class has been used (among other things) to implement a completely object oriented DIBLOOK. This article can be found in the samples section.

Download Source Code


Date Last Updated: April 3, 1999



Comments

  • Latest thing and Devise pay attention to your eyes

    Posted by motherdhmm on 06/04/2013 07:59pm

    [url=http://www.headphonescheaponlineaustralia.com/]beats by dre Australia[/url] Monstrosity Beats side, as an alternate any class of on any grumble files tend to be along the disposition to procure textile to prop all people within around closeness to be clever to well. you can have the difficulties when any one own within your is less ill than through dre acquire of your drive cheap dr dre beats, effectively any thoughts tend to be organising rightly . [url=http://www.headphonescheaponlineaustralia.com/beats-pro-c-66_68_75.html]beats Pro[/url] Bogeyman headphones of Kobe Bryant, he is thoroughly engraved on the recollection of basketball lovers. Beats by Dre create broad use of this star intent to dream up a small edition headphone named Beats at hand Dr. Dre Studio Kobe Bryant Little Printing Headphones. There is no doubt that this headphone last will and testament be the a- seller at present. You can not ignore the high-quality of this and the unexcelled mould which prompt our mind. Brute headphones with noise canceling technology are on the cut edge of vogue that spreads nationwide. [url=http://www.headphonescheaponlineaustralia.com/]dr dre beats[/url] Hideousness headphones in Australia more and more in fashion, more people drink thebeats close to Dre, a earmark that was seen by some lawbreakers affair opportunities, hence, followed beside distribution of hoax and poor products and markets, to manyconsumers in sadness, to spend a straws of money to suborn is not true beats during dre beats away Dre. Again, if you¡¯re reading this, then you are lucky, the contemplating that the next wish be to suggest, purchase authentic beats by dre should be noted that the treaty of these later in the purchase of a monstrosity headphones you can steal veritable the.

    Reply
  • GHD glattejern er helt unike og det er ogsÃ¥ derfor de sælger sÃ¥ godt

    Posted by motherdhmm on 05/30/2013 07:38pm

    [url=http://www.buy-beatsdrdre.com/]beats by dre[/url] ghd fladjern også kendt som elektriske krydsfiner, er krydsfiner populært kaldes, er opvarmet af aktuelle ghd glattejern for MCH eller PTC varmelegeme eller varmt wire, aluminium eller keramik plade til at overføre varme. ghd glattejern, Guming Si Yi er at glatte håret, håret gennem varmeelement for varme, blødgøre, og derefter afkølet for at opnå formålet med glat hår. Nu ghd glattejern, glatte begge dele, og kan trække lydstyrken. Ghd glattejern før, den største bruger er en professionel salon barber, Europa og Amerika fra 2007 personer er kommet på hjemmemarkedet, til hår derhjemme kan være en SPA. Ghd glattejern vil nu ind på det danske hjemmemarked, vil være en væsentlig produkter til personlig pleje, ligesom kamme den samme popularitet. [url=http://www.blog.cheapbeatsbydre.co.nz/]beats by dre[/url] Hår er en kvindes identitet, Enhver kvinde håber alle, at gennem de forskellige stilarter til at ændre billedet, Face, at gøre sig smukkere, mere ungdommeligt, eller elegance, vil man være i stand til at opfylde alles idé om hår, Vi lærer sammen, hvordan til at vælge billige ghd glattejern? ghd glattejern, hvordan du bruger? Forberedelse. [url=http://www.buy-beatsdrdre.com/]beats by dre headphones[/url] Grim ælling til en svane par vinger, Askepot blive den stolte dronning behøver kun et hår stick. Må ikke se enden, er det svært at forestille sig sådan et stort show af momentum Bang Bao reklame propaganda kun GHD hår pinde. Elegant paladser og farverig klædt crowd do folie, gør GHD hår pinde, ad kaldet generøse. Dens reklame følelsesmæssige appeller hovedsagelig at gøre med den smukke eventyr keynote, men insisterede på, at kortene ikke følger almindelig sund fornuft, det modsatte i jagten på en uventet effekt af USA, viser også fremragende produkt egenskaber. Selvhævdende kvinder uafhængige og selvsikre charme. Henvender sig til hjerter sine mål forbrugerne at opnå en selv-identitet, herunder personlighed, værdier og dermed skabe et godt indtryk af deres brand, og til gengæld deres mærkeloyalitet. Det copywriting I slutningen af reklamer, “Du kan gøre noget med dit hår – GHD prikken over i’et, enkel og kraftfuld.

    Reply
  • Just for clarity.

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

    Originally posted by: Chad Wanless

    At first I was a litle confused by the mention of a stc32 static control. I couldn't find it in the dialog resource I downloaded. For those of you who may be having troubles placing the preview static control to the right side (not the bottom), the solution is this. Jorge had drawn a text static control on left side of the dialog form very thin (8 +- pixels wide), duplicate this control in your projects as he has and you will have no problems.

    Chad Wanless

    Reply
  • Another small bug!

    Posted by Legacy on 05/06/1999 12:00am

    Originally posted by: Andrew Truckle

    I noticed that if you look closely at the "cross" which is drawn when there is no bitmap to display, the top right endpoint is past the white bitmap area. Likewise the bottom left startpoint begins one pixel in.

    This became visible when I selected a file which had a preview and I could see a small dot in the top right corner.

    It is resolved if you modify lines 137/138 in file DibStatic.cpp to look like this:

    dc.MoveTo(PaintRect.right - 1, PaintRect.top);
    dc.LineTo(PaintRect.left - 1, PaintRect.bottom);

    This should fix the problem in the short term. But it might need looking into further.

    Reply
  • A Small Bug

    Posted by Legacy on 03/24/1999 12:00am

    Originally posted by: Rick York

    I found a small bug in CDIBStatic::PaintDib.
    
    The effect of the bug can be seen when drawing certain
    bitmaps that are not square. They will appear outside
    the rectangle or not centered.

    Lines 108 and 109 of DIBStatic.cpp read :

    nDestWidth = m_DIB.Height();
    nDestHeight = m_DIB.Width();

    They should be reversed to read :

    nDestWidth = m_DIB.Width();
    nDestHeight = m_DIB.Height();

    Reply
  • Can I get project file about it

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

    Originally posted by: Eric Lee

    If I get a project file about bitmap preview on Dialog, it's my goodness.
    Please would anybody send me project file about bitmap preview on Dialog?

    Reply
  • How to use?

    Posted by Legacy on 01/12/1999 12:00am

    Originally posted by: Torbj�rn Josefsson

    I've tried using this to the best of my (meager) ability..
    Do you have any tips?

    Regards
    /Torbj�rn Josefsson

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

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: November 13, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT APIs can be a great source of competitive advantage. The practice of exposing backend services as APIs has become pervasive, however their use varies widely across companies and industries. Some companies leverage APIs to create internal, operational and development efficiencies, while others use them to drive ancillary revenue channels. Many companies successfully support both public and private programs from the same API by varying levels …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds