Re: Error accessing my C# app from VBScript

Tech-Archive recommends: Speed Up your PC by fixing your registry



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.InterfaceIsIDispatch)] 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" <nospam@xxxxxxxxxx> wrote in message
news:WvKdnVi1EuAxt4_eRVn-og@xxxxxxxxxxxxxx
> 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();
> }
> }
> }
>
>


.



Relevant Pages

  • Re: "pool" a tightly controlled set of Excel instances
    ... Tried out DynamicWrapper object in my vbscript code but could not get it to ... Was thinking maybe the DynamicWrapper control does not work in Windows ... an actX object to call the api, ... you to call api's from script. ...
    (microsoft.public.scripting.vbscript)
  • Re: VBScript error trying to access C# app
    ... I'm not an expert on this but for GetObject to work I believe you need to ... > What I am trying to do is the same as when you control an instance of MS Word ... > with VBScript using GetObject. ... > interface) and did the regasm /tlb option. ...
    (microsoft.public.scripting.vbscript)
  • Re: active x control
    ... >> I wrote vbscript to open word doc and print some text and close the word. ... >> I do that using active x control so that I can hide the vbscript codes I ... > If you code an ActiveX control, it must be registered on the computer. ...
    (microsoft.public.scripting.vbscript)
  • Re: Returning data from ATL COM server to VB, VBScript, JScript & ASP clients
    ... I ended up having my control return an array of variants to the caller. ... This appears to be usable from both VB and VBScript and based on what I've ... read should be usable by JScript client. ...
    (microsoft.public.vc.atl)
  • Re: VBScript issue under Windows Server 2000 and 2003
    ... Navigating to the html page inside a webbrowser control will generate ... a script error. ... As far as I can tell, the CIntcauses a vbscript ... Random guess - FPU control mask in your process is set to something that interferes with VBScript in some way, and it's different in IE. See _controlfp. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)