473,388 Members | 976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 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 3330
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Steve Bywaters | last post by:
There are several hundred of my client's franchisees happily accessing my ASP/VBscript web site... but one - just one - has reported the following: "I have been trying to log onto the LSM since...
10
by: | last post by:
I am accessing the same error-containing ASP page on an ISP server using w2k IE6 but with different effect. On the first computer I get several line of HTML outputed by ASP, shown correctly by...
1
by: alaa | last post by:
I have the following code in an ASP page but it does not seem to allow a JScript to access VBScript variables. But if a VBScript accesses a variable in declared in a JScript TAG then it seems to...
4
by: John Stemper | last post by:
I'm looking for some good articles or hints on accessing a .Net component that I've written from old ASP/VBScript. I've gotten as far as referencing the typelib in the global.asa file but when I...
1
by: Steven Baeten | last post by:
Hi All, I'm running a webpage-application where, in a aspx-page,a udl is called in vbscript in an xsl-stylesheet to access a database. When I want to execute this, I receive following error...
4
by: john d | last post by:
I have an IIS 5.0 server with a Virtual Directory called test. This virtual directory points to a share on the network, \\server1\share\ and uses a valid domain account in the "Connect As" field....
7
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got...
11
by: Jerry | last post by:
I'm using this code: Dim strName For Each strName in Session.Contents Response.Write strName & " - " & Session.Contents(strName) & "<BR>" Next If I only do a response.write strName, it shows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.