Simon Dahlbacka

Ok,

so I'm trying to create my first gadget, and run into this "automation server can't create object" on the following line:

var foo = new ActiveXObject("My.Prog.Id");

my activex works (as far as I can tell) if I play with it in powershell

PS C:\Users\Simon> $a = new-object -comObject My.Prog.Id
PS C:\Users\Simon> $a.Connect()
PS C:\Users\Simon> $a.DoStuff()

...

I've marked it "safe for scripting", tried playing with the IE security settings, but to no avail..

What am I missing here (or is there any further info I need to provide )

/Simon




Re: Sidebar Gadget Development Automation server can't create object

Jonathan Abbott

What did you code it in

That error means it can't find the COM object. Check HKLM\Software\Classes for "My.Prog.Id"




Re: Sidebar Gadget Development Automation server can't create object

Simon Dahlbacka

It's a C# Com object,

GAC:ed and basically registered using regasm MyDll.dll or regasm /tlb MyDll.dll


The registry entries seem to be ok (in HKCR\My.Prog.Id and HKCR\CLSID\<guid>)

the basic structure of my com code is like this, is there anything I have missed

[ComVisible(true)]
[Guid("guid-goes-here)]
[ClassInterface(ClassInterfaceType.None)]
public class Foo : IFoo
{
public Foo()
{

}
...
}

[ComVisible(true)]
[Guid("another-guid")]
public interface IFoo
{
[DispId(1)]
void Connect();
[DispId(2)]
void Disconnect();
...
}








Re: Sidebar Gadget Development Automation server can't create object

Jonathan Abbott

VS I presume, the code looks fine, the only thing I can think of is: On your project properties page, under "Assembly Information", make sure you've ticked "Make assembly COM-Visible".




Re: Sidebar Gadget Development Automation server can't create object

Simon Dahlbacka

I hadn't, but since I manually registered my com object through either regasm or an installer, it shouldn't matter, right

Nevertheless, I tried.. and I'm still getting the same error.

Maybe I need to start off with a "hello world" type ActiveX first....





Re: Sidebar Gadget Development Automation server can't create object

The Triggerman

hi simon,

i'm experiencing the same problem. i've fixed it by adding the url of the site where you are using the activex control as a Trusted Site. IE's Tools->Internet Options->Security->Trusted Sites->Sites-Add.

however, i dont want to do this. do you know any other options on how to automate this

cheers!





Re: Sidebar Gadget Development Automation server can't create object

The Triggerman

i've just solved the problem. you just need to implement the IObjectSafety interface.

please refer to http://support.microsoft.com/kb/216434/en-us for the details.

cheers!