471,582 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,582 software developers and data experts.

Error accessing my C# app from VBScript

Hi all,

When I run my VbScript, I get the error: "ActiveX component can't create
object: 'getobject'. Error 800A01AD". Any ideas what I did wrong?

Here's my vbscript:
dim o
set o=getobject(,"ConsoleApplication2.Program")
msgbox o.TestString

And here's my C# application that's running when I try to access it from
vbscript:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
public class Program
{
public string TestString = "testing 123";
static void Main(string[] args)
{
Console.ReadLine();
}
}
}
Nov 17 '05 #1
3 3212
I now have it working, partially.

I can use CreateObject and create and then control the new instance of the
C# code with VBScript. However, I cannot use an already running instance of
the C# code using GetObject.

What I am trying to do is the same as when you control an instance of MS
Word with VBScript using GetObject(,"Word.Application"). This command
doesn't actually start Word, but instead uses the instance that's already
open and running.

What I changed to get it working this far was to use the
System.Runtime.InteropServices namspace, the
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)] and
[ClassInterface(ClassInterfaceType.None)] tags, and created a new interface
with the same name as the class and that begins with an underscore (class
interface) and did the regasm /tlb option.

This is the last obstacle for me and I assume I am still doing something
wrong.

Thanks in advance for any ideas.

"AdamM" <no****@nospam.com> wrote in message
news:Wv********************@comcast.com...
Hi all,

When I run my VbScript, I get the error: "ActiveX component can't create
object: 'getobject'. Error 800A01AD". Any ideas what I did wrong?

Here's my vbscript:
dim o
set o=getobject(,"ConsoleApplication2.Program")
msgbox o.TestString

And here's my C# application that's running when I try to access it from
vbscript:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
public class Program
{
public string TestString = "testing 123";
static void Main(string[] args)
{
Console.ReadLine();
}
}
}

Nov 17 '05 #2
Adam,

Unfortunately, this is something you can not do with .NET. You can not
create out-of-process COM servers with .NET. You are better off using VB6
or another unmanaged language which will allow you to do this.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"AdamM" <no****@nospam.com> wrote in message
news:Sf********************@comcast.com...
I now have it working, partially.

I can use CreateObject and create and then control the new instance of the
C# code with VBScript. However, I cannot use an already running instance
of the C# code using GetObject.

What I am trying to do is the same as when you control an instance of MS
Word with VBScript using GetObject(,"Word.Application"). This command
doesn't actually start Word, but instead uses the instance that's already
open and running.

What I changed to get it working this far was to use the
System.Runtime.InteropServices namspace, the
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)] and
[ClassInterface(ClassInterfaceType.None)] tags, and created a new
interface with the same name as the class and that begins with an
underscore (class interface) and did the regasm /tlb option.

This is the last obstacle for me and I assume I am still doing something
wrong.

Thanks in advance for any ideas.

"AdamM" <no****@nospam.com> wrote in message
news:Wv********************@comcast.com...
Hi all,

When I run my VbScript, I get the error: "ActiveX component can't create
object: 'getobject'. Error 800A01AD". Any ideas what I did wrong?

Here's my vbscript:
dim o
set o=getobject(,"ConsoleApplication2.Program")
msgbox o.TestString

And here's my C# application that's running when I try to access it from
vbscript:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
public class Program
{
public string TestString = "testing 123";
static void Main(string[] args)
{
Console.ReadLine();
}
}
}


Nov 17 '05 #3
Hi Nicholas,

Thanks for the information. Given that accessing a .NET app from VBScript
using GetObject is known as "accessing an out of process COM server", what
is the term for accessing it using CreateObject like it works currently?

Just trying to get my terminology straight...

Thanks again!

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Adam,

Unfortunately, this is something you can not do with .NET. You can not
create out-of-process COM servers with .NET. You are better off using VB6
or another unmanaged language which will allow you to do this.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"AdamM" <no****@nospam.com> wrote in message
news:Sf********************@comcast.com...
I now have it working, partially.

I can use CreateObject and create and then control the new instance of
the C# code with VBScript. However, I cannot use an already running
instance of the C# code using GetObject.

What I am trying to do is the same as when you control an instance of MS
Word with VBScript using GetObject(,"Word.Application"). This command
doesn't actually start Word, but instead uses the instance that's already
open and running.

What I changed to get it working this far was to use the
System.Runtime.InteropServices namspace, the
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)] and
[ClassInterface(ClassInterfaceType.None)] tags, and created a new
interface with the same name as the class and that begins with an
underscore (class interface) and did the regasm /tlb option.

This is the last obstacle for me and I assume I am still doing something
wrong.

Thanks in advance for any ideas.

"AdamM" <no****@nospam.com> wrote in message
news:Wv********************@comcast.com...
Hi all,

When I run my VbScript, I get the error: "ActiveX component can't create
object: 'getobject'. Error 800A01AD". Any ideas what I did wrong?

Here's my vbscript:
dim o
set o=getobject(,"ConsoleApplication2.Program")
msgbox o.TestString

And here's my C# application that's running when I try to access it from
vbscript:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
public class Program
{
public string TestString = "testing 123";
static void Main(string[] args)
{
Console.ReadLine();
}
}
}



Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

28 posts views Thread by Steve Bywaters | last post: by
4 posts views Thread by John Stemper | last post: by
1 post views Thread by Steven Baeten | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.