Home > Software engineering >  How to obtain a pointer to the open file dialog box wizard to create
How to obtain a pointer to the open file dialog box wizard to create

Time:10-02

Using VS wizard to create a single document after application framework, click on the file - "pop up when open: open file dialog box, how to manipulate the dialog? The pointer to the need to get it? How do I get?

CodePudding user response:

 
Void CVC60Doc: : OnFileOpen ()
{
//TODO: Add your command handler code here
CFileDialog dlgFile (TRUE);
//if the use of new style!
OSVERSIONINFO VersionInformation;
GetVersionEx (& amp; VersionInformation);
If (VersionInformation dwMajorVersion & gt;
=5)DlgFile. M_ofn. LStructSize=88;//new=88
The else
DlgFile. M_ofn. LStructSize=76;//old=76
//
DlgFile. M_ofn. LpstrTitle="Open Bitmap File".
DlgFile. M_ofn. LpstrFile=m_fileName;
DlgFile. M_ofn. Flags |=OFN_EXPLORER;
DlgFile. M_ofn. HInstance=AfxGetInstanceHandle ();
DlgFile. M_ofn. LpstrFilter="24 bits Bitmap file (*. BMP) \ 0 *. BMP \ 0 any file (*. *) \ 0 *. * \ 0";
DlgFile. M_ofn. LpstrDefExt="BMP";
//show

If (IDOK==dlgFile. DoModal ())
{//update all views
SetTitle (m_fileName);
PRFileList - & gt; Add (m_fileName);
ShowLeftBmp ();
ShowMiddleBmp ();
ShowRightBmp ();
}
}

CodePudding user response:

Thank you, reply, OnFileOpen () of this function is to write your own, is not on the wizard to generate the code change, right?

CodePudding user response:

Doc under the wizard class response: the command
ID_FILE_OPEN
  • Related