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

ID: Q100561

2.50 2.50a WINDOWS kbprg kbprb

The information in this article applies to:

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 
Version           : 2.50 2.50a
Platform          : WINDOWS

Last Reviewed: December 19, 1997