The workaround is to define a static ActiveX object in the form class that assigns the ActiveX object on the interface to the newly defined object in the Formload class, which is accessible to the static object.
public static Axclientdriver_ntlib.axclientdriverctrl com = new Axclientdriver_ntlib.axclientdriverctrl ();
private void Form1_Load (object sender, EventArgs e)
{
com = THIS.AXCLIENTDRIVERCTRL1;
IsRunning = true;
This. FormClosing + = form1_formclosing;
Thread t = new thread (startserver);
T.setapartmentstate (ApartmentState.STA);//Key settings
T.start ();
}
public class A
{
public void Getzhiwen ()
{
New Axclientdriver_ntlib.axclientdriverctrl (). Gwq_signfinger (); /* ERROR:
The ActiveX control "f1b35062-91ea-47fd-a71e-872c114220b0" cannot be instantiated because the current thread is not in a single-threaded apartment. System.Threading.ThreadStateException: The ActiveX control "f1b35062-91ea-47fd-a71e-872c114220b0" cannot be instantiated because the current thread is not in a single-threaded apartment. */
Form1.com.GWQ_SignFinger ();
}
}
The call interface in the Class ActiveX control error resolving the ActiveX control cannot be instantiated because the current thread is not in a single-threaded apartment