C + + code snippets (accumulation)

Source: Internet
Author: User

1. The MFC Midpoint dialog box displays a path and file saved as:

void Cpatchdlg::onbnclickedbtnpath () {//once to select Save As a path M_strsavepath = ""; Browseinfo bi; ZeroMemory (&bi, sizeof (Browseinfo)); Bi.hwndowner = M_hwnd;bi.ulflags   = bif_returnonlyfsdirs; Lpitemidlist pidl = SHBrowseForFolder (&BI); BOOL bRet = FALSE; TCHAR szfolder[max_path*2];szfolder[0] = _t (' n '), if (pidl) {if (SHGetPathFromIDList (Pidl, szfolder)) BRet = True;i Malloc *pmalloc = null;if (SUCCEEDED (Shgetmalloc (&pmalloc)) && pmalloc) {pmalloc->free (pidl);p malloc- >release ();}} M_strsavepath = szfolder;//The directory path selected UpdateData (FALSE);
The following four lines indicate that the file name and path are returned by selecting a file;//cfiledialog dlg (TRUE);///true is the Open dialog box, False is the Save As dialog box//if (dlg. DoModal () ==idok)//m_strsavepath=dlg. GetPathName ();//updatedata (FALSE);}


C + + code snippets (accumulation)

Related Article

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.