Real Software Forums
http://forums.realsoftware.com/

Pointer instead of array problem using quartz.dll
http://forums.realsoftware.com/viewtopic.php?f=13&t=39314
Page 1 of 1

Author:  tpolson [ Sat Jun 04, 2011 12:50 pm ]
Post subject:  Pointer instead of array problem using quartz.dll

i am porting a VB app that handles directshow filters and I'm hung up on creating the list of filters form the regfiltercollection

quartz.dll is added to the project as an activex reference

i have the following to get the pointer to the filter collection which works in both VB and RB

dim m_objRegFilterInfo as Object
m_objRegFilterInfo=QuartzTypeLib.FilgraphManager.RegFilterCollection

In RB, QuartzTypeLib.FilgraphManager.RegFilterCollection is a computed property with the following in the GET statement:

If mThis = Nil Then Raise New NilObjectException
Dim ppUnk_Param As Ptr
Dim func As New RegFilterCollection_Get_Func1( mThis.Ptr( 0 ).Ptr( 56 ) )
Dim resultCode As Integer = func.Invoke( mThis, ppUnk_Param )
If 0 = resultCode Then
If Nil <> ppUnk_Param Then
Return New COM.IDispatch( ppUnk_Param )
End If
Else
Raise New COM.COMException("Failed on RegFilterCollection", resultCode )
End If

in VB m_objRegFilterInfo shows as IAMCollection which is the list I want and the following statement works

'enumerate through each filter in the registered filters collection..
For Each objRegFilter In m_objRegFilterInfo
'append the filtername to the listbox
listRegFilters.AddItem objRegFilter.Name
Next

in RB m_objRegFilterInfo shows as a COM.IDispatch and returns mThis as pointer value

the following statement doesn't work in RB. it expects m_objRegFilterInfo to be an array but it's just a pointer.

'enumerate through each filter in the registered filters collection..
For Each objRegFilter In m_objRegFilterInfo
'append the filtername to the listbox
listRegFilters.AddRow objRegFilter.Name
Next

how do i use the pointer to get the list of filters?

thanks

Author:  PSmith [ Sun Jun 05, 2011 7:18 am ]
Post subject:  Re: Pointer instead of array problem using quartz.dll

MemoryBlock is pretty smart at converting stuff. You could try something like:
Dim mb As MemoryBlock

mb = m_objRegFilterInfo
... and then look at mb in the debugger to see if it grabbed the data. It's not an array yet but it's a start.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/