OLE server features
- Support for DCOM is provided by the ConnectToRemoteObject and ConnectToNewRemoteObject functions. The new functions let you pass the name of a remote host where a COM server resides when you connect to an OLE object.
- You can implement events for an OLEObject by creating a user object that is a descendant of OLEObject. SetAutomationPointer assigns an OLE automation pointer into the descendant so that it can use OLE automation.
- SetAutomationTimeout lets you set the timeout period for OLE procedure calls from a PowerBuilder client to a server. The default timeout period is five minutes.
- OLE automation performance has been improved.
- Enumerated types for any OLE automation server display in the PowerBuilder Browser.
OLE control container features
- An OLE control can determine its location and modify it at execution time using its extended control properties.
In PowerBuilder 6.0, the properties you can set are X (alias Left), Y (alias Top), Width, and Height. These properties are real (R4) values, truncated to long integers when set. They are measured in PBUs and are accessible using C++ and the OLE IOleControlSite interface.
- PowerBuilder implements the IOleContainer class at the window level to enable OLE controls to find out about their siblings.
You can use the OLE EnumObjects() method to access the OLE enumerator.
- PowerBuilder OLE control containers perform their own message reflection for a specific set of messages.
This feature eliminates the execution-time overhead that would be required if the OLE control had to create a reflector window to handle these messages.
OLE error handling
An OLE control can provide its own stock Error event that is executed when the OLE control calls the MFC FireError method. You can use this event to separate error-handling code for errors triggered when FireError is called from error-handling code for other OLE exceptions. If no stock Error event has been defined, the FireError method triggers PowerBuilder's ExternalException event.
A stock Error event is an entry in the control's IDL or ODL file created by the MFC Class Wizard. Internally, PowerBuilder translates the stock Error event into an OCX_error event to avoid name conflicts with PowerBuilder's Error event.
The OCX_Error event has the following signature:
void OCX_Error( short Number, REF string Description, long Scode, string Source, & string Helpfile, long HelpContext, REF boolean CancelDisplay )
You can set CancelDisplay to TRUE to cancel the display of any MFC error message. Alternatively, you can supply a different description. For example:
OLE_1::OCX_Error(...) sle_desc.text = description sle_source.text = source sle_helpfile.text = helpfile sle_excep.text = "scode " + string(scode) sle_result.text = "number " + string(number) sle_helpid.text = "HelpID " + string(helpcontext)
canceldisplay = FALSE description = "This is my new error description"
- See also PowerBuilder window ActiveX and Invoking the OLE GenReg utility from the development environment
|