467,077 Members | 1,046 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

System.ExecutionEngineException

hi,
i meet a problem when i try to develop an application with an ocx in
c#. the same ocx works well in vc,but not in c#,the Microsoft .NET common
language runtime throw a System.ExecutionEngineException error message.msdn
said it is a bug of .NET and advice make sure not have any indirect module
dependencies.i do not know what it means,but i do need this ocx
control.what should i do?
pls tell me , thanks in advance and sorry for my poor english..
(A)i use the Visual Studio .NET 2003;
(B)the pci-ocx control is an data acquisition one,here is AxPci9812,it is
come with the data acquisition card (ADLINK PCI9812)i bought;
(C)the ocx control works well in VC.net;
(D)the program does not interupt at my break point,but the data acquisition
is complete and it is right compare to the VC code result ,but it throw an
ExecutionEngineException error,then my program interrupt.
(E)my code sets as follow;
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using AxMULTIPLELib;
using MULTIPLELib;
//using System.Windows.Forms.AxHost.AxMULTIPLELib ;

namespace _9812test
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private AxMULTIPLELib.AxPci9812 axPci98121;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
///

private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编*器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
//this.axPci98121 = new AxMULTIPLELib.AxPci9812();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();

//((System.ComponentModel.ISupportInitialize)(this.a xPci98121)).BeginInit();
this.SuspendLayout();
//
// axPci98121
//
this.axPci98121.Enabled = true;
this.axPci98121.Location = new System.Drawing.Point(56, 392);
this.axPci98121.Name = "axPci98121";
this.axPci98121.OcxState =
((System.Windows.Forms.AxHost.State)(resources.Get Object("axPci98121.OcxStat
e")));
this.axPci98121.Size = new System.Drawing.Size(32, 32);
this.axPci98121.TabIndex = 2;
this.axPci98121.Visible = false;
this.axPci98121.AiHalfReady += new
AxMULTIPLELib._DPci9812Events_AiHalfReadyEventHand ler(this.axPci98121_AiHalf
Ready);
this.axPci98121.AiComplete += new
AxMULTIPLELib._DPci9812Events_AiCompleteEventHandl er(this.axPci98121_AiCompl
ete);
//
// button1
//
this.button1.Location = new System.Drawing.Point(224, 408);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 16);
this.button1.TabIndex = 3;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(352, 392);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(112, 24);
this.label1.TabIndex = 5;
this.label1.Text = "label1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(536, 469);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
//this.Controls.Add(this.axPci98121);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.a xPci98121)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{
axPci98121.DeviceName="pci9812";
axPci98121.Open(0);
}

private void axPci98121_AiComplete(object sender,
AxMULTIPLELib._DPci9812Events_AiCompleteEvent e)
{
float[] scaledData=(float[])e.scaledData;
int k=scaledData.Length;
float[,] chandata=new float[4,(byte)(k/4)];
for(int i=0;i<(byte)(k/4);i++)
{
for(int j=0;j<3;j++)
{
chandata[i,j]=scaledData[4*i+j];
}

}

}

private void button1_Click(object sender, System.EventArgs e)
{
object filename=new object();
bool b=axPci98121.StartContAI("d:\\t.dat");//filename);

}

private void axPci98121_AiHalfReady(object sender,
AxMULTIPLELib._DPci9812Events_AiHalfReadyEvent e)
{
float[] scaledData=(float[])e.scaledData;
int k=scaledData.Length;
float[,] chandata=new float[4,(byte)(k/4)];
for(int i=0;i<(byte)(k/4);i++)
{
for(int j=0;j<3;j++)
{
chandata[i,j]=scaledData[4*i+j];
}

}
}
}
}
Nov 15 '05 #1
  • viewed: 2623
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by John O'Neill | last post: by
1 post views Thread by Tim Mulholland | last post: by
1 post views Thread by Ladislav Prosek | last post: by
8 posts views Thread by John | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.