Skip Headers
Oracle® Outside In Content Access
Release 8.3.5
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Sample Applications

Each of the sample applications included in this SDK is designed to highlight a specific aspect of the technology's functionality. We ship built versions of these sample applications. The compiled executables should be in the root directory where the product is installed.

The following copyright applies to all sample applications shipped with this product:

Copyright © Oracle 1993, 2010

All rights reserved.

You have a royalty-free right to use, modify, reproduce and distribute the Sample Applications (and/or any modified version) in any way you find useful, provided that you agree that Oracle has no warranty obligations or liability for any Sample Application files.

Building the Samples on a Windows System

Microsoft Visual Studio project files are provided for building each of the sample applications. For 32-bit versions of Windows, versions of the project files are provided for Visual Studio 6 (.dsp files) and Visual Studio 2005 (.vcproj files).

Note:

Because .vcproj files may not pick up the right compiler on their own, you need to make sure that you are building with the Win64 configuration in Visual Studio 2005. For 64-bit versions of Windows, only the Visual Studio 2005 versions are available.

The project files for the sample applications can be found in the \sdk\samplecode\win subdirectory of the Outside In SDK.

Building the Samples on a UNIX System

See the following sections for specific information about building the sample applications on your flavor of UNIX:

An Overview of the Sample Applications

Here's a quick tour of the sample applications provided with this product.

Note:

Please note that not all of the sample applications are provided for both the Windows and UNIX platforms. See the heading of each application's subsection for clarification.

casample

casample is an example of a typical usage of the Outside In Content Access API. Because this is intended as a simple template or reference for common Content Access usage, it creates only rudimentary output. However, it does initialize, exercise and cleanup Content Access output. Content Access requires the usage of the Outside In Data Access module. Therefore, this application also demonstrates usage of a portion of Data Access.

The application is executed from the command line and takes only one parameter, the name of the input file:

casample input_file

tademo (Windows Only)

The tademo sample application included with this product provides a simple demonstration of text access. The text from a file is read a block at a time and displayed in the tademo window. The TAReadFirst and TAReadNext functions are directly tied to menu options, and the block size may be set by the user. An option is also provided to save the text to a file.

This tutorial is specific to the Windows application tademo, though the UNIX application textdemo is almost identical. The following sections assume the reader has a basic understanding of the structure of Windows executable source code and Windows API calls.

Figure 10-1 OIT Text Access Demo

Surrounding text describes Figure 10-1 .

Overview

The bulk of this sample application is in six functions, as detailed in the following sections.

MainWndProc

LRESULT MainWndProc (
   HWND     hwnd, 
   UINT     message, 
   WPARAM   wParam, 
   LPARAM   lParam )

This is the window procedure for the main program window. It is responsible for processing menu options. It includes an information bar at the top that displays the name of the open file, the block read size, and the number and size of the currently displayed block.

DisplayWndProc

long FAR PASCAL DisplayWndProc (
   HWND     hwnd, 
   UINT     message, 
   WPARAM   wParam, 
   LPARAM   lParam )

This is the window procedure for the window that displays the document text.

DoTextOpen

int DoTextOpen (
   HWND      hwnd )

This function is called when the user selects the File–>Open menu option. It calls DAOpenDocument then TAOpenText to initiate text access for the file.

DoTextClose

VTVOID DoTextClose()

This function simply closes the text and data access handles generated by DoTextOpen, then frees the buffer used by the TAReadFirst and TAReadNext functions.

DoSaveTextAs

VTVOID DoSaveTextAs(
   HWND      hwnd)

DoSaveTextAs writes the document's text to a file. In this sample application, the text is always written to the file C:\tademo.txt, but the methods used in the DoSaveTextAs function could easily be enhanced for more flexible options.

DoTextBlockAccess

DAERR DoTextBlockAccess(
   HWND      hwnd,
   WORD      wType )

This function is called whenever the user selects the First Block or Next Block menu items. It calls text access to retrieve a block of text from the file, then makes the block available for display in the program window.

taredir (UNIX Only)

This sample provides a means of using the API presented in this guide without the need for Motif libraries. All extracted text is output to the standard output device, or can be redirected to a file or another device.

textdemo (UNIX Only)

The sample code in the textdemo files shows how to use the API presented in this guide. This application is essentially identical to the Windows-only application tademo, which is discussed at length in "tademo (Windows Only)".