Description

Returns the value of the specified property of an OLE object.

Syntax

olePropery = OleGetProperty (object,PropertyName)

Parameters

The function has the following parameters:

ParameterDescription
objectThe OLE object from which to request the property.
PropertyNameThe name of the property

Returns

The value of the property requested from PropertyName.

Remarks

The OleCreateInstance function is used to create instances of an OLE Object for use in Basic+ scripts and must be issued prior to calling the OleGetProperty.

See also

OleCreateInstance functionOlePutProperty subroutineOleCallMethod functionOleStatus function

Example

subroutine Test_OLE_Basic_PDF(void)
declare subroutine OlePutProperty, Msg
declare function OleCreateInstance, OleGetProperty, OleCallMethod, OleStatus
 
// Create the Ole Object for VSPrinter
 
oleObj = OleCreateInstance('VSPRINTER7.VSPRINTER.1')
status = OleStatus()
if status then
   msg(@window,'OLE Error code: ':status)
   return
end
 
// Get the AbortCaption property of the VSPrinter Print window
 
property1 = OleGetProperty(oleObj, 'AbortCaption')
status = OleStatus()
if status then
   msg(@window,'OLE Error code: ':status)
end
 
// Change the AbortCaption property of the VSPrinter Print window
 
OlePutProperty(oleObj, 'AbortCaption', 'Testing...')
status = OleStatus()
if status then
   msg(@window,'OLE Error code: ':status)
end
 
// Get the AbortCaption property of the VSPrinter Print window after it has been changed
 
property2 = OleGetProperty(oleObj, 'AbortCaption')
status = OleStatus()
if status then
   msg(@window,'OLE Error code: ':status)
end
 
// Calls the STARTDOC method of the ole object to begin printing the document.
 
ReturnValue = OleCallMethod(oleObj, "STARTDOC")
status = OleStatus()
if status then
  msg(@window,'OLE Error code: ':status)
end
 
// Create the text to print
 
text  = "OpenInsight is the only database development and application environment that provides both Windows, "
text: = "Linux and Java-based GUI tools to develop and deploy web-based and client server applications that "
text: = "support native XML, SQL, Lotus Notes. There are 1.6 mm licenses of Revelation products across 80k "
text: = "deployed sites worldwide."
 
// Print the text
 
OlePutProperty(oleObj,"TEXT",text)
status = OleStatus()
if status then
   msg(@window,'OLE Error code: ':status)
end
 
// End the print job
 
ReturnValue = OleCallMethod(oleObj, "ENDDOC")
status = OleStatus()
if OleStatus() then
   msg(@window,'OLE Error code: ':status)
end
 
// Save the text to a temp file for use in the VSPDF OLE object
 
returnValue = OleCallMethod(oleObj,"SAVEDOC","pdftemp.txt")
status = OleStatus()
if OleStatus() then
   msg(@window,'OLE Error code: ':status)
end
 
// Start the VSPDF OLE object to create the pdf file
 
oleObj2 = OleCreateInstance('VSPDF.VSPDF.1')
status = OleStatus()
if OleStatus() then
   msg(@window,'OLE Error code: ':status)
   return
end
 
// Create the PDF file
 
returnvalue = OleCallMethod(oleObj2,"convertfile","pdftemp.txt","C:\temp\new_ole_func.pdf")
status = OleStatus()
if OleStatus() then
   msg(@window,'OLE Error code: ':status)
end
return
  • No labels