mfc-Simple function Use

Source: Internet
Author: User

1. MessageBox (str); a simple function, the function argument is a string. Used to pop up a window to display the contents of STR, str is a string.

2. UpdateData (); This function is the key for handling control variables in VC + +. Used to handle the display of data in variables and controls on the screen. This is determined by a variable, or by a variable. This is in parentheses. When the argument is false, Passes the value of the variable to the control in the window, or to True when the value in the control is passed to the control variable. * * Note: All edit boxes are updated every time you use the UpdateData function. For example: UpdateData (False), the contents of all the edit boxes in a window are assigned to the variable of the edit box; UpdateData (true) to pass the value of all edit box variables in a window to the edit box displayed on the screen. Therefore, use the function with special care.

3. GetDlgItem (); This function is used to get a pointer to a child window, and the returned pointer is a CWnd pointer (in fact, CWnd is the base class for all user-interface objects). The parameter of the function is the ID of the child window, which is the ID of the control.

4. EnableWindow (); Used to turn on or off the user's ability to interact with the called window, its arguments are a Boolean value. If True, the control is enabled and the control can be manipulated;                                                                                                                                  If False, the close window control becomes dimmed and is not selected. We can first use function 3 to get a pointer to a control and then call the control's function. For example: GetDlgItem (idc_msg)->enablewindow (true); This statement is used to open an ID of idc_ The control of the MSG.

5. WinExec (); This function is used to enable other functions, two of the parameters are the program name one is open. For example: WinExec ("E:\\easybcd\\easybcd.exe", sw_show); This function is an obsolete function. So in the vs2013 seems to be used no effect (no error, but can not open the program), more commonly used is the following function.

6. ShellExecute (); This function can open various files, of course, including the application, this function has a series of parameters,

HWND hwnd,//parent window Handle
LPCTSTR lpoperation,//operation, open mode "edit", "Explore", "open", "find", "print", "NULL"
LPCTSTR lpfile,//file name, front add path
LPCTSTR lpparameters,//Parameter
LPCTSTR lpdirectory,//default folder
INT nshowcmd//display mode

For example: ShellExecute (NULL, "open", "d:\\development tool\\90sp1\\quartus\\readme.txt", NULL, NULL, SW_SHOW);

7.CreatProcess (); The function can also be used to open the application, but the parameters are really too many, and difficult to understand, for the novice is really inappropriate to use, so this does not write its usage.

mfc-simple functions using

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.