Opens a QuickWin window.
#include <io.h>
int _wopen( struct _wopeninfo *wopeninfo,
struct _wsizeinfo *wsizeinfo, int oflag );
wopeninfo | Pointer to a _wopeninfo structure | |
wsizeinfo | Pointer to a _wsizeinfo structure | |
oflag | Type of operations allowed |
The _wopen function opens a QuickWin window, returning a file handle to the window. This routine is used only in QuickWin programs; it is not part of the Windows API. For full details about QuickWin, see Chapter 8 of Programming Techniques (in the Microsoft C/C++ version 7.0 documentation set).
The _wopeninfo and _wsizeinfo structures, declared in IO.H, are used to pass window initialization information, including the window's initial size and position on the screen. You can pass NULL for the _wsizeinfo argument to accept QuickWin size and positioning defaults, or you can declare a variable of type _wsizeinfo and fill in its fields with initial values. You must declare a variable of type _wopeninfo and fill in its fields.
For both the _wopeninfo and _wsizeinfo variables, set the _version field to _WINVER, which is defined in IO.H.
For the _wopeninfo variable, assign a null-terminated string to the _title field containing the desired window title. You can also optionally set the size of the window's screen buffer in the _wbufsize field. The default is 2,048 bytes, but you can pass some other number or the value _WINBUFINF. The value _WINBUFINF imposes no limit on the buffer size.
For the _wsizeinfo variable, if you choose to pass size information, assign one of the following values to the _type field:
Value | Meaning |
_WINSIZEMIN | Minimize the window |
_WINSIZEMAX | Maximize the window |
_WINSIZECHAR | Use character coordinates for the window size |
If the type is _WINSIZECHAR, you must supply the _x, _y, _h, and _w values in the remainder of the structure. They specify the upper-left corner and the height and width of the window (in characters).
The _wopen function is a low-level I/O call. It accepts the following access flags: _O_BINARY, _O_RDONLY, _O_RDWR, _O_TEXT, _O_WRONLY.
These flags can be combined with the bitwise-OR operator (|). See _open for additional information about the flags.
Unlike the _open function, _wopen does not accept the _O_CREAT, _O_TRUNC, or _O_EXCL flag. Using one of these flags results in an error.
If successful, _wopen returns a QuickWin file handle. A return value of –1 indicates an error; errno is set to one of the following values:
Value | Meaning |
EINVAL | An invalid oflag argument was given |
EMFILE | No more file handles available (too many open files) |
Standards:None
16-Bit:QWIN
32-Bit:None
_fwopen, _wabout, _wclose, _wgetexit, _wgetfocus, _wgetscreenbuf, _wgetsize, _wmenuclick, _wsetexit, _wsetfocus, _wsetscreenbuf, _wsetsize, _wyield
/* WOPEN.C - Demonstrate opening a QuickWin
* window with _wopen
*/
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#define PERSISTFLAG _WINNOPERSIST
#define OPENFLAGS _O_RDWR
void main( void )
{
int wfh; /* File handle for window */
int nRes; /* Window write results */
struct _wopeninfo wininfo; /* Open information */
/* Set up window open information */
wininfo._version = _WINVER;
wininfo._title = "Window Closing";
wininfo._wbufsize = _WINBUFDEF;
/* Open a window with _wopen */
/* NULL second argument accepts default size */
wfh = _wopen( &wininfo, NULL, OPENFLAGS );
if( wfh == -1 )
{
printf( "***ERROR: On _wopen\n" );
exit( -1 );
}
/* Write in the window */
nRes = write ( wfh, "Windows Everywhere!\n", 20 );
/* Close the window with _wclose */
nRes = _wclose( wfh, PERSISTFLAG );
exit( 0 );
}