[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
MessageBox(HWND hWndParent, BYTE *pszString, BYTE *pszCaption, WORD wFlags)
Parameters
hWndParent can be NULLHWND or the handle to a window which is the message
box's parent. If you give NULLHWND as this argument,
you will always be safe.
pszString is the textual information which will be displayed inside of
the message box. It can have embedded carriage returns in
it when you want a new line to begin. The MessageBox()
logic will determine the number of lines that the message
box will be, the centering of the strings, and will take
care of wordwrapping. Embedded newlines are not necessary
unless you want to have control over where new lines begin.
The rest of the arguments are the same as in previous versions.
TIP
The quickest way to get existing code to work with the new version
of MessageBox, is to define a new function : OldMessageBox , that
takes the old message box syntax and translates it to the new.
Then a simple 'Global Find & Change' on MessageBox to OldMessageBox
will get you going. The definition of OldMessageBox below will
produce message boxes that, in most instances, look just like
pre-V3.1 message boxes. The exception to this is for message boxes
that had very long lines, these will probably end up being massaged
by the new MessageBox and end up with more lines.
int PASCAL OldMessageBox(BYTE *text1,BYTE *text2,BYTE *text3,
BYTE *caption,unsigned short wType)
{
char * pMessageBuffer;
int iResult;
pMessageBuffer = emalloc(strlen(text1)+strlen(text2)+strlen(text3)+3);
*pMessageBuffer = '\0';
if (text1)
strcat(pMessageBuffer, text1);
strcat(pMessageBuffer, "\n");
if(text2)
strcat(pMessageBuffer, text2);
strcat(pMessageBuffer, "\n");
if(text3)
strcat(pMessageBuffer, text3);
iResult = MessageBox(NULLHWND, pMessageBuffer, caption, wType);
MyFree(pMessageBuffer);
return(iResult);
}
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson