-1

I followed an old tutorial for using MS Agent with C#, and i'm not going to use an alternative to it, I specifically want to use MS Agent.

I added a refrence to the COM object Microsoft Agent Control 2.0 in refrences (and had to fix some code to have proper syntax again).

I'm using Windows 10, but that isn't an issue, MASH, for example, works fine.

If I build it for x86, I get the following error:

this error

Building for x64 tells me it isn't registered (makes sense):

unregistered

Here's my code:

public partial class Form1 : Form
{
    private AgentObjects.Agent Agent1;

    public Form1()
    {
        InitializeComponent();
    }
    private void Form1_Load(object sender, EventArgs e)
    {
        try
        {
            Agent1 = new AgentObjects.Agent();
            Agent1.Characters.Load("Ralsei", "Ralsei.acs");
            var ralsei = Agent1.Characters["Ralsei"];
            ralsei.Show();
        }
        catch (Exception ex)
        {
            MessageBox.Show("Can't use MS Agent.\n"+ex.ToString());
        }
    }
}

As you can see, the only event Form1 has is Load, so I didn't bother adding the Design.cs.

Update 1: This problem actually seems to NOT have to do with running Windows 10, like I thought it might have. Building this for .NET 4 and running it on XP shows the same error.

the error on xp

Update 2: I decided to mess around with VBScript, which works fine with similar code????

working fine in VBScript

Update 3: I thought hmm, maybe VBScript does this differently than I am in C#, and decided to try using an ActiveX Object.

enter image description here

Literally the same error, thank you C# very cool

2 Answers2

0

Unfortunately, according to Introduction to Microsoft Agent, it seems that:

[Microsoft Agent is deprecated as of Windows 7, and may be unavailable in subsequent versions of Windows.]

And that's probably why your getting the Agent was unable to start error message.

Regarding the more cryptic message, it's probably because you don't have an x64 version of the COM library installed in your Registry (which won't help you even if you did have it, as the service is deprecated).

Hope it helps!

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Itay Podhajcer
  • 2,616
  • 2
  • 9
  • 14
0

If you have Windows 10 64-bit, you could install free TTS program Claude to fix the error 0x800400154.

Also, keep in mind, what if your C# project targets x86, when you must add reference to "C:\Windows\MSAgent64\AgentCtl.dll" and if your C# project targets x64, when you must add reference to "C:\Windows\MSAgent\AgentCtl.dll".

Zagavarr
  • 191
  • 1
  • 9
  • are you sure about x86 having to load MSAgent64? also, i can't make refrences to COM dlls that don't exist on my filesystem, and installing claude didn't help at all – ScottBeebiWan Feb 28 '19 at 20:11
  • The folder C:\Windows\MSAgent64 will only appear in Windows 64-bit after Claude installation. In Windows 32-bit (x86) Claude will not install properly (you'll need to manually rename all files inside a folder C:\Windows\MSAgent, e.g. 32AgentSvr.exe into AgentSvr.exe and so on…) For example, I have Windows 10 64-bit and my VB.Net project targets x86 platform (32-bit application) So, I add reference to C:\Windows\MSAgent64\AgentCtl.dll This concept is similar to Windows Registry: in 64-bit systems 32-bit applications use the registry branch HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node – Zagavarr Mar 03 '19 at 21:13
  • i installed claude, the folder doesn't exist. but trying to use activex objects instead (which means it doesn't really matter where the dll is), i still got the same error. right now i'm working on a workaround to run vbscript commands in a C# interface – ScottBeebiWan Mar 05 '19 at 03:02