home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
tolkit45.zip
/
os2tk45
/
samples
/
wps
/
browse
/
browse.idl
< prev
next >
Wrap
Text File
|
1999-05-11
|
15KB
|
461 lines
//# This file was generated by the SOM Compiler.
//# FileName: browse.id2.
//# Generated using:
//# SOM Precompiler somopc: 2.7
//# SOM Emitter emitidl: 2.22
//
//
// Module Name: BROWSE
//
// OS/2 Work Place Shell Sample Program
//
// Copyright (C) 1993 IBM Corporation
//
// DISCLAIMER OF WARRANTIES. The following [enclosed] code is
// sample code created by IBM Corporation. This sample code is not
// part of any standard or IBM product and is provided to you solely
// for the purpose of assisting you in the development of your
// applications. The code is provided "AS IS", without
// warranty of any kind. IBM shall not be liable for any damages
// arising out of your use of the sample code, even if they have been
// advised of the possibility of such damages.
//
#ifndef browse_idl
#define browse_idl
#include <wpdataf.idl>
#include <browcls.idl>
#include <somcls.idl>
interface M_Browse_O_Matic;
interface Browse_O_Matic : WPDataFile
//
// CLASS: Browse_O_Matic
//
// CLASS HIERARCHY:
//
// SOMObject
// └── WPObject
// └── WPFileSystem
// └── WPDataFile
// └── Browse_O_Matic
//
// DESCRIPTION:
//
// This is the sample Browse_O_Matic object class. This object provides
// a hex and text dump view for file system objects that are dropped on
// instances of it.
//
// An instance of this class can be created as a Workplace object.
//
{
VOID BrowseOMatic(in BOOL bMode,
in PSZ pszName);
//
// METHOD: BrowseOMatic ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Displays a file in the specified format.
//
// BOOL bMode - Specifies the format of the view. Supported values:
// PMBROWSE_HEX_DISPLAY_MODE
// PMBROWSE_TEXT_DISPLAY_MODE
//
// PSZ pszName - The name of the file to display. Can't be NULL.
//
// RETURN:
//
// N/A
//
PSZ DuplicateString(in PSZ pszString);
//
// METHOD: DuplicateString ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Duplicates a null terminated string. The buffer is allocated using
// wpAllocMem() and must be freed using wpFreeMem().
//
// PSZ pszString - A NULL terminated string.
//
// RETURN:
//
// A pointer to the copy of pszString.
//
VOID ErrorHandler(in PSZ pszInfo,
in APIRET rc);
//
// METHOD: ErrorHandler ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Displays error information in a PM window.
//
// PSZ pszInfo - A description of the error condition.
// APIRET rc - The error code from the failing method.
//
// RETURN:
//
// N/A
//
BOOL FileExists(in PSZ pszFileName);
//
// METHOD: FileExists ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Determines if a file exists.
//
// PSZ pszFileName - A fully qualified path and file name.
//
// RETURN:
//
// TRUE - The file exists.
// FALSE - The file does not exist.
//
UINT GetHexLine(in USHORT usLine,
in PBYTE pBuffer,
in ULONG ulFileLength,
in PSZ pszText);
//
// METHOD: GetHexLine ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Formats 16 bytes of the object for display.
//
// USHORT usLine - The number of the line to get.
// PBYTE pBuffer - Pointer to the buffer where the file is loaded in
// ULONG ulFileLength - The size of the file.
// PSZ pszText - Buffer to store the formated line in.
//
// RETURN:
//
// The length of the formated display line.
//
VOID GetLinesAndColumns(in BOOL bDisplay,
in PSHORT psTotalLines,
in PSHORT psTotalColumns,
in USHORT usNumberOfTextLines,
in USHORT usNumberOfTextColumns,
in ULONG ulFileLength);
//
// METHOD: GetLinesAndColumns ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Determines the maximum number of lines and columns based on the current
// view mode.
//
// BOOL bDisplay - The display mode. Supported values:
// PMBROWSE_TEXT_DISPLAY_MODE
// PMBROWSE_HEX_DISPLAY_MODE
// PSHORT psTotalLines - Return total number of lines.
// PSHORT psTotalColumns - Return maximum number of columns.
// USHORT usNumberOfTextLines - The total number of text lines.
// USHORT usNumberOfTextColumns - The maximum number of text columns.
// ULONG ulFileLength - The length of file.
//
// RETURN:
//
// N/A
//
BOOL GetObjectName(in HWND hwnd,
inout PSZ ppszObjectName);
//
// METHOD: GetObjectName ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Prompts the user to enter the name of the object.
//
// HWND hwnd - Handle to frame window.
// PSZ* ppszObjectName - Address of pointer for object name.
//
// RETURN:
//
// TRUE - The user selected an valid file.
// FALSE - The user selected cancel.
//
UINT GetTextLine(in USHORT usLine,
inout LINERECORD pLines,
in PSZ pszText);
//
// METHOD: GetTextLine ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Copies a line of text from the object to a buffer.
//
// USHORT usLine - The number of the line to get.
// LINERECORD* pLines - Pointer to the line record array.
// PSZ pszText - Buffer to store the text in.
//
// RETURN:
//
// The length of the line to display.
//
BOOL LoadObject(in PSZ pszObjectName,
in PULONG pulLength,
inout PBYTE ppBuffer,
inout LINERECORD *ppLines,
in PUSHORT pusNumberOfTextLines,
in PUSHORT pusNumberOfTextColumns);
//
// METHOD: LoadObject ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Loads a file into memory and determines the number of text line and
// maximum number of text columns.
//
// PSZ pszObjectName - Name of the file to load.
// PULONG pulLength - returns the length of the file.
// PBYTE* ppBuffer - returns a pointer to the file in memory.
// LINERECORD** pLines - returns a pointer to a line record array.
// PUSHORT pusNumberOfTextLines - returns the number of text lines.
// PUSHORT pusNumberOfTextColumns - returns the maximum number of text
// columns.
//
// RETURN:
//
// N/A
//
VOID ProductInformationView();
//
// METHOD: ProductInformationView ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Displays the product information view.
//
// RETURN:
//
// N/A
//
VOID UnloadObject(in PBYTE pBuffer,
inout LINERECORD pLines);
//
// METHOD: UnloadObject ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Unloads a file that was loaded. The buffer file and the LINERECORD array
// are freed.
//
// PBYTE ppBuffer - a pointer to the file in memory.
// LINERECORD pLines - a pointer to a line record array.
//
// RETURN:
//
// N/A
//
#ifdef __SOMIDL__
implementation {
releaseorder: BrowseOMatic,DuplicateString,ErrorHandler,FileExists,
GetHexLine,GetLinesAndColumns,GetObjectName,GetTextLine,
LoadObject,UnloadObject,ProductInformationView;
//# Class Modifiers
externalstem = Browse_O_Maticwps;
externalprefix = Browse_O_Maticwps_;
majorversion = 1;
minorversion = 2;
filestem = browse;
metaclass = M_Browse_O_Matic;
callstyle = oidl;
passthru C_ih = ""
" #define INCL_WIN"
" #define INCL_DOS"
" #define INCL_DOSERRORS"
" #define INCL_DOSMODULEMGR"
" #define INCL_WINSTDDRG"
" #define INCL_WPCLASS"
" #include <os2.h>"
""
" #include <stdio.h>"
" #include <stdlib.h>"
" #include <string.h>"
""
" #define HELP_FILE \"browse.hlp\""
""
" /* The number of bytes to display and the length of each line */"
" /* (text format) displayed for Hex display format. */"
" #define HEX_LINE_LENGTH 69"
" #define HEX_BYTES_PER_LINE (4 * sizeof( LONG))"
""
" #define MAX_LINE_LENGTH 255 /* Maximum length of a text line. */"
" /* Lines longer than this value */"
" /* only display the first */"
" /* MAX_LINE_LENGTH characters. */"
""
" /*****************************/"
" /* Text object record format */"
" /*****************************/"
" typedef struct _LINERECORD"
" {"
" PSZ pszLine; /* Pointer to beginning of each line of text */"
" UINT unLength; /* The length of each line of text */"
""
" } LINERECORD;"
" typedef LINERECORD *PLINERECORD; /* AMC 050494 */"
"";
#ifdef __PRIVATE__
passthru C_h_after = ""
" /*************************/"
" /* Main View window data */"
" /*************************/"
""
" typedef struct _BROWSEDATA"
" {"
" USHORT cb; /* Size of _BROWSEDATA struct */"
""
" Browse_O_Matic* somSelf; /* Pointer to instance */"
" USEITEM UseItem; /* Use Item structure */"
" VIEWITEM ViewItem; /* Open view structure */"
""
" BOOL bDisplay; /* Display mode (Text/Hex) */"
" PSZ pszObjectName; /* Name of object displayed */"
" PSZ pszApplKey; /* Key used to save window */"
" /* coordinates */"
""
" SHORT sCurrentLine; /* Current line displayed */"
" SHORT sPageHeight; /* Height of window in lines */"
" SHORT sTotalLines; /* Total lines of object */"
" SHORT sCurrentColumn;/* The left most column being */"
" /* displayed */"
" SHORT sPageWidth; /* Width of window in columns */"
" SHORT sTotalColumns; /* Total columns of object */"
" SHORT sCharWidth; /* Width from FONTMETRICS */"
" SHORT sCharHeight; /* Height from FONTMETRICS */"
" SHORT sCharDescender;/* Descender from FONTMETRICS */"
" SHORT sClientHeight; /* Height of client window */"
" SHORT sClientWidth; /* Width of client window */"
""
" HWND hwndVscroll; /* Verticle Scroll Bar */"
" HWND hwndHscroll; /* Horizontal Scroll Bar */"
""
" LINERECORD* pLines; /* Text line array structure */"
" PBYTE pBuffer; /* Pointer to object in memory*/"
" USHORT usNumberOfTextColumns; /* Maximum number of *"
" /* text columns in single line*/"
" USHORT usNumberOfTextLines; /* Maximum number of lines"
" /* of object displayed as text*/"
" ULONG ulFileLength; /* Length of file system object*/"
""
" } BROWSEDATA;"
""
" typedef BROWSEDATA *PBROWSEDATA;"
""
" /****************************************/"
" /* Product Information View window data */"
" /****************************************/"
" typedef struct _PRODINFODATA"
" {"
" USHORT cb; /* Size of _PRODINFODATA struct */"
""
" Browse_O_Matic* somSelf; /* Pointer to instance */"
" USEITEM UseItem; /* Use Item structure */"
" VIEWITEM ViewItem; /* Open view structure */"
""
" } PRODINFODATA;"
""
" typedef PRODINFODATA *PPRODINFODATA;"
"";
#endif /*__PRIVATE__ */
//# Method Modifiers
wpDragOver: override;
wpDrop: override;
wpMenuItemHelpSelected: override;
wpMenuItemSelected: override;
wpModifyPopupMenu: override;
wpOpen: override;
wpSetup: override;
};
#endif /* __SOMIDL__ */
};
interface M_Browse_O_Matic
{
HMODULE clsQueryModuleHandle();
//
// METHOD: clsQueryModuleHandle ( ) PRIVATE
// (X) PUBLIC
// DESCRIPTION:
//
// Gets the module handle.
//
// RETURN:
// NULLHANDLE - an error occured.
// Not NULLHANDLE - The handle for DLL containing the Browse_O_Matic
// class.
//
#ifdef __SOMIDL__
implementation {
releaseorder: clsQueryModuleHandle;
//# Class Modifiers
externalstem = Browse_O_Maticwps;
externalprefix = Browse_O_MaticM_;
functionprefix = Browse_O_MaticM_;
majorversion = 1;
minorversion = 2;
filestem = browse;
callstyle = oidl;
//# Method Modifiers
wpclsInitData: override;
wpclsQueryDefaultHelp: override;
wpclsQueryDefaultView: override;
wpclsQueryIconData: override;
wpclsQueryStyle: override;
wpclsQueryTitle: override;
};
#endif /* __SOMIDL__ */
};
#endif /* browse_idl */