Elecard
May 24, 2013, 04:18:45 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Casting UtilitiesIbaseFilter  (Read 2707 times)
juandiego
Newbie
*
Posts: 11


View Profile
« on: January 27, 2009, 10:06:34 pm »



I read in help files that there is a method (op_implicit) in Filter class that converts filter to IbaseFilter.

We are using C# project in VS2005.

But this method doesn't appear when i try to use it in an Utilities.Filter object that i created.

Anyway, I try with a standard casting

ibaseFilter my_ibaseFilter = (ibaseFilter)my_filter;

And returns an error because Utilities.Filter cannot convert to IbaseFilter...

Could you help me??
Logged
IrinaM
Moderator
*****
Posts: 139


View Profile
« Reply #1 on: January 28, 2009, 05:34:59 pm »

Hello juandiego,
this method (op_Implicit) returns the unmanaged pointer and so you can`t use it in C# code.

Filter class has the GetIUnknown property which returns the IUnknown interface pointer.
Syntax
          IntPtr GetIUnknown();

Using
          IBaseFilter bf = (IBaseFilter)Marshal.GetTypedObjectForIUnknown(fltr.GetIUnknown, typeof(IBaseFilter));
or
          Object myFilter = Marshal.GetObjectForIUnknown(fltr.GetIUnknown);
          IBaseFilter bf = myFilter as IBaseFilter;
Logged
juandiego
Newbie
*
Posts: 11


View Profile
« Reply #2 on: January 28, 2009, 06:37:03 pm »

I'm going to test it


Thks
Logged
RapidZer
Newbie
*
Posts: 1


View Profile
« Reply #3 on: February 21, 2010, 05:50:38 pm »

Hi there guys, I tried the op_Implicit) without the C# code on it. Pretty good since I was able to run it using the above syntax. I hope Diego was also able to solve his question since I haven't seen any reply from him since then. Rapid Prototyping
« Last Edit: March 10, 2010, 11:23:41 pm by RapidZer » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!