更新时间:2023-02-11 07:37:01
通常这与64位的差异有关32位DLL构建和处理。
尝试通过更改项目属性/构建/平台目标
来编译为32位。
private void captureButton_Click(object sender, EventArgs e)
{
#region if capture is not created, create it now
if (_capture == null)
{
try
{
_capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
#endregion
if (_capture != null)
{
if (_captureInProgress)
{ //stop the capture
captureButton.Text = "Start Capture";
Application.Idle -= ProcessFrame;
}
else
{
//start the capture
captureButton.Text = "Stop";
Application.Idle += ProcessFrame;
}
_captureInProgress = !_captureInProgress;
}
}
When I click on captureButton_Click,it threw an unhandled exception like below:
An attempt was made to load a program with an incorrect format. (System.BadImageFormatException)A System.BadImageFormatException was thrown. An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Can anyone please help me out? I'm new to it. Thanks.
I'm using VS 2010 with 64 bits, emgu library.
Usually this is related to the difference in 64bit and 32bit DLL builds and processes.
Try compiling to 32bit by changingproject properties/Build/Platform Target
.