From Support Wiki
Converting data in OLE2 format to ActiveX format
11 May, 2001
Description:
Converting objects from OLE2 to ActiveX does not work.
QuickOLE functions SWinSetObjectBits and SwinGetObjectBits are not supported in CTD 2.0, and data stored in OLE2 format cannot be loaded into ActiveX containers.
Solution:
CTD 1.5.01 PTF6 contains changes to allow conversion of OLE2 data to ActiveX format. These changes consist of a change to function SwinSetObjectBits and the addition of function SalActiveXPaste.
SwinSetObjectBits is modified so that when it loads the contents of a string that was previously created using SwinGetObjectBits into a QuickOLE2 container, it also loads the contents of this string into the clipboard. Function SalActiveXPaste loads the contents of the clipboard into an ActiveX container.
The process of converting OLE2 data to ActiveX format must be carried out under CTD 1.5.01 PTF6 and is as follows:
1. The application in which the conversion is to be carried out must have both a QuickOLE20 class container and an ActiveX container.
2. Read data stored in files in OLE2 format using Sal File functions into a string.
3. Use QuickOLE function SWinSetObjectBits to load the data from the string into the OLE2 container. This also copies the data into the Windows clipboard.
4. Call function SalActiveXPaste to paste the contents of the clipboard into an ActiveX container. This function is described below and must be used in combination with the SwinSetObjectBits function call.
5. Call function SalActiveXGetData to copy the contents of the ActiveX container to a string. This string may then be saved to a file using Sal File functions.
SalActiveXPaste function description
BOk = SalActiveXPaste(hwndCntrCtrl)
Pastes the contents of the Windows clipboard into an ActiveX container.
Parameters
HwndCntrlCtrl Window Handle. The ActiveX container control
Return value
BOk is TRUE if the function succeeds and FALSE if it fails
Example
Long String: lstrObject
CQuickOle20: pic1
ActiveX: ax1
Call SWinSetObjectBits(pic1, lstrObjet) ! loads data into OLE2 container and Windows clipboard
bOk = SalActiveXPaste(ax1) ! copies data from Windows clipboard into ActiveX container
Notes:
SalActiveXPaste () must be used in combination with SwinSetObjectBits ()
SalActiveXPaste () is present in CTD 1.5.01 PTF6 only
Sample application OLE2_ActiveX_conversion.apt illustrates this process. (NOTE: This application is included, in a zip file, with the development download of PTF 6 for CTD 1.5.1)
Paul Karsh
Sr. software QA engineer
Centura Software Corp.