[Reserved] way to write dialog / C ++ prompt box

step one:

    Header files #include <windows.h>

 

 

Step Two

   Defined main function int main ()

   MessageBox function frame is then played:

   MessageBox (NULL can console program in general, "the text box", "box titled" Dialog style option);

 

 

Step Three

   "Dialog text" to fill in the middle part of the dialog box, write the title, such as "prompt", "Welcome" text, style options above wrote "MB_OK" you can use the number 0 instead. No icon represents a dialog box the default option for the first button, and a button only "OK."

   Below are all of the parameters

   MB_OK default. There is a definite.

   MB_YESNO and there is not.

   MB_ABORTRETRYIGNORE there Abort, Retry, and skip

   MB_YESNOCANCEL have Yes, No and Cancel

   MB_RETRYCANCEL have Retry and Cancel

   MB_OKCANCEL have OK and Cancel

 

 

Step Four

   These values ​​are all above may be used instead of numbers starting from 0, the following is the icon information dialog:

  (Please between different types of values ​​for +)

   16: Cha Cha

   32: question mark

   48: exclamation point

   64: lowercase i

  In this I do not want to talk about the default, because the default value is often used only when using the keyboard.

 

 

Step five:

Why do so many buttons do? Because MessageBox return value ah!

The following information is the return value of the function:

OK: 1

Canceled: 2

Give up: 3

Retry: 4

Skip: 5

is 6

No: 7

It can be used if (MessageBox (NULL, "determines the start point", "tips", MB_OKCANCEL) == 1) to determine the message box return value (that is, click on the button) is not "OK."

Guess you like

Origin www.cnblogs.com/baoyihan/p/11302333.html