I am in the process of trying to update my main application to the new FF3. The OCX support is great and by and large, I was able to readily update all but one of my OCX controls.
The problem is Farpoint Spread, which hides most of its properties and methods in something other than the default table. They are found in an interface statement --
Interface IDBind dSpreadsheet
For example, if I use the OC_GetDispatch function, it recognizes only a few methods, none of which are ones I need.
Does anybody know how to implement something other than the default dispatch in the new environment? Any help you can give me would be most appreciated.
Which version of the spreadsheet are you using?
What is an example of a methods that you don't have access to?
Hard to say without having the interface declarations. Is there a method that returns a reference to the wanted interface? We don't know. Is the wanted interface implemented in the same CoClass? We don't know. It is not possible to make suggestions without knowing the object model used by that server.
If the dSpreadsheet interface is implemented in the same CoClass than the default one, returned by OC_GetDispatch, then DIM MyObject AS dSpreadsheet and then MyObject = <name of the dispatch variable you have used in your call to GetDispatch>. This will force a call to QueryInterface, that is the standard COM way to navigate between interfaces implemented in the same CoClass.
Here is a portion of the Typelib output -- I have stripped out most of the details to make things shorter.
The functions in the IfpDataObjectFiles and IfpDataObject groups are really of no great interest, it is the functions that are in the IDBind DSpreadsheet section where all the action happens. The tool appears to be oriented towards the VB6 environment, but I was using it successfully under FF2.
' ########################################################################################
' Library name: FPSpreadADO
' Version: 7.0, Locale ID = 0
' Description: FarPoint Spread 7.0 (OLEDB)
' Path: C:\Snap\FPSPR70.ocx
' Library GUID: {F856EC8B-F03C-4515-BDC6-64CBD617566A}
' Help file: C:\Snap\spread70.chm
' Code generated by the TypeLib Browser 4.0.13 (c) 2008 by Jose Roca
' Date: 19 Nov 2009 Time: 17:16:42
' ########################################################################################
' ########################################################################################
' Interface name = IfpDataObjectFiles
' IID = {69310C25-4993-11D1-8905-0020AF131A57}
' Attributes = 4304 [&H10D0] [Hidden] [Dual] [Nonextensible] [Dispatchable]
' Inherited interface = IDispatch
' ########################################################################################
#IF NOT %DEF(%IfpDataObjectFiles_INTERFACE_DEFINED)
%IfpDataObjectFiles_INTERFACE_DEFINED = 1
INTERFACE IfpDataObjectFiles $IID_IfpDataObjectFiles
INHERIT IDispatch
' =====================================================================================
PROPERTY GET Item <0> ( _ ' VTable offset = 28
BYVAL prm_lIndex AS LONG _ ' [in] lIndex VT_I4 <Long>
) AS STRING ' [retval][out] *bstrItem VT_BSTR
' =====================================================================================
END INTERFACE
#ENDIF ' /* __IfpDataObjectFiles_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IfpDataObject
' IID = {69310C27-4993-11D1-8905-0020AF131A57}
' Attributes = 4304 [&H10D0] [Hidden] [Dual] [Nonextensible] [Dispatchable]
' Inherited interface = IDispatch
' ########################################################################################
#IF NOT %DEF(%IfpDataObject_INTERFACE_DEFINED)
%IfpDataObject_INTERFACE_DEFINED = 1
INTERFACE IfpDataObject $IID_IfpDataObject
INHERIT IDispatch
' =====================================================================================
METHOD Clear <1> ( _ ' VTable offset = 28
) ' void
' =====================================================================================
METHOD GetData <2> ( _ ' VTable offset = 32
BYVAL prm_nFormat AS INTEGER _ ' [in] nFormat VT_I2 <Integer>
) AS VARIANT ' [retval][out] *pvData VT_VARIANT <Variant>
' =====================================================================================
METHOD GetFormat <3> ( _ ' VTable offset = 36
BYVAL prm_nFormat AS INTEGER _ ' [in] nFormat VT_I2 <Integer>
) AS INTEGER ' [retval][out] *pbFormatSupported VT_BOOL <Integer>
' =====================================================================================
METHOD SetData <4> ( _ ' VTable offset = 40
OPTIONAL BYVAL prm_vValue AS VARIANT _ ' [opt][in] vValue VT_VARIANT <Variant>
, OPTIONAL BYVAL prm_vFormat AS VARIANT _ ' [opt][in] vFormat VT_VARIANT <Variant>
) ' void
' =====================================================================================
PROPERTY GET Files <5> ( _ ' VTable offset = 44
) AS IfpDataObjectFiles ' [retval][out] **ppFiles IfpDataObjectFiles <dispinterface>
' =====================================================================================
END INTERFACE
#ENDIF ' /* __IfpDataObject_INTERFACE_DEFINED__ */
' ########################################################################################
' CoClass name = fpSpread
' Interface name = _DSpreadSheet
' IID = {71146832-020D-4D16-80FD-6ACE384B66DF}
' Dispatch interface for FarPoint Spreadsheet ADO Control 7.0 (OLEDB)
' Attributes = 4096 [&H1000] [Dispatchable]
' Inherited interface = IDispatch
' ########################################################################################
#IF NOT %DEF(%DSpreadSheet_DISPINTERFACE_DEFINED)
%DSpreadSheet_DISPINTERFACE_DEFINED = 1
INTERFACE IDBIND DSpreadSheet
MEMBER GET ColWidth <217> (prm_lCol AS LONG<0>) AS DOUBLE
MEMBER LET ColWidth <217> (prm_lCol AS LONG<0>) ' Parameter Type AS DOUBLE
MEMBER GET MaxTextColWidth <218> (prm_lCol AS LONG<0>) AS DOUBLE
MEMBER LET MaxTextColWidth <218> (prm_lCol AS LONG<0>) ' Parameter Type AS DOUBLE
MEMBER GET MaxTextRowHeight <219> (prm_lRow AS LONG<0>) AS DOUBLE
MEMBER LET MaxTextRowHeight <219> (prm_lRow AS LONG<0>) ' Parameter Type AS DOUBLE
MEMBER GET RowHeight <220> (prm_lRow AS LONG<0>) AS DOUBLE
MEMBER LET RowHeight <220> (prm_lRow AS LONG<0>) ' Parameter Type AS DOUBLE
*** MANY MORE FUNCTIONS HERE
END INTERFACE
Quote
[...]but I was using it successfully under FF2.
Then do the same you did with FF2. Use as the ProgID something like "FPSpreadADO.fpSpread" (don't know the exact ProgID, that doesn't appear in the fragment of the declarations that you havwe posted). DIM something as DISPATCH, e.g. oFP AS DISPATCH, get the dispatch interface using oFP = OC_GetDispatch, and then OBJECT [CALL or GET or LET] Method or Property Name, etc.
If you don't post any code, we can't know what you're doing.
Thanks Jose, the change was actually pretty simple. What I was doing was probably not good originally, and using the OC_GetDispatch() function does the trick.
I was using calls like Object Call DISPATCH_FRMGEOGRAPHYBROWSER_WORKSHEET.SetText(k,i,vVar) which worked, but it is much cleaner in the code to set wks=OC_GetDispatch(HWND_FRMGEOGRAPHYBROWSER_WORKSHEET, then use Object Call wks.settext(k,i,vVar) instead.
Appreciate the help, project is back up and running.