Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 812
  • Last Modified:

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
0
alexthecodepoet
Asked:
alexthecodepoet
  • 5
  • 4
1 Solution
 
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
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
dstanley9Commented:
yep.
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now