bmd_lonsine 2019-07-24 17:03 采纳率: 0%
浏览 2267

C#WPF工程调用C++的32位DLL在其他PC运行报错:试图加载格式不正确的程序(异常来自 HRESULT:0x8007000B)

本机64位,C#WPF 工程调用了 C++编译的32位的DLL文件,C++及C# 工程都是按X86 32位编译的。另外我用VS2015 自带的dumpbin.exe 工具查看过调用的DLL,以及C#编译后的exe所依耐的DLL文件,已经全部拷贝打包过来了的。
图片说明
图片说明

程序在VS2015里编译调试运行都正常。编译后在本地安装运行也正常。但是把这个程序拿到其他64位机器上安装正常,运行报错。

图片说明
图片说明

有懂的大神帮忙看下是什么原因导致的,万分感谢!
报错详细信息如下:
未处理 System.BadImageFormatException
HResult=-2147024885
Message=试图加载格式不正确的程序。 (异常来自 HRESULT:0x8007000B)
Source=EsunnyQuoteMonitor
StackTrace:
在 EsunnyQuoteMonitor.Quote.ITapQuotUnit.CreateQuotAPIHander(TapAPIApplicationInfo& appInfo, Int32& iResult)
在 EsunnyQuoteMonitor.Quote.ITapQuoteOnUnit.SetNotify(String ip, Int32 prot, TapAPIApplicationInfo& appInfo, Int32& iResult) 位置 D:\leon.long\workspaceC#\EsunnyQuoteMonitor\EsunnyQuoteMonitor\Quote\ITapQuoteOnUnit.cs:行号 27
在 EsunnyQuoteMonitor.Controller.TapQuoteController.LoginQuote(TapAPIQuoteLoginAuth tapAPIQuoteLoginAuth, String ip, Int32 port) 位置 D:\leon.long\workspaceC#\EsunnyQuoteMonitor\EsunnyQuoteMonitor\Controller\TapQuoteController.cs:行号 82
在 EsunnyQuoteMonitor.windowsforms.LoginQuoteFrame.btnLogin_Click(Object sender, RoutedEventArgs e) 位置 D:\leon.long\workspaceC#\EsunnyQuoteMonitor\EsunnyQuoteMonitor\WindowsForms\LoginQuoteFrame.xaml.cs:行号 71
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
在 System.Windows.Controls.Primitives.ButtonBase.OnClick()
在 System.Windows.Controls.Button.OnClick()
在 System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
在 System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
在 System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
在 System.Windows.Threading.Dispatcher.Run()
在 System.Windows.Application.RunDispatcher(Object ignore)
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run(Window window)
在 EsunnyQuoteMonitor.App.Main()
InnerException:

  • 写回答

2条回答

  • threenewbee 2019-07-24 17:06
    关注

    需要强制把程序编译为x86的,方法是在项目-属性里可以设置

    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题