_Dialog( ) API Library Routine Example

The following example creates four dialog boxes with three, two, one, and no buttons.

Visual FoxPro Code

SET LIBRARY TO DIALOG  

C Code

#include <pro_ext.h>

void putLong(long n)
{
   Value val;

   val.ev_type = 'I';
   val.ev_long = n;
   val.ev_width = 10;

   _PutValue(&val);
}

void FAR dialogEx(ParamBlk FAR *parm)
{
   int selection;

   selection = _Dialog(DIALOG_SCHEME, "Example dialog with 3 buttons.",
      "First", "Second", "Third", 2, 3);

   _PutStr("\nItem selected ="); putLong(selection);

   selection = _Dialog(DIALOG_SCHEME, "Example dialog with 2 buttons.",
      "First", "Second", 0, 2, 2);

   _PutStr("\nItem selected ="); putLong(selection);

   selection = _Dialog(DIALOG_SCHEME, "Example dialog with 1 button.",
      "First", (char *)0, (char *)0, 1, 1);

   _PutStr("\nItem selected ="); putLong(selection);

   selection = _Dialog(DIALOG_SCHEME, "Example dialog no buttons.",
      (char *)0, (char *)0, (char *)0, 1, 2);

   _PutStr("\nItem selected ="); putLong(selection);
}

FoxInfo myFoxInfo[] = {
   {"DIALOGEX", (FPFI) dialogEx, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};