The type or namespace Ifilter could not be found

Hello,

I am trying to compile this code in C# 1.1:

using System;
using System.Runtime.InteropServices;
using System.Text;



namespace DesktopSearch1.Parsing
{
    /// <summary>
    /// Summary description for Parser.
    /// </summary>
    public class Parser
    {
        public Parser()
        {
        }

        [DllImport("query.dll", CharSet = CharSet.Unicode)]
        private extern static int LoadIFilter(string pwcsPath, ref IUnknown pUnkOuter, ref IFilter ppIUnk);

..... the rest has been ommited

When i try to compile, it says that "the type or namespace 'IFilter' could not be found" -- does anyone know how to get rid of this error?

Thanks
alexthecodepoetAsked:
Who is Participating?
 
dstanley9Connect With a Mentor Commented:
yep.
0
 
dstanley9Commented:
Where is the defenition for IFilter?  Is it in query.dll?  Is query.dll a COM dll?  If so, why are you using pinvoke?
0
 
alexthecodepoetAuthor Commented:
IFilter microsoft .NET technology..
to be honest, i dont know where the definition is, that is what i was hoping to find out ;)
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
dstanley9Commented:
OK, found this function at pinvoke.net, which is a little different from yours:

[DllImport("query.dll", SetLastError=true, CharSet=CharSet.Unicode)]
static extern int LoadIFilter(string pwcsPath,
          [MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter,
          ref IFilter ppIUnk);

IFilter is a COM intefacce, so you may have to define it yourself.  Here's some source that I found:

http://dotlucene.net/documentation/MicrosoftOfficeDocumentsP.html

0
 
alexthecodepoetAuthor Commented:
when i do that, and then try to compile, i get this error that says 'receieved a namespace instead of a class' ... or something..

i copied the code from the dotlucene page, put it into IFilter.cs, compiled it, and then referenced that dll file from Parser.cs (and i get the error above)
0
 
dstanley9Commented:
Well, the jerk names the namespace the same as the interface.  For clarity, change the namespace in ifilter.cs to IFilterInterop and add

using IFilterInterop

to Parser.cs
0
 
alexthecodepoetAuthor Commented:
are you going to be here for a few more minutes?  There are little bugs popping up that i am trying to fix
0
 
alexthecodepoetAuthor Commented:
if we can fix this, give me your address, and i might send you 99 trillion dollars (thats how happy i would be)

I now get this one and only error:

the type or namespace name 'constants' could not be found (are you missing a using directive or an assembly reference?)
0
 
alexthecodepoetAuthor Commented:
i ended up using a different IFilter.cs file, and now it works.

thanks for all of the help
0
All Courses

From novice to tech pro — start learning today.