I am trying to convert a C# IFilter Runtime Callable Wrapper (RCW) to VB2005
or 2003. Basically, my problem is that the C# 'ComImport' attribute cannot be
used in VB. This is documented in KB313506:
http://support.microsoft.com/kb/313506/en-us?spid=7796&sid=global). And as it
suggests, I have tried referencing query.dll, but this does not work. And I
have tried the Type Library Importer on the same dll, but it did not work
either.
I also don't know how to go about declaring the types such as IFILTER_INIT,
FULLPROPSPEC[] , STAT_CHUNK and FILTERREGION.
Is there any way this IFilter Runtime Callable Wrapper (RCW) can be
converted to VB?
The code excerpt is below. The original code is published at
http://microsoft.apress.com/asptodayarchive/74064/content-extraction-with-the-if
ilter-interface.
/// I can convert this section to VB easily
[DllImport("query.dll", SetLastError=true, CharSet=CharSet.Unicode)]
private static extern int LoadIFilter(string pwcsPath,
[MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter,
ref IFilter ppIUnk);
/// I can't work out how to convert lines marked "<--this bit":
[ComImport] <--this bit
[Guid("89BCB740-6119-101A-BCB7-00DD010655AF")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IFilter
{
void Init([MarshalAs(UnmanagedType.U4)]
IFILTER_INIT grfFlags, <--this bit
uint cAttributes,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)]
FULLPROPSPEC[] aAttributes, <--this bit
ref uint pdwFlags);
[PreserveSig]
int GetChunk(out STAT_CHUNK pStat); <--this bit
[PreserveSig]
int GetText(ref uint pcwcBuffer,
[MarshalAs(UnmanagedType.LPWStr)]
StringBuilder buffer
);
void GetValue(ref UIntPtr ppPropValue);
void BindRegion([MarshalAs(UnmanagedType.Struct)]
FILTERREGION origPos, <--this bit
ref Guid riid,
ref UIntPtr ppunk);
}
- Thanks in advance for your assistance!
Bob Butler - 22 Aug 2007 02:44 GMT
>I am trying to convert a C# IFilter Runtime Callable Wrapper (RCW) to
>VB2005
> or 2003.

Signature
You need to ask in a newsgroup with "dotnet" in the name. This group is for
VB 6.0 and earlier and does not include VB.Net or VB 200x.