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:
Building for x64 tells me it isn't registered (makes sense):
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.
Update 2: I decided to mess around with VBScript, which works fine with similar code????
Update 3: I thought hmm, maybe VBScript does this differently than I am in C#
, and decided to try using an ActiveX Object.
Literally the same error, thank you C# very cool