Add comment W32 Constants Translate this page
Creates, displays, and operates a message box. The message box contains an application-defined message and title, plus any combination of predefined icons and push buttons|
HWND hWnd, // handle to owner window
LPCTSTR lpText, // text in message box
LPCTSTR lpCaption, // message box title
UINT uType // message box style
DECLARE INTEGER MessageBox IN user32 As MessageBoxA;
[in] Handle to the owner window of the message box to be created
[in] Pointer to a null-terminated string that contains the message to be displayed
[in] Pointer to a null-terminated string that contains the dialog box title
[in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags
|If the function succeeds, the return value is one of the predefined menu-item values|
#DEFINE MB_RTLREADING 0x00100000
#DEFINE MB_RIGHT 0x00080000
DECLARE INTEGER MessageBoxW IN user32 As MessageBoxAPI;
INTEGER hWindow, STRING lpText,;
STRING lpCaption, LONG uType
LOCAL cMessage, cCaption, nDlgType
TEXT TO cMessage NOSHOW PRETEXT 4
Adding two right-to-left marks (RLMs), represented by Unicode
formatting character U+200F, in the beginning of a MessageBox
display string is interpreted by the Win32 MessageBox rendering
engine so as to cause the reading order of the MessageBox to be
rendered as right-to-left (RTL).
* Right-to-left mark
* CHR(0x0f) + CHR(0x20) +;
* CHR(0x0f) + CHR(0x20)
cMessage = ToUnicode( m.cMessage )
cCaption = ToUnicode( VERSION() )
nDlgType = BITOR(MB_RTLREADING, MB_RIGHT, 64)
*nDlgType = BITOR(MB_RTLREADING, 64)
= MessageBoxAPI(_screen.HWnd, m.cMessage, m.cCaption, m.nDlgType)
FUNCTION ToUnicode(cStr As String) As String
RETURN STRCONV(m.cStr+CHR(0), 5)
|See also: MessageBoxIndirect, TaskDialog, TaskDialogIndirect, SetWindowsHookEx |
Right-to-left MessageBox (see Usage code above):
* * *
Click on the picture below to download
Extended MessageBox library (FLL) for Visual FoxPro.
* * *
The Visual FoxPro contains a limited edition of this function, which is implemented via MESSAGEBOX() function. In most of the cases that is enough. Through the Win32 function you can reach all functionality of this dialog box.
The VFP, up to the version 6, gives an access to three groups of constants defining the contents and behavior of this object. There are several more groups (see the examples), which could be helpful.
For example, you can create a message box, which is placed on top of all open windows, not only the FoxPro Main window. Some other combinations of constants can give even more functionality, just try.
* * *
Another application of this function you might be interested in is to invoke a dailog in Automation Servers (EXE, DLL or MTDLL) created with Visual FoxPro. Built-in MessageBox generates an error (or at least fails to appear) while the API version of this function works Ok.
* * *
There are so many interfaces to this simple function from various programming languages. Here is another one from the Windows Scripting with the Timeout parameter puzzlingly positioned at the second place:
object.Popup (Message [, TimeOut][, Title] [, Format])
WshShell = CREATEOBJECT("WScript.Shell")
Result = WshShell.Popup("This is a popup box!", 10, "Title", 65)
* * *
An enhancement in the MessageBox implementation in Vista: the OS wraps long messages maintaining a reasonable width of the dialog window.
* * *
The SetWindowsHookEx, while virtually useless in pure VFP code, can easily be utillized in Visual FoxPro via creating a FLL or DLL library.
For example, provided a certain windows hook set, each following MESSAGEBOX() dialog within current VFP session would appear not centered but instead would automatically position itself at the specified screen location.
|Word Index links for the MessageBox :|
|Translate this page:|
Visited in last 7 days: 66
|Created: ||2001-07-18 12:00:00|
|Modified: ||2010-04-09 12:19:13|
Copyright © 2001-2018
Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use.
The information on this page is presented AS IS, meaning that you may use it at your own risk.
Microsoft Visual FoxPro
and Windows are trade marks
of Microsoft Corp.
All other trademarks are the property of their respective owners.
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.6.39), the Open Source standard SQL database,
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc.