WebExplorer Developer's Toolkit View Window API

Contents

This file includes information about:

In addition the API functions are defined in the follow categories:

Creating a WebExplorer View window

Creation of a view window is accomplished by calling the WinCreateWindow PM API call. The following information should be provided to WinCreateWindow:
WC_WXVIEW
This is the class name for the View window class. This class is registered automatically when an application accesses the WEBXWIN DLL.
PWXINITDATA
A pointer to a WXINITDATA structure can be passed in the pCtlData (user-defined data) field of the WinCreateWindow call. This provides a mechanism for initializing the view with specific values rather than the normal defaults. This parameter is optional; if it is NULL the window will be created with appropriate defaults.

Deleting a WebExplorer View window

Resources for the view window are deallocated when the caller issues the PM WinDestroyWindow API call. After this call is made, any further API calls made for the view window are undefined.

Structure Definitions


typedef struct _wxINITDATA { USHORT usThreads ; /* number of img loading threads */ BOOL bPaletteMgmt ; /* palette mgmt on or off? */ } WXINITDATA ;
typedef WXINITDATA *PWXINITDATA ;

typedef struct _wxCACHEOPTS {

BOOL bEnabled ; /* enable, disable cacheing */ BOOL bMemoryImageCacheing; /* keep cached images in memory */ LONG lDocLimit ; /* number of docs to cache */ LONG lImageLimit ; /* number of images to cache */ CHAR szCacheDir[WXMEDSTRING] ; /* default is TMP environ. var */ } WXCACHEOPTS ;
typedef WXCACHEOPTS *PWXCACHEOPTS ;

typedef enum _wxFONTSIZE {

WXFONT_SMALL, WXFONT_NORMAL, WXFONT_LARGE, WXFONT_XLARGE } WXFONTSIZE ;

typedef struct _wxDISPLAYOPTS {

CHAR szFontName[ WXSMALLSTRING ] ; WXFONTSIZE wxFontSize ; BOOL bUnderlineAnchors ; /* use underline text for links */ LONG lClrText ; /* text color */ LONG lClrAnchor ; /* link color */ LONG lClrVisitedAnchor ; /* seen link color */ LONG lClrBackground ; /* bg view color */ BOOL bInlineGraphics ; /* show inline images? */ BOOL bFastLoad ; /* load document ahead of images? */ BOOL bStreamingGraphics ; /* scanline-at-a-time redraw? */ BOOL bFancyInterlace ; /* blur the ilaced GIF? */ BOOL bInternalViewer ; /* view standalone imgs in view? */ BOOL bIgnoreImgErrors ; /* No red "X" over failed imgs? */ } WXDISPLAYOPTS ;
typedef WXDISPLAYOPTS *PWXDISPLAYOPTS ;

typedef ULONG WXGATEWAY ;

#define WXGATEWAY_NONE 0 #define WXGATEWAY_PROXY 1 /* gateway flags can be OR'ed */ #define WXGATEWAY_SOCKS 2

typedef struct _wxNETWORKOPTS {

CHAR szEmailAddress[ WXLARGESTRING ] ; /* user@host smtp style address */ CHAR szNewsServer[ WXLARGESTRING ] ; /* news hostname/ip address */ WXGATEWAY wxGateway ; /* proxy or socks server state */ CHAR szHTTPProxyServer[ WXLARGESTRING ] ; /* proxy gw (http://..) */ CHAR szSocksServer[ WXLARGESTRING ] ; /* socks gw hostname/ip address */ } WXNETWORKOPTS ;
typedef WXNETWORKOPTS *PWXNETWORKOPTS ;

typedef struct _wxVIEWER {

CHAR szMIMEType[ WXMEDSTRING ] ; /* MIME type to be viewed */ CHAR szProgram[ WXLARGESTRING ] ; /* program to use as a viewer */ } WXVIEWER ;
typedef WXVIEWER *PWXVIEWER ;

typedef enum _wxDATAFORMAT {

WXFORMAT_BINARY=0, WXFORMAT_7BIT, WXFORMAT_8BIT } WXDATAFORMAT ;

typedef enum _wxEXTMAP {

CHAR szExtension[ WXMEDSTRING ] ; /* extension to be mapped */ CHAR szMIMEType[ WXMEDSTRING ] ; /* MIME type to assign to this ext */ WXDATAFORMAT wxFormat ; /* binary, 7bit, etc. */ } WXEXTMAP ;
typedef WXEXTMAP *PWXEXTMAP ;

#define WXANCHOR_DEFAULT 0 /* can be OR'ed together */ #define WXANCHOR_VISITED 1

typedef enum _wxSEARCHOPTS {

WXSEARCH_FORWARD=0, WXSEARCH_BACKWARD } WXSEARCHOPTS ;

typedef enum _wxPOINTERTYPE {

WXPOINTER_NORMAL=0, WXPOINTER_ANCHOR, WXPOINTER_WAIT } WXPOINTERTYPE ;

typedef struct _wxPOS {

ULONG ulComponent ; USHORT x ; USHORT y ; } WXPOS ;
typedef WXPOS *PWXPOS ;

typedef struct _wxMOUSEDATA {

USHORT x ; USHORT y ; USHORT uswHitTest ; USHORT fsFlags ; } WXMOUSEDATA ;
typedef WXMOUSEDATA *PWXMOUSEDATA ;

typedef struct _wxBUTTONDATA {

USHORT usButtonNum ; USHORT usClickNum ; SHORT x ; SHORT y ; USHORT fsHitTestRes ; USHORT fsFlags ; } WXBUTTONDATA ;
typedef WXBUTTONDATA *PWXBUTTONDATA ;

typedef struct _wxTHREADDATA {

WXFLAGS wxflState ; ULONG ulProgressCount ; ULONG ulProgressLimit ; } WXTHREADDATA ;
typedef WXTHREADDATA *PWXTHREADDATA ;

typedef struct _wxPRINTINFO {

PDRIVDATA pDriverData ; PCSZ pszDriverName ; PCSZ pszQueueName ; PCSZ pszQueueDesc ; UINT nCopies ; } WXPRINTINFO ;
typedef WXPRINTINFO *PWXPRINTINFO ;

API Functions

Core View Functions


USHORT APIENTRY WXViewQueryVersion ( VOID );

Remarks:
The WXViewQueryVersion API call can be made at any time to request the version number of the currently loaded WEBXWIN DLL. The high byte of the return value is the major version number, the low byte is the minor version number.
Example:
USHORT usVersion ; usVersion = WXViewQueryVersion( ) ; if ( usVersion == 0x0102 ) { /* version 1.02 loaded */ } else if ( usVersion == 0x0110 ) { /* version 1.10 loaded */ } /* endif */

APIRET APIENTRY WXViewLoad ( HWND hwndView , PCSZ pcszURL , WXFLAGS wxLoadFlags , PWXANCHORDATA pwxAnchorData );

hwndView
A view window obtained by calling WinCreateWindow
pcszURL
A zero terminated string pointing to the fully qualified URL to load
wxLoadFlags
Loading options. These flags can be combined with the logical OR operator. Valid Flags are:
WXLOAD_ANCHOR :
Load a URL.
WXLOAD_FORCERELOAD :
Reload the document from its source rather than using the cached version of the document.
pwxAnchorData
Pointer to load data. The type of data pointed to by this parameter is specific to the type of load requested. The WX_LOADRESULT window message.

This call will fail if a previous load operation is still in progress for this view window. In this case the function will return immediately with a value of WX_ERROR. WXViewQueryLastError can then be called to retrieve the last error for this view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEINPROGRESS
A previous call to WXViewLoad is still pending on this view window.
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ char szURL[] = "http://www.ibm.com" ; if ( WXViewLoad( hwndView, szURL, WX_DEFAULT ) == WX_SUCCESS ) { /* parent window will now be posted with WX_LOADRESULT when this * operation completes */ } /* endif */

APIRET APIENTRY WXViewLoadToFile ( HWND hwndView , PCSZ pcszURL , PCSZ pcszFileName , WXFLAGS wxLoadFlags );

hwndView
A view window obtained by calling WinCreateWindow
pcszURL
A zero terminated string pointing to the URL to load
pcszFileName
A zero terminated string pointing to the file name in which the desired URL's contents will be copied.
wxLoadFlags
Loading options. See WXViewLoad for a list of valid loading options.
pwxAnchorData
Pointer to load data. The type of data pointed to by this parameter is specific to the type of load requested. (see wxLoadFlags)
Remarks:
WXViewLoadToFile should be used to initiate loading of a document directly to a file. Note that this function returns immediately. When the document loading is complete, the results are posted to the parent window via the WX_LOADRESULT window message.

This call will fail if a previous load operation is still in progress for this view window. In this case the function will return immediately with a value of WX_ERROR. WXViewQueryLastError can then be called to retrieve the last error for this view window.

As in the case of WXViewLoad, if the current document is contained in the cache in an acceptable format, the cached version will be used. The WX_FORCERELOAD flag will override any cache settings and retrieve the document from its source.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEFILE
The file name could not be opened for writing.
WXEINPROGRESS
A previous call to WXViewLoadToFile or WXViewLoad is still pending on this view window.
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ char szURL[] = "http://www.ibm.com" ; char szFileName = "c:\\temp\\temp.htm" ; if ( WXViewLoadToFile( hwndView, szURL, szFileName, WX_DEFAULT ) == WX_SUCCESS ) { /* parent window will now be posted with WX_LOADRESULT when this * operation completes */ } /* endif */

APIRET APIENTRY WXViewPrint ( HWND hwndView , PWXPRINTINFO pPrintInfo , USHORT usLen );

hwndView
A view window obtained by calling WinCreateWindow
pPrintInfo
Pointer to a WXPRINTINFO data structure for the desired printing options.
usLen
Length of pPrintInfo
Remarks:
WXViewPrint is used to print the contents of the document currently active in the view. There must be a valid, loaded document in the view window in order to print.

Note that this function will return immediately after initiating the print request, and a WX_PRINTRESULT message will be sent to the owner window when the printing operation completes.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENODOC
There is no document currently loaded in this view window.
WXEINPROGRESS
A document is currently being loaded in this view window.
Example:

APIRET APIENTRY WXViewCancelLoad ( HWND hwndView );

hwndView
A view window obtained by calling WinCreateWindow
Remarks:
WXViewCancelLoad will cancel the loading of the previous document. Note that the loading operation is not considered complete until the WX_LOADRESULT message has been sent to the parent window. Therefore, in order to cancel a loading operation and begin another load, the application must issue the WXViewCancelLoad call and then wait for the WX_LOADRESULT message to be posted before issuing another WXViewLoad API call.

This call will fail if there is no load operation currently in progress. In this case the function will return immediately with a value of WX_ERROR. WXViewQueryLastError can then be called to retrieve the last error for this view window.

Error Codes:
WXEINVAL
The view window handle is not valid.
WXENODOC
No document loading operation is currently in progress for this view window.
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ if ( WXViewCancelLoad( hwndView ) == WX_SUCCESS ) { /* parent window will now be posted with WX_LOADRESULT when this * operation completes */ } /* endif */

BOOL APIENTRY WXViewIsLoading ( HWND hwndView );

hwndView
A view window obtained by calling WinCreateWindow
Remarks:
WXViewIsLoading should be used to determine if a document is currently being loaded.

This function returns TRUE if a document is currently being loaded in the view window as a result of a previous WXViewLoadToFile API call. FALSE is returned if no document is currently being loaded


APIRET APIENTRY WXViewQueryPos ( HWND hwndView , USHORT x , USHORT y , PWXPOS pwxPos );

hwndView
A view window obtained by calling WinCreateWindow
x
the horizontal coordinate of the mouse position
y
the vertical coordinate of the mouse position
pwxPos
A pointer to a position structure which will be set to the document position that the given lMousePos corresponds to.
Remarks:
WXViewQueryPos is designed to take mouse coordinates such as those passed in the WX_BUTTONCLICK and WX_MOUSEMOVE messages and map them to a position in the current document. This position indicator can then be used in other API functions to query the contents of the document at that location.
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEINPROGRESS
A previous call to WXViewLoad is still pending on this view window.
Example:
/* assume a window procedure here; * mp1 is the first parameter in the window message call. * hwndView has been previously initialize via WinCreateWindow... */ case WX_BUTTONCLICK : { PWXBUTTONDATA pwxBData = (PWXBUTTONDATA)mp2 ; WXPOS wxPos ; WXViewQueryPos( hwndView, pwxBData->x, pwxBData->y, &wxPos ) ; /* ... do something with wxPos here ... */ }

APIRET APIENTRY WXViewQueryAnchor ( HWND hwndView , PWXPOS pwxPos , PSZ pszAnchor , USHORT usLen );

hwndView
A view window obtained by calling WinCreateWindow
pwxPos
A pointer to a position structure initialized by a call to WXViewQueryPos.
pszAnchor
A character buffer which will hold the anchor found at pwxPos
usLen
Length of pszAnchor
Remarks:
WXViewQueryAnchor will fill pszAnchor with the desired data for the anchor found at pwxPos. If the returned string is greater than or equal to usLen bytes, the returned value is a truncated version of the anchor and the error code for the view window is set to WXEBUFSIZE.

This call will fail if pwxPos does not point to a valid component of the document. In this case the function will return WX_ERROR and the WXViewQueryLastError function can be called to determine the specific error.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENOANCHOR
No anchor was found at this position
WXEBUFSIZE
The buffer size given was not large enough to hold the entire anchor.
Example:
#define BUFSZ 256 APIRET retErr ; /* assume a window procedure here; * mp1 is the first parameter in the window message call. * hwndView has been previously initialized via WinCreateWindow... */ case WX_BUTTONCLICK : { PWXBUTTONDATA pwxBData = (PWXBUTTONDATA)mp2 ; WXPOS wxPos ; char szAnchor[BUFSZ]; if ( WXViewQueryPos( hwndView, pwxBData->x, pwxBData->y, &wxPos ) == WX_SUCCESS ) { if ( WXViewQueryAnchor( hwndView, &wxPos, szAnchor, BUFSZ ) == WX_SUCCESS ) { /* ... do something with the anchor here ... */ } else { retErr = WXViewQueryLastError( hwndView ) ; } /* endif */ } else { retErr = WXViewQueryLastError( hwndView ) ; } /* endif */ }

USHORT APIENTRY WXViewQueryAnchorLen ( HWND hwndView , PWXPOS pwxPos );

hwndView
A view window obtained by calling WinCreateWindow
pwxPos
A pointer to a position structure initialized by a call to WXViewQueryPos.
Remarks:
WXViewQueryAnchorLen returns the length of the anchor which resides at pwxPos The current anchor's text or address can be obtained by calling WXViewQueryAnchor

This call will fail if there is no document currently active in the view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENODOC
No document is currently loaded in the view window.

APIRET APIENTRY WXViewQueryAnchorData ( HWND hwndView , PWXPOS pwxPos , PWXANCHORDATA pwxAnchorData , USHORT usLen );

hwndView
A view window obtained by calling WinCreateWindow
pwxPos
A pointer to a position structure initialized by a call to WXViewQueryPos.
pwxAnchorData
A caller-supplied buffer which will hold the anchor data found at pwxPos
usLen
Length of pwxAnchorData
Remarks:
WXViewQueryAnchorData will fill pwxAnchorData with the desired data for the anchor found at pwxPos. Typically WXViewQueryLastError function can be called to determine the specific error.
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENOANCHOR
No anchor was found at this position

USHORT APIENTRY WXViewQueryAnchorDataLen ( HWND hwndView , PWXPOS pwxPos );

hwndView
A view window obtained by calling WinCreateWindow
pwxPos
A pointer to a position structure initialized by a call to WXViewQueryPos.
Remarks:
WXViewQueryAnchorDataLen returns the length of the anchor data for the anchor which resides at pwxPos The current anchor's data can be obtained by calling WXViewQueryAnchorData

This call will fail if there is no document currently active in the view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENODOC
No document is currently loaded in the view window.

APIRET APIENTRY WXViewQueryDocTitle ( HWND hwndView , PSZ pszTitle , USHORT usLen );

hwndView
A view window obtained by calling WinCreateWindow
pszTitle
A character buffer which will hold the current document title
usLen
Length of pszTitle
Remarks:
WXViewQueryDocTitle will fill pszTitle with the current document title. If the title string is greater than or equal to usLen bytes, the returned value is a truncated version of the title and the error code for the view window is set to WXEBUFSIZE.

This call will fail if there is no document currently active in the view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEBUFSIZE
The buffer size given was not large enough to hold the entire title string.
WXENODOC
No document is currently loaded in the view window.

USHORT APIENTRY WXViewQueryDocTitleLen ( HWND hwndView );

hwndView
A view window obtained by calling WinCreateWindow
Remarks:
WXViewQueryDocTitleLen return the length of the current document title. The current title string can be obtained by calling WXViewQueryDocTitle

This call will fail if there is no document currently active in the view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENODOC
No document is currently loaded in the view window.

APIRET APIENTRY WXViewQueryDocAnchor ( HWND hwndView , PSZ pszAnchor , USHORT usLen );

hwndView
A view window obtained by calling WinCreateWindow
pszAnchor
A character buffer which will hold the anchor of the currently loaded document
usLen
Length of pszAnchor
Remarks:
WXViewQueryDocAnchor will fill pszAnchor with the anchor of the current document. If the anchor string is greater than or equal to usLen bytes, the returned value is a truncated version of the anchor and the error code for the view window is set to WXEBUFSIZE.

This call will fail if there is no document currently active in the view window. In this case, WX_ERROR is returned and WXViewQueryLastError may be called to retrieve the last error for this view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEBUFSIZE
The buffer size given was not large enough to hold the entire title string.
WXENODOC
No document is currently loaded in the view window.

USHORT APIENTRY WXViewQueryDocAnchorLen ( HWND hwndView );

hwndView
A view window obtained by calling WinCreateWindow
Remarks:
WXViewQueryDocAnchorLen returns the length of the current document's anchor string. The current anchor can be obtained by calling WXViewQueryDocAnchor

This call will fail if there is no document currently active in the view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENODOC
No document is currently loaded in the view window.

APIRET APIENTRY WXViewSearch ( HWND hwndView , WXSEARCHOPTS wxSearchOpts , PWXPOS pwxStartPos , PWXPOS pwxNextPos , PCSZ pcszSearchData );

hwndView
A view window obtained by calling WinCreateWindow
wxSearchOpts
Indicates the type of search to be performed. It may be one of:
WXSEARCH_FORWARD :
Begin the search starting at pwxStartPos and moving forward.
WXSEARCH_BACKWARD :
Begin the search starting at pwxStartPos and moving backward.
pwxStartPos
Starting position to begin the search from.
pwxNextPos
Upon successful return from the function, pwxNextPos will be filled with the position information of the search data.
pcszSearchData
String to search for in the document
Remarks:
WXViewSearch will search the current document for pcszSearchData in the direction specified by wxSearchOpts. If pwxStartPos is NULL, the search begins from the top of the document (for WXSEARCH_FORWARD) or bottom of the document (for WXSEARCH_BACKWARD).

If the search string is not found in the document given the search criteria, the function fails with WX_ERROR and WXViewQueryLastError will hold WXENOTFOUND. Note that it may be useful for some applications to check specifically for this error code since it can be used to indicate when a search operation must "wrap" to the top or bottom fo the document.

This call will fail if there is no document currently active in the view window.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENOTFOUND
The search string was not found in the document.
WXENODOC
No document is currently loaded in the view window.

APIRET APIENTRY WXViewSetAnchorState ( HWND hwndView , PCSZ pcszAnchor , WXFLAGS wxAnchorOpts );

hwndView
A view window obtained by calling WinCreateWindow
pcszAnchor
A string which holds the anchor to set the state for.
wxAnchorOpts
New state for this anchor. It can be one of:
WXANCHOR_DEFAULT :
Reset this anchor to its default state.
WXANCHOR_VISITED :
Mark this anchor as visited.
Remarks:
WXViewSetAnchorState will update the view window's representation of the specified anchor. The most obvious effect of this is the color used to represent "visited" anchors in the view differs from that of anchors which have not been visited.

The WXViewQueryAnchorState API call can be used to find the anchor's current state.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewQueryAnchorState ( HWND hwndView , PCSZ pcszAnchor , PWXFLAGS pwxAnchorOpts );

hwndView
A view window obtained by calling WinCreateWindow
pcszAnchor
A string which holds the anchor to set the state for.
pwxAnchorOpts
Upon successful completion of this function, pwxAnchorOpts will hold the current state of the specified anchor. For a list of valid states, see the WXViewSetAnchorState function.
Remarks:
WXViewQueryAnchorState will query the view window's current representation of the specified anchor.
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewQueryLastError ( HWND hwndView );

hwndView
A view window obtained by calling WinCreateWindow
Remarks:
WXViewQueryLastError will return the last error code set for this view window, or WXENONE if no error is present on this view window. hwndView must be a valid window handle initialized by WinCreateWindow, otherwise behavior of this function is undefined.
Error Codes:
WXENONE
The last API call completed successfully
Other
API specific error code returned. See the description of the API function for an explanation of this error.
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ APIRET retErr ; retErr = WXViewQueryLastError( hwndView ) ;

APIRET APIENTRY WXViewQueryLastLoadError ( HWND hwndView );

hwndView
A view window obtained by calling WinCreateWindow
Remarks:
WXViewQueryLastLoadError will return the load error for this view window. This value is reset whenever a new load operation is initiated. If the last load operation completed successfully, WXENONE is returned.
Error Codes:
WXENONE
The last API call completed successfully
Other
API specific error code returned. See the description of the API function for an explanation of this error.

HPOINTER APIENTRY WXViewQueryPointer ( HWND hwndView , WXPOINTERTYPE wxPointerType );

hwndView
A view window obtained by calling WinCreateWindow
wxPointerType
The type of view pointer to query. It can be one of the following:
WXPOINTER_NORMAL :
The default pointer when the pointer is in the view window.
WXPOINTER_ANCHOR :
The pointer used when over an anchor in the view window.
WXPOINTER_WAIT :
The pointer used when the view window is not accepting input.
Remarks:
WXViewQueryPointer returns the pointer currently installed for each of the various pointer types used by the view window. The pointer returned by this function should not be deleted as it is currently in use by the view window.
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewSetPointer ( HWND hwndView , WXPOINTERTYPE wxPointerType , HPOINTER hPointer );

hwndView
A view window obtained by calling WinCreateWindow
wxPointerType
The type of view pointer to query. See WXViewQueryPointer for a list of possible pointer types.
hPointer
Handle of the new pointer to install.
Remarks:
WXViewSetPointer installs hPointer for the view window pointer identified by wxPointerType. Once installed, this pointer is used by the view window and therefore must not be deleted. In order to safely delete the pointer, another call to WXViewSetPointer must be made in order to replace the currently installed pointer.

Note that you can restore the view window's default pointer types by specifying a NULLHANDLE for hPointer.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

Configuration Functions


APIRET APIENTRY WXViewQueryCacheOpts ( HWND hwndView , PWXCACHEOPTS pwxCacheOpts , USHORT usSize );

hwndView
Window handle obtained by calling WinCreateWindow
pwxCacheOpts
Pointer to a WXCACHEOPTS structure. Upon successful completion of this function, the structure is loaded with the current cache settings.
usSize
Size of the structure pointed to by pwxCacheOpts
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewSetCacheOpts ( HWND hwndView , PWXCACHEOPTS pwxCacheOpts , USHORT usSize );

hwndView
Window handle obtained by calling WinCreateWindow
pwxCacheOpts
Pointer to a WXCACHEOPTS structure. This structure is loaded with the desired settings before calling the function. Upon successful completion, the new settings are in effect.
usSize
Size of the structure pointed to by pwxCacheOpts
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewQueryDisplayOpts ( HWND hwndView , PWXDISPLAYOPTS pwxDisplayOpts , USHORT usSize );

hwndView
Window handle obtained by calling WinCreateWindow
pwxDisplayOpts
Pointer to a WXDISPLAYOPTS structure. Upon successful completion of this function, the structure is loaded with the current cache settings.
usSize
Size of the structure pointed to by pwxDisplayOpts
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewSetDisplayOpts ( HWND hwndView , PWXDISPLAYOPTS pwxDisplayOpts , USHORT usSize );

hwndView
Window handle obtained by calling WinCreateWindow
pwxDisplayOpts
Pointer to a WXDISPLAYOPTS structure. This structure is loaded with the desired settings before calling the function. Upon successful completion, the new settings are in effect.
usSize
Size of the structure pointed to by pwxDisplayOpts
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewQueryNetworkOpts ( HWND hwndView , PWXNETWORKOPTS pwxNetworkOpts , USHORT usSize );

hwndView
Window handle obtained by calling WinCreateWindow
pwxNetworkOpts
Pointer to a WXNETWORKOPTS structure. Upon successful completion of this function, the structure is loaded with the current cache settings.
usSize
Size of the structure pointed to by pwxNetworkOpts
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.

APIRET APIENTRY WXViewSetNetworkOpts ( HWND hwndView , PWXNETWORKOPTS pwxNetworkOpts , USHORT usSize );

hwndView
Window handle obtained by calling WinCreateWindow
pwxNetworkOpts
Pointer to a WXNETWORKOPTS structure. This structure is loaded with the desired settings before calling the function. Upon successful completion, the new settings are in effect.
usSize
Size of the structure pointed to by pwxNetworkOpts
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENOPROXY
The proxy gateway was specified as enabled, but no valid proxy server was supplied.
WXENOSOCKS
The socks gateway was specified as enabled, but no valid socks server was supplied.

APIRET APIENTRY WXViewEnableGateway ( HWND hwndView , WXGATEWAY wxGateway );

hwndView
Window handle obtained by calling WinCreateWindow
wxGateway
Holds the desired gateway setting. Upon successful completion of this function, the gateway setting is in effect.
Remarks:
wxGateway can be one of the following values. Settings can be combined using the logical OR operator (|) to acheive the desired combination:
WXGATEWAY_PROXY
Use a socks gateway. Only valid if the gateway has been defined correctly via calling the WXViewSetNetworkOpts function.
WXGATEWAY_SOCKS
Use a socks gateway. Only valid if the gateway has been defined correctly via calling the WXViewSetNetworkOpts function.
WXGATEWAY_NONE
Use neither a socks or proxy gateway
Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXENOPROXY
A valid proxy server is not currently defined
WXENOSOCKS
A valid socks server is not currently defined

APIRET APIENTRY WXViewQueryViewer ( HWND hwndView , PCSZ pcszMIMEType , PWXVIEWER pwxViewer , USHORT usLen );

hwndView
Window handle obtained by calling WinCreateWindow
pcszMIMEType
String which holds the MIME type to query.
pwxViewer
Pointer to an viewer structure which will hold the values for the given MIME type upon return.
usLen
Length of the WXVIEWER structure
Remarks:
WXViewQueryViewer will return the viewer currently registered for the given MIME type pair. External viewers can be set or removed by using the WXViewSetViewer API call.

Note that WXViewQueryViewer will return WX_ERROR if there is no viewer currently registered for this MIME type.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEMIME
The syntax for the MIME type pair is invalid.
WXENOTFOUND
No viewer is currently registered for the requested MIME type.
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ APIRET retErr ; WXVIEWER wxViewer ; retErr = WXViewQueryViewer( hwndView, "application/pdf", &wxViewer, sizeof(WXVIEWER) ) ; if ( retErr != WX_SUCCESS ) { if ( WXViewQueryLastError( hwndView ) == WXENOTFOUND ) { /* no viewer registered for this MIME type */ } else { /* handle other errors here */ } /* endif */ } /* endif */

APIRET APIENTRY WXViewSetViewer ( HWND hwndView , PWXVIEWER pwxViewer , USHORT usLen );

hwndView
Window handle obtained by calling WinCreateWindow
pwxViewer
Pointer to a structure filled with the external viewer data to set
usLen
Length of the WXVIEWER structure
Remarks:
WXViewSetViewer will set the external viewer for the MIME type pair specified. Any previous setting for this MIME type will be replaced. The current viewer setting can be obtained by calling WXViewQueryViewer.

Note that several of the image MIME types can conflict with the bInternalViewer display option. If this flag is set to TRUE, the View window space will be used to view the images internally regardless of the setting for the external viewer. Setting this option to FALSE will cause the external viewer to be used for the relevant MIME types if viewers have been appropriately registered. The following MIME types are affected by the internal viewers display option:

If the call completes without an error, WX_SUCESS is returned, otherwise WX_ERROR is returned and WXViewQueryLastError can be used to obtain the specific error code.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEMIME
The syntax for the MIME type pair is invalid.
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ APIRET retErr ; WXVIEWER wxViewer ; strcpy( wxViewer.szMIMEType, "application/pdf" ); strcpy( wxViewer.szProgram, "c:\\apps\\acroread.exe" ); retErr = WXViewSetViewer( hwndView, &wxViewer, sizeof( WXVIEWER) ) ; if ( retErr != WX_SUCCESS ) { /* handle errors here */ } /* endif */

APIRET APIENTRY WXViewQueryExtMap ( HWND hwndView , PCSZ pcszExtension , PWXEXTMAP pwxExtMap , USHORT usLen );

hwndView
Window handle obtained by calling WinCreateWindow
pcszExtension
String which holds the extension to query.
pwxExtMap
Pointer to an extension map structure which will hold the values for the given extension upon return.
usLen
Length of the WXEXTMAP structure
Remarks:
WXViewQueryExtMap will return the mapping currently in place for pcszExtension. Upon successful return, pwxExtMap will be set with the appropriate mapping for this extension.

Note that WXViewQueryExtMap will return WX_ERROR if there is no mapping currently registered for this MIME type.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEMIME
The syntax for the MIME type pair is invalid.
WXENOTFOUND
No mapping currently exists for this extension
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ APIRET retErr ; WXEXTMAP wxExtMap ; retErr = WXViewQueryExtMap( hwndView, "application/pdf", &wxExtMap, sizeof(WXEXTMAP) ) ; if ( retErr != WX_SUCCESS ) { if ( WXViewQueryLastError( hwndView ) == WXENOTFOUND ) { /* no extension mapping for this MIME type */ } else { /* handle other errors here */ } /* endif */ } /* endif */

APIRET APIENTRY WXViewSetExtMap ( HWND hwndView , PWXEXTMAP pwxExtMap , USHORT usLen );

hwndView
Window handle obtained by calling WinCreateWindow
pwxExtMap
Pointer to a structure filled with the extension map data to set
usLen
Length of the WXEXTMAP structure
Remarks:
WXViewSetExtMap will set the external viewer for the MIME type pair specified within pwxExtMap. Any previous mapping for this extension will be replaced. The current extension mapping can be obtained by calling WXViewQueryExtMap.

Setting the szMIMEType member to the empty string effectively removes the mapping for this extension.

If the call completes without an error, WX_SUCESS is returned, otherwise WX_ERROR is returned and WXViewQueryLastError can be used to obtain the specific error code.

Error Codes:
WXEINVAL
One of the parameters passed to the function is invalid.
WXEMIME
The syntax for the MIME type pair is invalid.
Example:
HWND hwndView ; /* assume this was set via WinCreateWindow */ APIRET retErr ; WXEXTMAP wxExtMap ; strcpy( wxExtMap.szExtension, "pdf" ) ; strcpy( wxExtMap.szMIMEType, "application/pdf" ) ; wxExtMap.wxFormat = WXFORMAT_BINARY ; retErr = WXViewSetExtMap( hwndView, &wxExtMap, sizeof(WXEXTMAP) ) ; if ( retErr != WX_SUCCESS ) { /* handle errors here */ } /* endif */

Window Messages


The window messages listed below are passed to the parent window when the given event occurs.

WX_MOUSEMOVE

This message is passed to the parent as the mouse is moved within the view window.
mp1
HWND Window handle of the view window which sent this message
mp2
PWXMOUSEDATA Pointer to a WXMOUSEDATA structure.

WX_BUTTONCLICK

Remarks:
This message is passed to the parent window when one of the mouse pointer buttons is pressed while within the view window.
mp1
HWND Window handle of the view window which sent this message
mp2
PWXBUTTONDATA Pointer to a WXBUTTONDATA structure.

WX_LOADRESULT

Remarks:
This message is sent to the parent window when a load operation initiated by WXViewLoad completes. Note that this message does not necessarily indicate successful completion. This message is also sent when a call to WXViewCancelLoad causes a load operation to stop prematurely.
mp1
HWND Window handle of the view window which sent this message
mp2
WXFLAGS Holds the result of the load operation. It can take one of the following values:
WX_SUCCESS
WX_CANCELLED
WX_ERROR

In the event of an error, WXViewQueryLastLoadError can be called to get the specific error which occurred during the load operation.


WX_PRINTRESULT

Remarks:
This message is sent to the parent window when the printing of the current document initiated by WXViewPrint completes. Note that this message does not necessarily indicate successful completion. mp2 will hold the general result of the last print operation. WXViewQueryLastLoadError can be called to find the specific error code.
mp1
HWND Window handle of the view window which sent this message
mp2
WXFLAGS Holds the result of the print operation. It can take one of the following values:
WX_SUCCESS
WX_CANCELLED
WX_ERROR

In the event of an error, WXViewQueryLastLoadError can be called to get the specific error which occurred during the print operation.


WX_LOADSTATUS

Remarks:
This message will be sent while a load is in progress to indicate the status of the document, formatting and image loading threads. This is intended to allow the parent to update progress indicators, etc. which may change as the document is loaded.
mp1
HWND Window handle of the view window which sent this message
mp2
PWXTHREADDATA Pointer to an array of WXTHREADDATA structures.

The following indexes into PWXTHREADDATA array are defined:

WXTHDIDX_DOC
Refers to the document loading thread
WXTHDIDX_FMT
Refers to document formatting thread
WXTHDIDX_IMG1 through WXTHDIDX_IMG8
Refers to each of the possible loader threads. Note that some of these values may be undefined depending on the number of threads initially requested via the WXINITDATA structure. For example, if only four image loading threads were defined (which is the default), then WXTHDIDX_IMG5 through WXTHDIDX_IMG8 would be irrelevant since those threads are not defined for this view window.

The wxflState flag of the WXTHREADDATA structure indicates the current state of this thread. The following states are defined:

WXTHREAD_IDLE
For loader threads, this state indicates that no load operation is currently in progress. For the format thread, this means that an initial format or reformat is not in progress.
WXTHREAD_CONNECT
This state is only valid for loader threads. It indicates that a connection to a remote host in currently in progress on this thread.
WXTHREAD_WAIT
This state is only valid for loader threads. It indicates that a connection has been established and the thread is waiting for data to be sent.
WXTHREAD_DATA
This state indicates that the thread is currently processing data. In this case, the ulProgressCount and ulProgressLimit data members will contain the amount of data which has currently been processed.
WXTHREAD_RENDER
This state is only valid on image loading threads. It is not used when streaming images are enabled, since images are rendered during the WXTHREAD_DATA state. For graphics that are not streamed, the render state is used to indicate that all image data has arrived and is being processed before display on the output device.