“System.Windows.Forms.AxHost”类型的异常 InvalidActiveXStateException被扔了
我在我的简单项目中遇到错误。
这是我的代码:
if (axZKFPEngX1.InitEngine() == 0) {
label1.Text = "Connected";
}
else {
label1.Text = "Connection Failed";
}
我已经添加了参考组合 AxInterop.ZKFPEngXControl
和 Interop.ZKFPEngXControl
。
调试时,我单击按钮,出现警告:
已处理 InvalidActiveXStateException。
“引发了‘System.Windows.Forms.AxHost+InvalidActiveXStateException’类型的异常”**
I am getting an error in my simple project.
This is my code:
if (axZKFPEngX1.InitEngine() == 0) {
label1.Text = "Connected";
}
else {
label1.Text = "Connection Failed";
}
I already added reference composites AxInterop.ZKFPEngXControl
and Interop.ZKFPEngXControl
.
While debugging, I click the button, and a warning appears:
InvalidActiveXStateException was handled.
"Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown"**
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先尝试从您的组件中调用
CreateControl()
。try to call
CreateControl()
from your component first.Constantin 的答案是满足您的要求,但在这里我想再添加一件事。
如果您想通过所有线程反映此更改,而不仅仅是通过调用线程(在多线程场景中),那么
在多线程场景中使用“实际”,如果您的换肤代码位于其中一个线程中,那么它可能不会反映其他线程的更改当前线程,因此当时这段代码在其中发挥着重要作用。
以下是我提到的一些文档,请仔细阅读以供参考:
The answer by Constantin is Fulfill your requirement but here I wanted to add one more thing with it.
If you wanted to reflected this changes via all the threads and not only by calling thread (in multiple thread scenario) then use
Actually in multiple threading scenario if your skinning code is in one of the thread then may be it is not reflect change for other current thread so at that time this code is play important role in it.
Here is some Documents I mention kindly go through it for reference :