PRB: Call to MessageBox() Acts As If ALT Key Were Pressed

Last reviewed: December 18, 1997
Article ID: Q100561
2.50 2.50a WINDOWS kbprg kbprb

The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SYMPTOMS

After the CallFn() function in FOXTOOLS.FLL is used to call the Windows MessageBox() function, the system behaves as if the ALT key were being pressed.

CAUSE

A zero (0) is being passed as the first parameter to the MessageBox() function. This causes the message box window to be a top-level window belonging to Windows itself, which causes problems with the READ command. For example, after the push button is chosen in the following program, the keyboard acts as if the ALT key were being held down, and nothing can be typed in the GET field.

   DEFINE WINDOW test ;
     AT  0, 0  ;
     SIZE 15,50 ;
     SYSTEM MINIMIZE
   MOVE WINDOW test CENTER
   ACTIVATE WINDOW test
   @ 5,5 GET y ;
     SIZE 1,20 ;
     DEFAULT " "
   @ 5,30 GET x ;
     PICTURE "@*VN Call MSGBOX" ;
     SIZE 2,15 ;
     DEFAULT 1 ;
     VALID CallMBox()
   READ CYCLE
   RELEASE WINDOW test


   FUNCTION CallMBox     &&  X VALID
   SET LIBRARY TO SYS(2004)+"foxtools"
   mbox = regfn("MessageBox", "ICCI","I")
   result = callfn(mbox, 0, ;
     "I called the Windows MessageBox() function", ;
     "Title Bar",16)
   SET LIBRARY TO
   RETURN .T.

RESOLUTION

Use the MsgBox() function in FOXTOOLS.FLL to put a message window on the screen. This function uses a format similar to that of the Windows MessageBox() function; however, MsgBox() takes only three arguments. In order to use this function, the CallMBox() function in the program above must be modified as follows:

   FUNCTION CallMBox     &&  X VALID
   SET LIBRARY TO SYS(2004)+"foxtools"
   result = msgbox("I called the FoxTools MsgBox() Function", ;
    "Title Bar",16)
   SET LIBRARY TO
   RETURN .T.

MORE INFORMATION

With the exception of RegFn() and CallFn(), the functions provided in FOXTOOLS.FLL are not supported by Microsoft Technical Support either electronically or by telephone. Some of these functions have existed for a while, but none of them have been through a true test cycle. However, as developers, we understand that it is important to get tools out as soon as possible, even if they are not fully supported. Microsoft provides no warranty, expressed or implied, regarding the use of these functions.


Additional reference words: FoxWin 2.50 2.50a like
KBCategory: kbprg kbprb
KBSubcategory: FxprgFoxtools
Keywords : FxprgFoxtools kbprb kbprg
Version : 2.50 2.50a
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.