C ++ code snippets (accumulation) and code snippets

Source: Internet
Author: User

C ++ code snippets (accumulation) and code snippets

1. The click-out dialog box in MFC displays a path and file saved:

Void CPatchDlg: OnBnClickedBtnPath () {// save it 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 ('\ 0 '); if (pidl) {if (SHGetPathFromIDList (pidl, szFolder) bRet = TRUE; IMalloc * pMalloc = NULL; if (SUCCEEDED (SHGetMalloc (& pMalloc) {pMalloc-> Free (pidl); pMalloc-> Release () ;}} m_strSavepath = szFolder; // select the folder path UpdateData (FALSE );
// The following four lines indicate selecting a file return file name and path; // CFileDialog dlg (TRUE); // TRUE indicates the OPEN dialog box, FALSE: save as dialog box // if (dlg. doModal () = IDOK) // m_strSavepath = dlg. getPathName (); // UpdateData (FALSE );}



1. the following code snippet is provided:

(1) BC is correct. However, you must note that there is no break at the end of case 0, so if m = 0, "case 0 case 1" will be output"
(2) outer, inner indicates the jump position, but inner does not seem to use ....
If (j <2) break outer; this statement indicates that j <2 jumps out of the loop, so j cannot be less than 2, AB exclusion
In addition, when j = 2, I = 2, C is excluded, and only D is left.

Highlights

It seems that the highlights are not worth much. Only 15 points.
1. I dance on the stage and shout out, you may not know. What do I have to fear after that.
2. In the sudden rain, a girl gave a shoe-shining umbrella, and the beauty of human nature was so eye-catching. the smile of the girl and the old man was so charming.
3. The old lady buys things together, eats while walking, and abets others. What is the love of life and death.
4. A mother wiped her sweat and threw a sickle in the cool sun. There was a doll crying behind her back. Her mother took care of her children from time to time. The greatness of motherhood could not be concealed even if the sun was shining.
5. After thinking for a long time, I typed so many words to give you an idea. The neck and arm hurt. This kind of self-defeating spirit touched you and me.
 

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.