_WOpen( ) API Library Routine Example

The following example creates windows using a number of different color schemes and borders. In particular, note the custom color scheme

Visual FoxPro Code

SET LIBRARY TO WOPEN 

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
   WHANDLE wh;

   Scheme customScheme =
   {
      (char) (BLACK_ON      | WHITE),
      (char) (RED_ON      | BLACK      | BLINK),
      (char) (WHITE_ON      | WHITE      | BRIGHT),
      (char) (CYAN_ON      | BLUE      | BRIGHT),
      (char) (GREEN_ON      | BROWN),
      (char) (BROWN_ON      | BROWN      | BRIGHT),
      (char) (MAGENTA_ON   | MAGENTA   | BRIGHT),
      (char) (RED_ON      | MAGENTA   | BRIGHT | BLINK),
      (char) (BROWN_ON      | GREEN      | BRIGHT),
      (char) (BLACK_ON      | CYAN),
      (char) (BLUE_ON      | CYAN),
   };

   _Execute("WAIT WINDOW 'Press any key to see a window \
      in WINDOW_SCHEME with WO_DOUBLEBOX border'");

   wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,
      WO_DOUBLEBOX);
   _WShow(wh);

   _Execute("WAIT WINDOW 'Press any key to see a window \
      in ALERT_SCHEME with WO_SINGLEBOX border'");
   _WClose(wh);

   wh = _WOpen(2,2,20,70,WEVENT | CLOSE,ALERT_SCHEME, (Scheme FAR *) 0,
      WO_SINGLEBOX);
   _WShow(wh);

   _Execute("WAIT WINDOW 'Press any key to see a window \
      in WINDOW_SCHEME with WO_PANELBORDER border'");
   _WClose(wh);

   wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,
      WO_PANELBORDER);
   _WShow(wh);

   _Execute("WAIT WINDOW 'Press any key to see a window \
      in a custom scheme with WO_SYSTEMBORDER border'");
   _WClose(wh);


   wh = _WOpen(2,2,20,70,WEVENT | CLOSE,-1,(Scheme FAR *) customScheme,
      WO_SYSTEMBORDER);
   _WShow(wh);


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