Post by Trad on May 18, 2003 14:56:06 GMT -5
Ok well i said i wanted to write little articles about things and hope they will help me and others who read about them.
ok the messagebox() function is defined in windows.h and shows a box like this br]
^taken from FunctionX
but yeah, here is the main line you will need to know br]
MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
HWND = Handle to parent window
lpText = the text that you will see, the main thing
lpCaption = the message in the titlebar of the window
uType = the style of the window
here are the current styles br]
MB_OK
MB_OKCANCEL
MB_ABORTRETRYIGNORE
MB_YESNOCANCEL
MB_YESNO
MB_RETRYCANCEL
MB_CANCELTRYCONTINUE
MB_HELP
So say i want something that asks the user something that needs a yes or no response
MessageBox(hWnd,"We All Should Join In, In The C++ Forum Shouldnt We?","Important Message",MB_YESNO);
Last of all, you can include an icon with the messagebox
MB_ICONEXCLAMATION
MB_ICONWARNING
Warning the user of an action performed on the application
MB_ICONINFORMATION
MB_ICONASTERISK Informing the user of a non-critical situation
MB_ICONQUESTION
Asking a question that expects a Yes or No, or a Yes, No, or Cancel answer
MB_ICONSTOP
MB_ICONERROR
MB_ICONHAND A critical situation or error has occurred. This icon is appropriate when informing the user of a termination or deniability of an action
you can have as many of these as you want, but in the uType parameter, seperate them with the bitwise OR operator, e.g
MessageBox(Null,Null,Null,MB_ICONHAND | MB_ICONQUESTION | MB_ICONASTERISK);
hope you learnt something.
ok the messagebox() function is defined in windows.h and shows a box like this br]
^taken from FunctionX
but yeah, here is the main line you will need to know br]
MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
HWND = Handle to parent window
lpText = the text that you will see, the main thing
lpCaption = the message in the titlebar of the window
uType = the style of the window
here are the current styles br]
MB_OK
MB_OKCANCEL
MB_ABORTRETRYIGNORE
MB_YESNOCANCEL
MB_YESNO
MB_RETRYCANCEL
MB_CANCELTRYCONTINUE
MB_HELP
So say i want something that asks the user something that needs a yes or no response
MessageBox(hWnd,"We All Should Join In, In The C++ Forum Shouldnt We?","Important Message",MB_YESNO);
Last of all, you can include an icon with the messagebox
MB_ICONEXCLAMATION
MB_ICONWARNING
Warning the user of an action performed on the application
MB_ICONINFORMATION
MB_ICONASTERISK Informing the user of a non-critical situation
MB_ICONQUESTION
Asking a question that expects a Yes or No, or a Yes, No, or Cancel answer
MB_ICONSTOP
MB_ICONERROR
MB_ICONHAND A critical situation or error has occurred. This icon is appropriate when informing the user of a termination or deniability of an action
you can have as many of these as you want, but in the uType parameter, seperate them with the bitwise OR operator, e.g
MessageBox(Null,Null,Null,MB_ICONHAND | MB_ICONQUESTION | MB_ICONASTERISK);
hope you learnt something.