From: Tony on
Embedding in a .net WinApp:


An unhandled exception of type 'InvalidActiveXStateException' occurred in
axmstsclib.dll

Happens on line:

axMsTscAx1.Server = "192.168.1.44"





directions followed:


1. md c:\temp
2. cd c:\temp
3. %<SDK bin directory>%\aximp.exe %windir%\system32\mstscax.dll
This will generate MSTSCLib.dll and AxMSTSCLib.dll.
Make sure Interop.MSTSCLib.dll and AxInterop.MSTSCLib.dll have been deleted
in the obj and bin\Debug directories.
4. Copy the generated files (without renaming) - MSTSCLib.dll and
AxMSTSCLib.dll into the project's obj directory.
5. In the project's references, add MSTSCLib.dll and AxMSTSCLib.dll from
the obj directories.
6. Now, instead of drag-drop'ing the control from the toolbox, write code
to add the control:
Goto Form.cs code view
Declare: private AxMSTSCLib.AxMsTscAx axMsTscAx1;
In InitializeComponent:
this.axMsTscAx1 = new AxMSTSCLib.AxMsTscAx();
((System.ComponentModel.ISupportInitialize)(this.axMsTscAx1)).BeginInit();

//
// axMsTscAx1
//
this.axMsTscAx1.Enabled = true;
this.axMsTscAx1.Location = new System.Drawing.Point(58, 17);
this.axMsTscAx1.Name = "axMsTscAx1"
this.axMsTscAx1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axMsTscAx1.OcxStat
e")));
this.axMsTscAx1.Size = new System.Drawing.Size(192, 192);
this.axMsTscAx1.TabIndex = 1;
.....

this.Controls.Add(this.axMsTscAx1);
((System.ComponentModel.ISupportInitialize)(this.axMsTscAx1)).EndInit();