hometoolsscriptstipslinksproductsservicesprojects
 
     
nav_panel.gif
Home
Clipboard
RAS

Untitled Document

Best
developer's tool
Content Builder

 

OLE Explorer

ActiveX Explorer OCX

 

Presented Explorer OCX is an alternative method of operation with ActiveX objects in Toolbook. Conventional method is to use openscript CreateAutoObject() function or use OCX controls registered as Toolbook extensions. Though openscript supports objects' properties, methods and events, it doesn't support all possible data types used in ActiveX. This was one of the main reasons of developing ActiveX Explorer OCX or Xplorer OCX as an alternative method of handling ActiveX objects in Toolbook.

Main features of OCX are:

  • Visual Basic program syntax
  • Built in VB compiler
  • Support of all VB data types
  • Simplified creation and destroying of objects

OCX doesn't support

  • object events
OCX Control
Xplorer OCX (Xplorer.ocx file) written in Microsoft Visual Basic 6.0 includes simple BASIC compiler, program and data memory, and virtual machine for execution of compiled programs. Compiled programs can be stored in the different program areas using the same variables space. Use CurrentProg property to navigate between available programs. All variables used in programs are stored in a special area and are created automatically with full access to their values via special OCX properties. OCX accesses object's properties and methods using VB CallByName() function.
OCX Basic compiler

Below is the example of BASIC program for reading information from MS Word file.

$Appl=CreateObject('Word.Application')
$Doc=$Appl.Documents.Open('test.doc')
$Range=$Doc.Paragraphs.Item(1).Range
$Text=$Range.Text
$Appl.Quit
$Doc=Nothing
$Appl=Nothing

Xplorer OCX uses programming language similar to VB. Because it was originally developed for operations with ActiveX objects and not for calculations it supports only the very basic arithmetic and string operations.

Numbers. Compiler recognizes only integer numbers constants and basic arithmetic operators: +, -, *, /. For storing VB Single and Double numbers you should use variables. Current version doesn't operators precedence so to specify their order you should use parenthesis.

Strings. As string coinstant delimiters OCX instead of quotes uses apostrophes, that helps to write BASIC programs in OpenScript. Compiler recognizes string constants and operation of concatenation between strings (&).

Variables. The indication of variable is a dollar sign at the beginning of variable identifier. OCX creates variable of a Variant type automatically at first encounter, so there is no need to specify it type explicitly. In the presented above example of program $Appl, $Doc, $Range, $Text are variables. To view variable values and types use VariableType(), VariableValue() and VariableValueAsText() OCX methods.

Functions. The only function supported in OCX is VB CreateObject() which is the analogue of openscript CreateAutoObject(). If there is an interest in other built in functions I can add them on request.

OCX Properties and Methods
Return type

read/
write

Name
Result
Properties
STRING
R
Version returns OCX version (for example Xplorer OCX 1.0 Demo)
INTEGER
R
Status returns OCX status (0 - Ok, 1 - compilation error, 2 - execution error)
INTEGER
R
VariableCount returns number of OCX variables. To get list of variables use VariableList property
STRING
R
VariableList returns the list of all OCX variables with their values in a text form
INTEGER
R
ProgCount returns the maximal number of program available (OCX programs are numerated from 0)
INTEGER
R/W
CurrentProg sets/gets current program number
STRING
R
ProgName returns current program name
BOOLEAN
R
Compiled returns Compiled status of current program (returns TRUE if program was successfully compiled and can be executed)
STRING
R
SourceCode returns source BASIC code of current program
STRING
R
P_Code return textual representation of compiled binary P_Code of current program
STRING
R/W
LastError sets/gets last error string
Methods
 
-
Initialize(<name>,<id>) initializes OCX using strings <name> and <id>. Without initialization the OCX operates in Demo mode.
 
-
ResetVariables() clears all OCX variables
BOOLEAN
-
Execute() executes current program, returns FALSE if error. To get error description uses LastError property.
BOOLEAN
-
Compile(<code>,<name>) compiles current program with BASIC source code <code> and name <name>, returns FALSE if error. To get error description uses LastError property.
STRING
-
VariableType(<var>) returns OCX variable <var> type
VARIANT
-
VariableValue(<var>) returns OCX variable <var> value as Variant
STRING
-
VariableValueAsText(<var>) returns OCX variable <var> value in Text form

Using OCX with Toolbook

I wrote a simple Xplorer.tbk (TB8) as a sample of using Xplorer OCX. Before running it you should register Xplorer.ocx on your computer. to To get information about the element of book interface place cursor over it.

Xplorer book

Xplorer.tbk contains several pre compiled programs for reading/writing MS Word/Excel/Power Pointfiles. Choose one of them using Prog # spinner. Click Execute to execute compiled program, in Variables window you will see all used variables and their values. Click variable to view its name. type and value. Reset Vars button is used for variables memory initializations and correspondingly destroys current variables, destroying all objects if any exist

To create new program find unused program memory (or click New to clear current one), enter program name (optionally) and program source code, push Compile. Encountering syntax errors compiler displays them in P-code and LastError windows. If compilation was successful the Compiled property of the program is set to true and button Execute is activated.

Data types. As it was mentioned before OCX control supports all available in VB types of data including arrays. The indication of the variable containing array is "()" followed by the list of lower and upper array bounds (see, for example, the variable type field on the screen above).

Pre compiled examples

Prog #
Description
0
Illustrates basic arithmetic and string operations with constants and variables.
1
Writes text "Hello" to MS Word text.doc file.
2
Reads text from text.doc file into $Text variable.
3
Creates sample test.xls MS Excel file.
4
Reads sample test.xls file.
5
Reads information about Vertices and Nodes of a shape object from MS Power Point file test.ppt.

Xplorer ZIP archive includes all sample office files.

Support

Feel free to report about all bugs and encountered problems in using this OCX at support@esdmm.com

Download For personal use only, not for redistribution.

Xplorer.zip (52 kB) with Xplorer.ocx, Xplorer.tbk and sample office files.

Program number control Program name Source Basic code of the program Compiled P-code OCX Info panel Information about last error OCX variables Variable name Variable type Shows variable value as text Variable value Creates new program Edits current program Compiles program Executes program Updates OCX info panel Destroys all OCX variables

     
   

HomeToolsScriptsTipsLinksProductsServicesProjects

This page was created by ESD Multimedia
Copyright © 2003 ESD Multimedia

Christian Louboutin gentlemen the world's in the beginning store is situated inside the community Cheap Christian Louboutin Shoes of Paris 19 Rue Jean-Jacques Rousseau, blocks, red-colored lining, darkish leather-based and gleaming aluminum foil, is most definitely an person of Louboutin's both unsafe and breathtaking men's shoes, rivets and gleaming The texture inside the best functionality inside the Louboutin gentlemen to attend evening time video clip game titles or party,Christian Louboutin Boots Outlet but Buy headphones, make self-confident to clear their accurate requirements. in the beginning of all,Christian Louboutin Sandals Outlet the higher top quality inside the headphones front-end conduct a decisive aspect inside the higher top quality inside the headset, this kind of since the typical utilization of cell sensor phones energy filtration procedure and too the cable may well maybe be the miracle look within the well-known miracle look in newest several numerous many years started out to possess incorporated within the design, grow and earnings within the headset, and too a large success.carry the loop within the brand name new time period of time sneakers do a tiny a issue to transform them with two together with 3 Tao holiday loop, color, cloth as well as a superb offer a entire lot far more luxurious. Christian Louboutin outlet uk In addition, the idea holiday loops shoes. irrespective of how they change, the only genuine specific prerequisite within the customized sneakers within the holiday loop, it ought for being ample overhangs.