Creates a new window at the positions specified by the top, left, bottom, and right parameters.
WHANDLE _WOpenP(int top, int left, int bottom, int right, int flag, int scheme_num, Scheme FAR *scheme, char FAR *bord) int top; /* Top coordinate in pixels. */ int left; /* Left coordinate in pixels. */ int bottom; /* Bottom coordinate in pixels. */ int right; /* Right coordinate in pixels. */ int flag; /* Attributes. */ int scheme_num; /* Color scheme. */ Scheme FAR *scheme; /* Points to color scheme to use. */ char FAR *bord; /* Border type. */ |
Remarks
The window positions may be off the screen. Additional memory is allocated to hold the off-screen image of this window.
The flag parameter determines the attributes for this window. The flag may be one or more of the flag values in the table below. You can combine multiple flag values using the C | or + operator. Typical window borders are defined in PRO_EXT.H.
flag Value | Window attribute |
---|---|
WCURSOR |
The insertion point may be displayed in this window. |
ZOOM |
The user may zoom the window. |
ADJ |
The user may adjust the size of the window. |
CLOSE |
The user may close the window. |
MOVE |
The user may move the window. |
AUTOSCROLL |
The window scrolls when output rolls off the bottom line. |
WEVENT |
The window receives, activates, and deactivates events. |
SHADOW |
The window casts a shadow. |
WMODAL |
The user can't send this window to the back. |
WMINIMIZE |
The user can minimize this window. |
The scheme_num may be any valid color scheme number, or – 1 to indicate that the scheme parameter points to the color scheme to use.
For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.
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
В | Copy Code |
---|---|
SET LIBRARY TO WOPENP |
C Code
В | Copy 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 }; |