Common cfiledialog dialog box

Source: Internet
Author: User

CfiledialogClass

Setbitmap

LoadImage

Dynamic Display of images

 

I. cfiledialog class

Constructor

Cfiledialog (bool bopenfiledialog, lpctstr lpszdefext = NULL, lpctstr

Lpszfilename = NULL, DWORD dwflags = ofn_hidereadonly |

Ofn_overwriteprompt, lpctstr lpszfilter = NULL, cwnd * pparentwnd = NULL );

 

Parameters

Bopenfiledialog

True: open, false, save

Lpszdefext

Default file extension. If you do not include an extension in the file name editing box, the extension defined by lpszdefext is automatically added to the file name. If it is null, no extension is added.

Lpszfilename

Default file name to open

Dwflags

Dialog Box flag

Ofn_hidereadonly // hide the read-only check box when enabled

Fn_overwriteprompt // when the file exists, a prompt box is displayed.

Ofn_readonly // the read-only check box is displayed.

Lpszfilter

The file extension list is as follows:

"Bitmap (*. BMP) | *. BMP | text file (*. txt) | *. txt | all files (*. *) | *. * | ";

Pparentwnd

Specify a parent window address

 

 

Ii. Picture control controls

Cstatic ::

Setbitmap

Specifies a bitmap to be displayed in the static control.

Getbitmap

Retrieves the handle of the bitmap previusly set with setbitmap.

Seticon

Specifies an icon to be displayed in the static control.

GetIcon

Retrieves the handle of the icon previusly set with seticon.

Setcursor

Specifies a cursor image to be displayed in the static control.

Getcursor

Retrieves the handle of the cursor image previusly set with setcursor.

Setenhmetafile

Specifies an Enhanced Metafile to be displayed in the static control.

Getenhmetafile

Retrieves the handle of the Enhanced Metafile previusly set with setenhmetafile

 

 

Iii. LoadImage Functions

Handle LoadImage (
 

Hinstance Hinst,// Handle of the instancecontaining the image
 

Lpctstr Lpszname,// Name or identifier ofimage
  

Uint Utype,// Type of image
 

Int Cxdesired,// Desired width
 

Int Cydesired,// Desired height
  

Uint Fuload// Load flags
);

 

 

// Load the image in the file

HBP = (hbitmap) LoadImage (null, filename, image_bitmap, 0, 0, lr_defaultsize | lr_loadfromfile );

// Load the image in the Resource

HBP = (hbitmap) LoadImage (afxgetapp ()-> m_hinstance, makeintresource (idb_bitmap2), image_bitmap, 0, 0, lr_defaultsize );

// Resize the image

HBP = (hbitmap) LoadImage (afxgetapp ()-> m_hinstance, makeintresource (idb_bitmap2), image_bitmap, 33,221, 0 );

 

 

// Release resources

Resource

Release resource functions

Bitmap

Deleteobject

Cursor

Destroycursor

Icon

Destroyicon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.