_WGetPort( ) API Library Routine

Returns the WHANDLE of the window that is currently selected for user output.

WHANDLE _WGetPort(void any)
void any;                     /* Pointer. */

Example

The following example displays the window handle returned by _WGetPort( ) as the current output port is changed.

Visual FoxPro Code

SET LIBRARY TO WGETPORT

C Code

#include <pro_ext.h>

void putLong(long n, int width)
{
   Value val;

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

   _PutValue(&val);
}

FAR Example(ParamBlk FAR *parm)
{

   WHANDLE wh;
   WHANDLE oldPort;

   wh = _WOpen(2,10,23,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *)0,
      WO_SYSTEMBORDER);
   _WShow(wh);

   _PutStr("\n1) _WGetPort() ="); putLong(_WGetPort(), 10);

   oldPort = _WSetPort(wh);
   _PutStr("\n2) _WSetPort(wh) ="); putLong(oldPort, 10);
   _PutStr("\n3) _WGetPort() ="); putLong(_WGetPort(), 10);

   oldPort = _WSetPort(oldPort);
   _PutStr("\n4) _WSetPort(oldPort) =");  putLong(oldPort, 10);

   _PutStr("\nShould be back where we started.");
}

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

See Also

_WhToHwnd( ) API Library Routine | _WGetObjectClientWindow( ) API Library Routine | _GetObjectProperty( ) API Library Routine | GETOBJECT( ) Function