Class not registered when doing COM interop 
Author Message
 Class not registered when doing COM interop

I have been grappling with how to use functions from
dll's. The classic example used is the messagebox which
works very easily. I am trying to use a function from the
shell32.dll. When I try to access the functin I get a
class not registered error. I have included a very small
example of what I am trying to do. I am at a loss for
what I am doing wrong. Any help would be appreicated.

// Added reference Shell32.dll to project
using System;
using System.Runtime.InteropServices;
using Shell32;

public class MyShellLink
{
        [DllImport("Shell32.dll")]
        public static extern void Resolve(int fFlags);

        public MyShellLink()
        {
        }

        public void getLink()
        {
        IShellLinkDual isld;

                isld = new ShellLinkObjectClass();

                isld.Resolve(0);
        }

Quote:
}

// When the application reaches the new
ShellLinkObjectClass line
// the following error is generated

"COM object with CLSID { xxxxxxxxxxxxxxx} is either
not valid or not registered.
Thanks

T.Fox

  ShellLinkCode.cs
< 1K Download


Thu, 21 Apr 2005 10:12:42 GMT  
 Class not registered when doing COM interop
You are absolutely correct. I created a new project in C#, made the
references and placed your code in the form load. I got the same error.

BTW, The typelib shows it being supported in VB6 and you can make a
reference to it without error.

Checked in the registry and it isn't in there.  So I guess if I pushed on it
hard enough in VB6, I'd get an error as well.

Sounds like its either a bug in the Shell32.dll or its been neutereed to
abate hackers.

HTH


Quote:
> I have been grappling with how to use functions from
> dll's. The classic example used is the messagebox which
> works very easily. I am trying to use a function from the
> shell32.dll. When I try to access the functin I get a
> class not registered error. I have included a very small
> example of what I am trying to do. I am at a loss for
> what I am doing wrong. Any help would be appreicated.

> // Added reference Shell32.dll to project
> using System;
> using System.Runtime.InteropServices;
> using Shell32;

> public class MyShellLink
> {
> [DllImport("Shell32.dll")]
> public static extern void Resolve(int fFlags);

> public MyShellLink()
> {
> }

> public void getLink()
> {
>         IShellLinkDual isld;

> isld = new ShellLinkObjectClass();

> isld.Resolve(0);
> }
> }

> // When the application reaches the new
> ShellLinkObjectClass line
> // the following error is generated

> "COM object with CLSID { xxxxxxxxxxxxxxx} is either
> not valid or not registered.
> Thanks

> T.Fox



Thu, 21 Apr 2005 12:15:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. COM error : class not registered

2. "Class Not Registered" ON aggregated class

3. COM Interop - How to pass C# uint array to COM interface which takes UINT *pArray

4. ATL COM - Passing ATL COM classes through another ATL COM class in the same app

5. How to register COM class with only CLSID but no ProgID using attributes

6. programmatically registering COM object (not regsvr32)

7. Suddenly can't register ATL COM class

8. Not/Auto registering COM ATL exe server

9. Typel Library not registeting when COM .exe registers

10. COM will not register without VC++ installed

11. COM object not registering properly in 98

12. registering COM classes in MFC server

 

 
Powered by phpBB® Forum Software