OleCreateInstance Hangs (OpenInsight 32-Bit)
At 03 MAR 2011 04:18:56PM Martin Drenovac wrote:
I take a form, place the OLE control on it. Set the property to sbVisiloadAutoload.AutoLoad for its text. It works perfectly as i can see the properties of the control on the Ole Control Properties.
Then in code what i want to do is to instantiate this via OleCreateInstance, so that i can use the OLE commands. Here's the code.
DECLARE FUNCTION get_property
DECLARE SUBROUTINE OlePutProperty
DEBUG
OLE_control$=OleCreateInstance('sbVisiloadAutoload.AutoLoad')
status=OleStatus()
if status then
CALL msg(@window,'OLE Error code: ':status)returnend
I run the above code from a button off the same form as where i have the OLE control, and it hangs.
so, what have i done wrong that this is hanging? The OLE_control is not EQU to anything.
At 11 MAR 2011 08:56AM Karl Pozmann wrote:
Hi Martin;
You shouldn't have to run olecreateinstance as the Window is already doing that. You should also be able to manage the OLEs events from the event-handler of the control.
I've had better luck sometimes doing the olecreateinstance from a stored procedure (for example Word) and managing it from there.
HTH
Karl
At 11 MAR 2011 10:26AM Sean FitzSimons wrote:
Martin,
Karl is correct. When placing an OLE control in the form, the form will instatiate the OLE instance. The OleCreateInstance() function should be used when instantiating the instance programmatically.
Sean