_WOpenP( ) 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 WOPENP

C Code

#include <pro_ext.h>

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

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

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

   wh = _WOpenP(10, 10, 160, 320, 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 = _WOpenP(10, 10, 160, 320, 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 = _WOpenP(10, 10, 160, 320, 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 = _WOpenP(10,10,160,320,WEVENT | CLOSE,-1,customScheme,
      WO_SYSTEMBORDER);
   _WShow(wh);
}

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