 |
 |
 |
|
|  |  |
 |
MessageBox 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 |
 |  | | Code examples: |  | |
|
 |  | | Declaration: |  |  |
int MessageBox(
HWND hWnd, // handle to owner window
LPCTSTR lpText, // text in message box
LPCTSTR lpCaption, // message box title
UINT uType // message box style
);
|
 |  |  | | FoxPro declaration: |  |  |
DECLARE INTEGER MessageBox IN user32 As MessageBoxA;
INTEGER hwnd,;
STRING lpText,;
STRING lpCaption,;
INTEGER wType
|
 |  |  | | Parameters: |  | hWnd
[in] Handle to the owner window of the message box to be created
lpText
[in] Pointer to a null-terminated string that contains the message to be displayed
lpCaption
[in] Pointer to a null-terminated string that contains the dialog box title
uType
[in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags |
 |  | | Return value: |  | | If the function succeeds, the return value is one of the predefined menu-item values |
 |  | | Usage: |  |
#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).
ENDTEXT
* 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)
|
 |  | | My comment: |  | 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:
Usage:
object.Popup (Message [, TimeOut][, Title] [, Format])
WshShell = CREATEOBJECT("WScript.Shell")
Result = WshShell.Popup("This is a popup box!", 10, "Title", 65)
? Result
* * *
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: |  | |  |  | | • |  | | Created: | 2001-07-18 12:00:00 | | Modified: | 2010-04-09 12:19:13 | Visited in last 7 days: 84 |
|
 |
 |
 |
 |
Copyright © 2001-2013
News2News, Inc.
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.
Privacy policy
|
 |
 |
 |
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.1.55-log), the Open Source standard SQL database,
AceHTML Freeware
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc. |
 |
 |
|
 |
 |
|
|