【发布时间】:2017-09-29 20:04:54
【问题描述】:
我是 C# 和 Visual Studio 的新手。我搜索了这个问题并找到了一些有趣的答案,但它们似乎都不起作用。
情况是这样的:我有一个 TPV 示例源,它本身应该没问题,我使用 Visual Studio 2015 从 32 位 Windows 7 使用选项 Release 编译它/x86,它的目标是在 64 位 Windows 7 上工作。应用程序打开,但是当我要使用某些功能(例如打开现金抽屉或其他依赖于外围设备的特殊事件)时,它会抛出一个框,说它有一个错误,并且可以继续忽略错误(这会保持应用程序正在运行但忽略有关这些外围事件的请愿书)或退出。这是它给我的额外信息:
这是个例外:
System.DllNotFoundException:无法加载 DLL 'toggle_Cd.dll':找不到指定的模块。 (来自 HRESULT 的异常:0x8007007E) 在 Elo_Proj.cashDrawerPopup._tmain() 在 C:\Users\usuario\Documents\TPV\PayPoint Windows\Sample Source\Elo_Paypoint_Windows_App_Source_Code\Elo_Paypoint_Windows_App_Source_Code\Elo_Proj_prj\cashDrawerPopup.cs:line 106 中的 Elo_Proj.cashDrawerPopup.cashDrawerPopup_Load(Object sender, EventArgs e) 在 System.Windows.Forms.Form.OnLoad(EventArgs e) 在 System.Windows.Forms.Form.OnCreateControl() 在 System.Windows.Forms.Control.CreateControl(布尔 fIgnoreVisible) 在 System.Windows.Forms.Control.CreateControl() 在 System.Windows.Forms.Control.WmShowWindow(消息和 m) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 System.Windows.Forms.ScrollableControl.WndProc(消息和 m) 在 System.Windows.Forms.Form.WmShowWindow(消息和 m) 在 System.Windows.Forms.Form.WndProc(消息和 m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
除了我认为在这里不是特别相关的程序集信息。我试图寻找Exception from HRESULT: 0x8007007E,但找不到合适的解决方案。我还寻找了toggle_Cd.dll,但我对如何处理它一无所知。我试图将它添加到 64 位机器中 dll windows32 的路径中,并将其直接添加到可执行文件的同一文件夹中,但我想这不是它的工作原理。
在此先感谢,对于我对语言、程序和操作系统缺乏经验,我深表歉意。
【问题讨论】:
-
如何加载toggle_Cd.dll?
-
这是
toggle_Cd.dll的来源吗? -
查看异常消息似乎
toggle_Cd.dll是一个COM 库。所以你需要注册它(使用 regsvr32.exe),或者,更好的是,安装供应商的可再分发包...... -
对于程序集注册,您可以查看此答案:stackoverflow.com/questions/19401873/run-time-error-440-vb6/…
-
你在这里超出了你的深度。
_tmain()是控制台模式程序的入口点。一个exe,而不是dll,大概只是你编译的示例程序。考虑使用 Process 类来减少痛点。
标签: c# windows dll visual-studio-2015