OLE Automation

Here we enumerate the functions which are currently implemented in the latest release of NCSA Mosaic for Windows. This list will be growing soon, perhaps with input from you.

The CCI is implemented as an OLE 2.0 Automation Server. This means that any application which can act as an OLE Automation Client can access Mosaic through this interface.


Function headers for CCI functions

These are the function headers for the CCI functions, taken directly from the source code for NCSA Mosaic.

    afx_msg BOOL ResolveUrl (LPCTSTR szURL);
    afx_msg BOOL DownloadUrl (LPCTSTR szURL, LPCTSTR szPath);
    afx_msg CVariant GetVersion ();
    afx_msg CVariant GetLastLaunchedAnchor (LPCTSTR szName);
    afx_msg CVariant GetAnchorCount ();
    afx_msg CVariant GetAnchorDesc (short index);
    afx_msg CVariant GetAnchorUrl (short index);
    afx_msg CVariant GetHistoryCount ();
    afx_msg CVariant GetHistoryItem (short index);
    afx_msg CVariant GetCurrentDocUrl ();
    afx_msg CVariant GetCurrentDocTitle ();

ResolveUrl (URLSTRING)

This function causes Mosaic to jump to a given URL just as if the user had clicked on a link for that URL. An example: ResolveUrl ("http://www.ncsa.uiuc.edu") would tell Mosaic to go to NCSA's home page.

VERSIONSTRING GetVersion ()

The GetVersion() function returns version information for Mosaic and the CCI. For this release, the GetVersion function returns the following string:

    NCSA Mosaic/2.0.0b3 (Windows x86)/CCI 0.11

TITLESTRING GetCurrentDocTitle ()
URLSTRING GetCurrentDocUrl ()

These two functions are used to retrieve information about the current document being displayed by Mosaic.

ITEMCOUNT GetHistoryCount ()
ITEMSTRING GetHistoryItem (ITEMINDEX)

This pair of functions is used to retrieve the information in Mosaic's History list. Currently Mosaic only stores the URL, so this is the information returned by GetHistoryItem(n). The index is 1 based, so a call to GetHistoryItem(1) returns the first URL in the history list. You should first find out how many items are in the history list by calling GetHistoryCount().

ITEMCOUNT GetAnchorCount ()
GetAnchorUrl (ITEMINDEX)
GetAnchorTitle (ITEMINDEX)

These three functions provide information about all the links that are on the page which Mosaic is currently viewing. The index is 1 based, so a call to GetAnchorUrl(1) will return the URL for the first link on the page.

DownloadUrl (URLSTRING, FILESTRING)

This function allows an external program to use Mosaic to access files over the Internet and save them to the local disk. The function takes two arguments:, the URL to be downloaded and the filename to save it to.

URLSTRING GetLastLaunchedAnchor (FILESTRING)

This function allows an external program to find out the complete anchor for a file which has been launched. If FILESTRING is empty, Mosaic will just return the URL for the last "launched" file. If FILESTRING is a filename, then Mosaic will check to see if the last launched anchor is associated with the give file and if so, it will return the URL. If the filename passed in is not the last launched file, then Mosaic will return an empty string.

For example, suppose a user clicks on a URL such as: http://it.ncsa.uiuc.edu/bigfilename.xyz, and the xyz viewer is launched and passed the name bigfilen.xyz. Then the xyz viewer can find out where the bigfilen.xyz came from by calling GetLastLaunchedAnchor("bigfilen.xyz"); Mosaic will return the full URL: http://it.ncsa.uiuc.edu/bigfilename.xyz.


WWW'95 Tutorial, Darmstadt, 10 Apr 1995
Briand Sanderson (briand@ncsa.uiuc.edu)
Tom Magliery (mag@ncsa.uiuc.edu)