• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Unfortunately, More TypeLib Problems!

Started by Frederick J. Harris, December 13, 2011, 09:22:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frederick J. Harris

More TypeLib Troubles Jose

Jose, would you take a look at your TypeLib Browser output for the IMSFlexGrid Interface for the MSFlexGrid?  There are 180 member functions in that large Dual interface.  However, towards the bottom, specifically zero based members 141 and 142 have something really strange going on.  The dispids are 61 and 62 and the names are Property Set RowPosition and Property Set ColPosition.  Here they are with a few additional after them for comparison...


Jose's TypeLib Browser

'=====================================================================================
PROPERTY SET RowPosition <61> ( _                    ' VTable offset = 592
  BYVAL LONG _                                       ' [in] index VT_I4 <Long>
, BYVAL LONG _                                       ' [in] VT_I4 <Long>
)                                                    ' void
'=====================================================================================
PROPERTY SET ColPosition <62> ( _                    ' VTable offset = 596
  BYVAL LONG _                                       ' [in] index VT_I4 <Long>
, BYVAL LONG _                                       ' [in] VT_I4 <Long>
)                                                    ' void
'=====================================================================================
PROPERTY GET RowData <63> ( _                        ' VTable offset = 600
  BYVAL LONG _                                       ' [in] index VT_I4 <Long>
) AS LONG                                            ' [retval][out] *RowData VT_I4 <Long>
'=====================================================================================
PROPERTY SET RowData <63> ( _                        ' VTable offset = 604
  BYVAL LONG _                                       ' [in] index VT_I4 <Long>
, BYVAL LONG _                                       ' [in] RowData VT_I4 <Long>
)                                                    ' void
'=====================================================================================
PROPERTY GET ColData <64> ( _                        ' VTable offset = 608
  BYVAL LONG _                                       ' [in] index VT_I4 <Long>
) AS LONG                                            ' [retval][out] *ColData VT_I4 <Long>
'=====================================================================================
PROPERTY SET ColData <64> ( _                        ' VTable offset = 612
  BYVAL LONG _                                       ' [in] index VT_I4 <Long>
, BYVAL LONG _                                       ' [in] ColData VT_I4 <Long>
)                                                    ' void
'=====================================================================================
PROPERTY GET TextMatrix <65> ( _                     ' VTable offset = 616
  BYVAL LONG _                                       ' [in] Row VT_I4 <Long>
, BYVAL LONG _                                       ' [in] Col VT_I4 <Long>
) AS WSTRING                                         ' [retval][out] *TextMatrix VT_BSTR
'=====================================================================================
PROPERTY SET TextMatrix <65> ( _                     ' VTable offset = 620
  BYVAL LONG _                                       ' [in] Row VT_I4 <Long>
, BYVAL LONG _                                       ' [in] Col VT_I4 <Long>
, BYVAL WSTRING _                                    ' [in] TextMatrix VT_BSTR
)                                                    ' void
'=====================================================================================


I've checked closely through all 180 members of that interface in your TypeLib Browser and not one of the remaining 178 interfaces are missing the parameter name as with the last parameter of those calls.  If you look close you'll see your type lib browser obtained the type, i.e., <long>, but not the parameter name.  Here is an abbreviated version of what the IDL from OLEVIEW provides for those members...


[propput] HRESULT RowPosition([in] long index, [in] long rhs);
[propput] HRESULT ColPosition([in] long index, [in] long rhs);


I'm not finding fault at all with your TypeLib Browser in pointing this out because I'm having exactly the same problem!

I've been successful in writing code to output C++ headers for the ADO Library (thanks in large part to the help you've given me so far) , and after accomplishing that I decided to turn to the MSFlexGrid.  That's where I discovered this problem with those two members.  Here is the whole IMSFlexGrid interface output from my program.  Please Scroll to the bottom where I put spaces between those two members to help pick them out....


interface IMSFlexGrid : IDispatch
{
virtual HRESULT __stdcall GetRows(LONG* Rows)=0;
virtual HRESULT __stdcall SetRows(LONG Rows)=0;
virtual HRESULT __stdcall GetCols(LONG* Cols)=0;
virtual HRESULT __stdcall SetCols(LONG Cols)=0;
virtual HRESULT __stdcall GetFixedRows(LONG* FixedRows)=0;
virtual HRESULT __stdcall SetFixedRows(LONG FixedRows)=0;
virtual HRESULT __stdcall GetFixedCols(LONG* FixedCols)=0;
virtual HRESULT __stdcall SetFixedCols(LONG FixedCols)=0;
virtual HRESULT __stdcall GetVersion(signed short* Version)=0;
virtual HRESULT __stdcall GetFormatString(BSTR* FormatString)=0;
virtual HRESULT __stdcall SetFormatString(BSTR FormatString)=0;
virtual HRESULT __stdcall GetTopRow(LONG* TopRow)=0;
virtual HRESULT __stdcall SetTopRow(LONG TopRow)=0;
virtual HRESULT __stdcall GetLeftCol(LONG* LeftCol)=0;
virtual HRESULT __stdcall SetLeftCol(LONG LeftCol)=0;
virtual HRESULT __stdcall GetRow(LONG* Row)=0;
virtual HRESULT __stdcall SetRow(LONG Row)=0;
virtual HRESULT __stdcall GetCol(LONG* Col)=0;
virtual HRESULT __stdcall SetCol(LONG Col)=0;
virtual HRESULT __stdcall GetRowSel(LONG* RowSel)=0;
virtual HRESULT __stdcall SetRowSel(LONG RowSel)=0;
virtual HRESULT __stdcall GetColSel(LONG* ColSel)=0;
virtual HRESULT __stdcall SetColSel(LONG ColSel)=0;
virtual HRESULT __stdcall GetText(BSTR* Text)=0;
virtual HRESULT __stdcall SetText(BSTR Text)=0;
virtual HRESULT __stdcall GetBackColor(OLE_COLOR* BackColor)=0;
virtual HRESULT __stdcall SetBackColor(OLE_COLOR BackColor)=0;
virtual HRESULT __stdcall GetForeColor(OLE_COLOR* ForeColor)=0;
virtual HRESULT __stdcall SetForeColor(OLE_COLOR ForeColor)=0;
virtual HRESULT __stdcall GetBackColorFixed(OLE_COLOR* BackColorFixed)=0;
virtual HRESULT __stdcall SetBackColorFixed(OLE_COLOR BackColorFixed)=0;
virtual HRESULT __stdcall GetForeColorFixed(OLE_COLOR* ForeColorFixed)=0;
virtual HRESULT __stdcall SetForeColorFixed(OLE_COLOR ForeColorFixed)=0;
virtual HRESULT __stdcall GetBackColorSel(OLE_COLOR* BackColorSel)=0;
virtual HRESULT __stdcall SetBackColorSel(OLE_COLOR BackColorSel)=0;
virtual HRESULT __stdcall GetForeColorSel(OLE_COLOR* ForeColorSel)=0;
virtual HRESULT __stdcall SetForeColorSel(OLE_COLOR ForeColorSel)=0;
virtual HRESULT __stdcall GetBackColorBkg(OLE_COLOR* BackColorBkg)=0;
virtual HRESULT __stdcall SetBackColorBkg(OLE_COLOR BackColorBkg)=0;
virtual HRESULT __stdcall GetWordWrap(VARIANT_BOOL* WordWrap)=0;
virtual HRESULT __stdcall SetWordWrap(VARIANT_BOOL WordWrap)=0;
virtual HRESULT __stdcall GetFont(IFontDisp** Font)=0;
virtual HRESULT __stdcall PutRefFont(IFontDisp* Font)=0;
virtual HRESULT __stdcall GetFontWidth(float* FontWidth)=0;
virtual HRESULT __stdcall SetFontWidth(float FontWidth)=0;
virtual HRESULT __stdcall GetCellFontName(BSTR* CellFontName)=0;
virtual HRESULT __stdcall SetCellFontName(BSTR CellFontName)=0;
virtual HRESULT __stdcall GetCellFontSize(float* CellFontSize)=0;
virtual HRESULT __stdcall SetCellFontSize(float CellFontSize)=0;
virtual HRESULT __stdcall GetCellFontBold(VARIANT_BOOL* CellFontBold)=0;
virtual HRESULT __stdcall SetCellFontBold(VARIANT_BOOL CellFontBold)=0;
virtual HRESULT __stdcall GetCellFontItalic(VARIANT_BOOL* CellFontItalic)=0;
virtual HRESULT __stdcall SetCellFontItalic(VARIANT_BOOL CellFontItalic)=0;
virtual HRESULT __stdcall GetCellFontUnderline(VARIANT_BOOL* CellFontUnderline)=0;
virtual HRESULT __stdcall SetCellFontUnderline(VARIANT_BOOL CellFontUnderline)=0;
virtual HRESULT __stdcall GetCellFontStrikeThrough(VARIANT_BOOL* CellFontStrikeThrough)=0;
virtual HRESULT __stdcall SetCellFontStrikeThrough(VARIANT_BOOL CellFontStrikeThrough)=0;
virtual HRESULT __stdcall GetCellFontWidth(float* CellFontWidth)=0;
virtual HRESULT __stdcall SetCellFontWidth(float CellFontWidth)=0;
virtual HRESULT __stdcall GetTextStyle(TextStyleSettings* TextStyle)=0;
virtual HRESULT __stdcall SetTextStyle(TextStyleSettings TextStyle)=0;
virtual HRESULT __stdcall GetTextStyleFixed(TextStyleSettings* TextStyleFixed)=0;
virtual HRESULT __stdcall SetTextStyleFixed(TextStyleSettings TextStyleFixed)=0;
virtual HRESULT __stdcall GetScrollTrack(VARIANT_BOOL* ScrollTrack)=0;
virtual HRESULT __stdcall SetScrollTrack(VARIANT_BOOL ScrollTrack)=0;
virtual HRESULT __stdcall GetFocusRect(FocusRectSettings* FocusRect)=0;
virtual HRESULT __stdcall SetFocusRect(FocusRectSettings FocusRect)=0;
virtual HRESULT __stdcall GetHighLight(HighLightSettings* HighLight)=0;
virtual HRESULT __stdcall SetHighLight(HighLightSettings HighLight)=0;
virtual HRESULT __stdcall GetRedraw(VARIANT_BOOL* Redraw)=0;
virtual HRESULT __stdcall SetRedraw(VARIANT_BOOL Redraw)=0;
virtual HRESULT __stdcall GetScrollBars(ScrollBarsSettings* ScrollBars)=0;
virtual HRESULT __stdcall SetScrollBars(ScrollBarsSettings ScrollBars)=0;
virtual HRESULT __stdcall GetMouseRow(LONG* MouseRow)=0;
virtual HRESULT __stdcall GetMouseCol(LONG* MouseCol)=0;
virtual HRESULT __stdcall GetCellLeft(LONG* CellLeft)=0;
virtual HRESULT __stdcall GetCellTop(LONG* CellTop)=0;
virtual HRESULT __stdcall GetCellWidth(LONG* CellWidth)=0;
virtual HRESULT __stdcall GetCellHeight(LONG* CellHeight)=0;
virtual HRESULT __stdcall GetRowHeightMin(LONG* RowHeightMin)=0;
virtual HRESULT __stdcall SetRowHeightMin(LONG RowHeightMin)=0;
virtual HRESULT __stdcall GetFillStyle(FillStyleSettings* FillStyle)=0;
virtual HRESULT __stdcall SetFillStyle(FillStyleSettings FillStyle)=0;
virtual HRESULT __stdcall GetGridLines(GridLineSettings* GridLines)=0;
virtual HRESULT __stdcall SetGridLines(GridLineSettings GridLines)=0;
virtual HRESULT __stdcall GetGridLinesFixed(GridLineSettings* GridLinesFixed)=0;
virtual HRESULT __stdcall SetGridLinesFixed(GridLineSettings GridLinesFixed)=0;
virtual HRESULT __stdcall GetGridColor(OLE_COLOR* GridColor)=0;
virtual HRESULT __stdcall SetGridColor(OLE_COLOR GridColor)=0;
virtual HRESULT __stdcall GetGridColorFixed(OLE_COLOR* GridColorFixed)=0;
virtual HRESULT __stdcall SetGridColorFixed(OLE_COLOR GridColorFixed)=0;
virtual HRESULT __stdcall GetCellBackColor(OLE_COLOR* CellBackColor)=0;
virtual HRESULT __stdcall SetCellBackColor(OLE_COLOR CellBackColor)=0;
virtual HRESULT __stdcall GetCellForeColor(OLE_COLOR* CellForeColor)=0;
virtual HRESULT __stdcall SetCellForeColor(OLE_COLOR CellForeColor)=0;
virtual HRESULT __stdcall GetCellAlignment(signed short* CellAlignment)=0;
virtual HRESULT __stdcall SetCellAlignment(signed short CellAlignment)=0;
virtual HRESULT __stdcall GetCellTextStyle(TextStyleSettings* CellTextStyle)=0;
virtual HRESULT __stdcall SetCellTextStyle(TextStyleSettings CellTextStyle)=0;
virtual HRESULT __stdcall GetCellPictureAlignment(signed short* CellPictureAlignment)=0;
virtual HRESULT __stdcall SetCellPictureAlignment(signed short CellPictureAlignment)=0;
virtual HRESULT __stdcall GetClip(BSTR* Clip)=0;
virtual HRESULT __stdcall SetClip(BSTR Clip)=0;
virtual HRESULT __stdcall SetSort()=0;
virtual HRESULT __stdcall GetSelectionMode(SelectionModeSettings* SelectionMode)=0;
virtual HRESULT __stdcall SetSelectionMode(SelectionModeSettings SelectionMode)=0;
virtual HRESULT __stdcall GetMergeCells(MergeCellsSettings* MergeCells)=0;
virtual HRESULT __stdcall SetMergeCells(MergeCellsSettings MergeCells)=0;
virtual HRESULT __stdcall GetAllowBigSelection(VARIANT_BOOL* AllowBigSelection)=0;
virtual HRESULT __stdcall SetAllowBigSelection(VARIANT_BOOL AllowBigSelection)=0;
virtual HRESULT __stdcall GetAllowUserResizing(AllowUserResizeSettings* AllowUserResizing)=0;
virtual HRESULT __stdcall SetAllowUserResizing(AllowUserResizeSettings AllowUserResizing)=0;
virtual HRESULT __stdcall GetBorderStyle(BorderStyleSettings* BorderStyle)=0;
virtual HRESULT __stdcall SetBorderStyle(BorderStyleSettings BorderStyle)=0;
virtual HRESULT __stdcall GethWnd(LONG* hWnd)=0;
virtual HRESULT __stdcall GetEnabled(VARIANT_BOOL* Enabled)=0;
virtual HRESULT __stdcall SetEnabled(VARIANT_BOOL Enabled)=0;
virtual HRESULT __stdcall GetAppearance(AppearanceSettings* Appearance)=0;
virtual HRESULT __stdcall SetAppearance(AppearanceSettings Appearance)=0;
virtual HRESULT __stdcall GetMousePointer(MousePointerSettings* MousePointer)=0;
virtual HRESULT __stdcall SetMousePointer(MousePointerSettings MousePointer)=0;
virtual HRESULT __stdcall GetMouseIcon(IPictureDisp** MouseIcon)=0;
virtual HRESULT __stdcall PutRefMouseIcon(IPictureDisp* MouseIcon)=0;
virtual HRESULT __stdcall GetPictureType(PictureTypeSettings* PictureType)=0;
virtual HRESULT __stdcall SetPictureType(PictureTypeSettings PictureType)=0;
virtual HRESULT __stdcall GetPicture(IPictureDisp** Picture)=0;
virtual HRESULT __stdcall GetCellPicture(IPictureDisp** CellPicture)=0;
virtual HRESULT __stdcall PutRefCellPicture(IPictureDisp* CellPicture)=0;
virtual void    __stdcall AboutBox(void)=0;
virtual HRESULT __stdcall GetTextArray(LONG index, BSTR* TextArray)=0;
virtual HRESULT __stdcall SetTextArray(LONG index, BSTR TextArray)=0;
virtual HRESULT __stdcall GetColAlignment(LONG index, signed short* ColAlignment)=0;
virtual HRESULT __stdcall SetColAlignment(LONG index, signed short ColAlignment)=0;
virtual HRESULT __stdcall GetColWidth(LONG index, LONG* ColWidth)=0;
virtual HRESULT __stdcall SetColWidth(LONG index, LONG ColWidth)=0;
virtual HRESULT __stdcall GetRowHeight(LONG index, LONG* RowHeight)=0;
virtual HRESULT __stdcall SetRowHeight(LONG index, LONG RowHeight)=0;
virtual HRESULT __stdcall GetMergeRow(LONG index, VARIANT_BOOL* MergeRow)=0;
virtual HRESULT __stdcall SetMergeRow(LONG index, VARIANT_BOOL MergeRow)=0;
virtual HRESULT __stdcall GetMergeCol(LONG index, VARIANT_BOOL* MergeCol)=0;
virtual HRESULT __stdcall SetMergeCol(LONG index, VARIANT_BOOL MergeCol)=0;


virtual HRESULT __stdcall SetRowPosition(LONG index, )=0;                         //  <<< PROBLEM
virtual HRESULT __stdcall SetColPosition(LONG index, )=0;                         //  <<< PROBLEM


virtual HRESULT __stdcall GetRowData(LONG index, LONG* RowData)=0;
virtual HRESULT __stdcall SetRowData(LONG index, LONG RowData)=0;
virtual HRESULT __stdcall GetColData(LONG index, LONG* ColData)=0;
virtual HRESULT __stdcall SetColData(LONG index, LONG ColData)=0;
virtual HRESULT __stdcall GetTextMatrix(LONG Row, LONG Col, BSTR* TextMatrix)=0;
virtual HRESULT __stdcall SetTextMatrix(LONG Row, LONG Col, BSTR TextMatrix)=0;
virtual HRESULT __stdcall AddItem(BSTR Item, VARIANT index)=0;
virtual HRESULT __stdcall RemoveItem(LONG index)=0;
virtual void    __stdcall Clear(void)=0;
virtual void    __stdcall Refresh(void)=0;
virtual HRESULT __stdcall GetDataSource(IRowCursor** DataSource)=0;
virtual HRESULT __stdcall SetDataSource(IRowCursor* DataSource)=0;
virtual HRESULT __stdcall GetRowIsVisible(LONG index, VARIANT_BOOL* RowIsVisible)=0;
virtual HRESULT __stdcall GetColIsVisible(LONG index, VARIANT_BOOL* ColIsVisible)=0;
virtual HRESULT __stdcall GetRowPos(LONG index, LONG* RowPos)=0;
virtual HRESULT __stdcall GetColPos(LONG index, LONG* ColPos)=0;
virtual HRESULT __stdcall GetGridLineWidth(signed short* GridLineWidth)=0;
virtual HRESULT __stdcall SetGridLineWidth(signed short GridLineWidth)=0;
virtual HRESULT __stdcall GetFixedAlignment(LONG index, signed short* FixedAlignment)=0;
virtual HRESULT __stdcall SetFixedAlignment(LONG index, signed short FixedAlignment)=0;
virtual HRESULT __stdcall GetFontName(BSTR* FontName)=0;
virtual HRESULT __stdcall SetFontName(BSTR FontName)=0;
virtual HRESULT __stdcall GetFontSize(float* FontSize)=0;
virtual HRESULT __stdcall SetFontSize(float FontSize)=0;
virtual HRESULT __stdcall GetFontBold(VARIANT_BOOL* FontBold)=0;
virtual HRESULT __stdcall SetFontBold(VARIANT_BOOL FontBold)=0;
virtual HRESULT __stdcall GetFontItalic(VARIANT_BOOL* FontItalic)=0;
virtual HRESULT __stdcall SetFontItalic(VARIANT_BOOL FontItalic)=0;
virtual HRESULT __stdcall GetFontStrikethru(VARIANT_BOOL* FontStrikethru)=0;
virtual HRESULT __stdcall SetFontStrikethru(VARIANT_BOOL FontStrikethru)=0;
virtual HRESULT __stdcall GetFontUnderline(VARIANT_BOOL* FontUnderline)=0;
virtual HRESULT __stdcall SetFontUnderline(VARIANT_BOOL FontUnderline)=0;
virtual HRESULT __stdcall GetRightToLeft(VARIANT_BOOL* RightToLeft)=0;
virtual HRESULT __stdcall SetRightToLeft(VARIANT_BOOL RightToLeft)=0;
virtual HRESULT __stdcall GetOLEDropMode(OLEDropConstants* psOLEDropMode)=0;
virtual HRESULT __stdcall SetOLEDropMode(OLEDropConstants psOLEDropMode)=0;
virtual HRESULT __stdcall OLEDrag(void)=0;
};


Just what you see above is how my program output the interface, and naturally, I didn't catch it until I tried to compile.  The nature of the particular algorithm I was using couldn't come up with either the variable type or the name of the 2nd [in] long parameter.  The reason I'm posting now is to ask you if you are aware of this issue?  I've been struggling with it for days now and it has me completely stumped.  I've done a lot of research on the issue in terms of fooling around with my code and writing various diagnostic programs to try to get to the bottom of the problem, but I haven't been able to solve it.  Of course I realize that in a parameter declaration the variable name is optional and only the variable type (which you have) is required.  However, I've come to finally believe that in this case even the variable type is suspect.  In various trials I've done I have also been able to get a 'long' out of the typelib, but I don't trust it.  I'm getting ahead of myself though.  I'd like to point out that the PowerBASIC COM Browser is producing perfect output – just like the IDL from OLEVIEW!  Here it is...


PowerBASIC COM Browser

Property Set RowPosition <61> (ByVal index As Long, ByVal Rhs As Long)
Property Set ColPosition <62> (ByVal index As Long, ByVal Rhs As Long)


I'd love to know how they're getting that!  So what I'm asking is whether you are aware of this issue?  Here is some diagnostic info from one of my programs that compares the Property Set RowData member (no problem) with the Property Set ColPosition member (big time problem).... 


RowData   This is OK!
/*
Library                                  = MSFlexGridLib
index                                    = 26
pKind                                    = TKIND_DISPATCH
strName                                  = IMSFlexGrid
Base                                     = IDispatch
pTypeAttr                                = 5102964
iCountFunctions                          = 180
Interface Index                          = 26
Function Index                           = 144

pFuncDesc->funckind                      = FUNC_PUREVIRTUAL ( virtual )
pFuncDesc->elemdescFunc.tdesc.vt         = VT_HRESULTHRESULT
pFuncDesc->callconv                      = CC_STDCALL ( __stdcall )
pcNames                                  = 3
pFuncDesc->invkind                       = INVOKE_PROPERTYPUT ( Set... )
strFnText[0]                             = RowData
pFuncDesc->lprgelemdescParam[0].tdesc.vt = LONG
strFnText[1]                             = index
pFuncDesc->lprgelemdescParam[1].tdesc.vt = LONG
strFnText[2]                             = RowData
*/


ColPosition – The Problem!
/*
Library                                  = MSFlexGridLib
index                                    = 26
pKind                                    = TKIND_DISPATCH
strName                                  = IMSFlexGrid
Base                                     = IDispatch
pTypeAttr                                = 6413684
iCountFunctions                          = 180
Interface Index                          = 26
Function Index                           = 142

pFuncDesc->funckind                      = FUNC_PUREVIRTUAL ( virtual )
pFuncDesc->elemdescFunc.tdesc.vt         = VT_HRESULTHRESULT
pFuncDesc->callconv                      = CC_STDCALL ( __stdcall )
pcNames                                  = 2
pFuncDesc->invkind                       = INVOKE_PROPERTYPUT ( Set... )
strFnText[0]                             = ColPosition                         // <<< ColPosition
pFuncDesc->lprgelemdescParam[0].tdesc.vt = LONG
strFnText[1]                             = index
pFuncDesc->lprgelemdescParam[1].tdesc.vt = LONG
strFnText[2]                             =
*/



Both of these sets of members are very similar; they both have two [in] long parameters; in both cases the first parameter is named 'index'.  If you look carefully at the diagnostic info above from my ITypeInfo::GetNames() calls, the problem is coming in with the pcNames BSTR name count returned from the function call.  Note that with RowData, pcNames = 3; Subscript zero of the BSTR output array contains the name of the member, i.e., 'RowData'; subscript one contains the name of the 1st parameter, i.e., 'index', and subscript two contains again the text string 'RowData', which is also the name of the member. 

Now take a look at the 2nd block above for ColPosition, which also has two parameters.  Instead of pcNames again equaling 3 as it should and as with RowData, its equal to 2!   Because pcNames equals 2, the only subscripts of my strFnText BSTR array that are valid are zero and one.  And sure enough strFnText[2] is an empty string or null as seen in the output. 

Another relationship that I believe holds with all this is that the highest valid subscript of the ELEMDESC array of TYPEDESCs, e.g., ....

pFuncDesc->lprgelemdescParam[0].tdesc.vt

is that the highest valid subscript is going to be two less than the count of pcNames from ItypeInfo::GetNames().  This is easy to see because that call includes the BSTR name of the member itself plus the names of the parameters, while the ELEMDESCs only pertain to the parameters.  And of course the difference of two comes from the zero basing.  In the RowData diagnostics above note that pcNames is 3 so pFuncDesc->lprgelemdescParam[0] and pFuncDesc->lprgelemdescParam[1] are the valid TYPEDESCs, so my 'difference of two' subscript rule holds.  So now take a look at ColPosition where pcNames is coming out as 2.

That being the case, the only strFnText[] names we're getting are the names for the member, i.e., 'ColPosition', and for the first parameter – 'index'.  StrFnText[2] will come out blank.  I believe that's why your TypeLib Browser doesn't have a name for the last parameter of those two members in question.  But in terms of my 'difference of two' subscript rule, the only valid ELEMDESC UDT will be subscript zero, i.e., long.  However, note below I did obtain another LONG for this call...

pFuncDesc->lprgelemdescParam[1].tdesc.vt = LONG

...and that call is in violation of my 'difference of two' subscript rule, even though it does seem to be coming up with the right type.  What I believe though is that its pure coincidence.  I have tested this rule of mine with a handful of other members, and what I have found is that one usually comes up with some valid type when one goes beyond the pcNames-2 bounds, and this is true for members which don't require any more types!  So what I'm saying is in the ColPosition/RowPosition cases I believe that 2nd long we're coming up with is invalid.  Yes, I know its valid, but I believe its validity is purely random.  Unless I'm totally off base and wrong and going about the whole thing wrong, which wouldn't surprise me either.  I'm hoping you can tell me!  And how did the PowerBASIC COM Browser come up with what it did???

José Roca

Quote
If you look close you'll see your type lib browser obtained the type, i.e., <long>, but not the parameter name.

This is because it has not a parameter name. It is common in typelibs of components made for Visual Basic.

Quote
I'd like to point out that the PowerBASIC COM Browser is producing perfect output – just like the IDL from OLEVIEW!

No, they just are adding a default name. rhs means "right hand side", i.e. the last parameter.

Frederick J. Harris

If this idl was compiled with midl...

HRESULT ColPosition([in] long index, [in] long rhs);

and a typelib created, the pcNames parameter of ITypeInfo::GetNames() would return 3 - not 2, and long rhs would be obtainable as with all the other 178 members of that interface.  So you are certain this isn't some kind of type library error? 

Dominic Mitchell

See the remarks section here

http://msdn.microsoft.com/en-us/library/aa912401.aspx

The "rhs" name is fabricated.  For property put and put reference functions, the right side
of the assignment is unnamed. What name you assign to it is up to you.

You are probably missing the important check below.


            hr = ITypeInfo_GetNames(pITypeInfo, @pFuncDesc.memid, grgBstrNames, @pFuncDesc.cParams + 1, cNames)
            IF hr = %S_OK THEN
              WideCharToMultiByte %CP_ACP, 0, BYVAL @grgBstrNames[0], -1, BYVAL VARPTR(szInfo), %MAX_PATH, BYVAL %NULL, BYVAL %NULL
              SysFreeString BYVAL @grgBstrNames[0]

              fRetValFunc  = 0
              fRetValParam = 0
              cOutParams   = 0
              IF @pFuncDesc.cParams > 0 THEN
                '---------------------------------------------------
                IF cNames < @pFuncDesc.cParams + 1 THEN
                  lpwsz = CoTaskMemAlloc(32)
                  IF lpwsz THEN
                    szName2 = "rhs"
                    MultiByteToWideChar %CP_ACP, %MB_PRECOMPOSED, BYVAL VARPTR(szName2), -1, BYVAL lpwsz, 32
                    @grgBstrNames[cNames] = SysAllocString(BYVAL lpwsz)
                    CoTaskMemFree lpwsz
                    INCR cNames
                  END IF
                END IF   
...               
               
Dominic Mitchell
Phoenix Visual Designer
http://www.phnxthunder.com

Frederick J. Harris

Ah!  It looks like I had the information I needed at my disposal all along.  I kind of see now.  Thanks Jose & Dominic.


Frederick J. Harris

Quote
You are probably missing the important check below.

Yes, I think that was it.