IT-Consultant: José Roca (PBWIN 10+/PBCC 6+) (Archive only) > Graphics and Multimedia

ShowFilterPropertyPages Problem

(1/2) > >>

Jon Eskdale:
I'm trying to show the property pages of a Direct Show Filter

What I have at the moment is as below - This is not finished working code and does not work but shows what I'm trying

I have a couple of issues at the moment.

a) Is the declaration for OleCreatePropertyFrame correct I'm using the latest WINAPI_III_106. This code does not compile because
caGUID.pElems is a GUID PTR but the definition is BYREF lpPageClsID AS GUID if I edit the definition to what I think it should be BYVAL lpPageClsID AS GUID PTR it then compiles
Is there an error in the definition or is it my coding thats wrong (probably the latter)

b) The two MSGBOX's display the correct details
      msgbox FilterInfo.achName     'This displays the Filter Name
      MSGBOX str$(caGUID.cElems) 'This displays 1 which is correct for the filter I'm using

      BUT the call to OleCreatePropertyFrame crashes the program  I'm not sure if the definition is wrong or I'm passing the wrong parameters

Any assistance gratefully received


--- Code: ---function ShowFilterPropertyPages(pFilter as IBaseFilter) as long
   local pProp as ISpecifyPropertyPages
   local FilterInfo as FILTER_INFO
   local pFilterUnk as IUnknown
   local caGUID as CAUUID
   local hr as long
   pProp = pFilter
   if isobject(pProp) THEN
      hr = pFilter.QueryFilterInfo(FilterInfo)
      pFilterUnk = pFilter
      pProp = Nothing
      msgbox FilterInfo.achName
      MSGBOX str$(caGUID.cElems)
      OleCreatePropertyFrame( _
      %NULL, _
      0, 0, _
      FilterInfo.achName, _
      1, _
      pFilterUnk, _
      caGUID.cElems, _
      caGUID.pElems, _
      0, _
      0, %Null)
      msgbox "Done"
      pFilterUnk = Nothing
      'FilterInfo = Nothing

--- End code ---

José Roca:
The declaration is correct, following the PB rules. This parameter expects a GUID or an array of GUIDs.

The member pElems of the CAUUID strcuture is a pointer to an allocated array of GUIDs, so you must no pass it, but to use it to extract the GUID or GUIDs and pass the extracted GUIDs. You then have to call CoTaskMemFree passing that pointer to free the array.

Jon Eskdale:
Thanks Jose

One day perhaps I'll find something simple to do!!  This is really testing my skills at the moment. 
According to the parameter its expecting a GUID passed in which it will pass by reference correct?
You suggest extracting the GUID's do I understand correctly?
In the C sample code they somehow manage to just pass the parameter - But my C is very limited.  Any chance someone could give me a pointer on this one how do I pass this caGUID.pElems

The C sample is below

--- Code: ---OleCreatePropertyFrame(
NULL, // Parent window
0, 0, // Reserved
FilterInfo.achName, // Caption for the dialog box
1, // Number of objects (just the filter)
&pFilterUnk, // Array of object pointers.
caGUID.cElems, // Number of property pages
caGUID.pElems, // Array of property page CLSIDs
0, // Locale identifier
0, NULL // Reserved

--- End code ---

Thanks Jon

José Roca:
Something like this:

--- Code: ---REDIM rgElems(caGUID.cElems - 1) AS GUID
FOR i = 0 TO caGUID.cElems - 1
   rgElems(i) = caGUID.@pElems[i]

--- End code ---

and then pass rgElems(0) to the OleCreatePropertyFrame function instead of caGUID.pElems, and NOTHING instead of pFilterUnk.

Jon Eskdale:
Thanks Jose,

I gave that a try - the NOTHING instead of pFilterUnk stops it crashing but nothing is displayed it does return though as I get the Done Msgbox



[0] Message Index

[#] Next page

Go to full version