Solved

The type or namespace Ifilter could not be found

Posted on 2006-06-23
9
800 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:alexthecodepoet
  • 5
  • 4
9 Comments
 
LVL 25

Expert Comment

by:dstanley9
ID: 16972265
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
 

Author Comment

by:alexthecodepoet
ID: 16972279
IFilter microsoft .NET technology..
to be honest, i dont know where the definition is, that is what i was hoping to find out ;)
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 16972350
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:alexthecodepoet
ID: 16972602
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
 
LVL 25

Expert Comment

by:dstanley9
ID: 16972623
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
 

Author Comment

by:alexthecodepoet
ID: 16972738
are you going to be here for a few more minutes?  There are little bugs popping up that i am trying to fix
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 16972745
yep.
0
 

Author Comment

by:alexthecodepoet
ID: 16972761
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
 

Author Comment

by:alexthecodepoet
ID: 16972924
i ended up using a different IFilter.cs file, and now it works.

thanks for all of the help
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question