Description
Creates an instance of an OLE object
Syntax
object = OLECREATEINSTANCE(classname)
Parameters
The function has the following parameters:
| Parameter | Description |
|---|---|
| classname | The OLE classname. |
Returns
An OLE object of the Classname class.
Remarks
The OleCreateInstance function is used to create instances of an OLE Object for use in Basic+ scripts.
See also
OleGetProperty function, OlePutProperty subroutine, OleCallMethod function, OleStatus 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