c# - 使用 dll 文件在我的应用程序 delphi 中出错
问题描述
我在 C# 中有使用 Z339xLib.dll 文件的库代码,代码是:
#region Assembly Z339xLib.dll, v4.0.30319
// C:\Documents and Settings\Hytham\Desktop\Software Protocol n Image Capture SDK_New\Software Protocol n Image Capture SDK\Z339x_SDK_Sample\Z339x_SDK_Sample\bin\Debug\Z339xLib.dll
#endregion
using System;
using System.Drawing;
namespace Z339xLib
{
public class Z339xLibSdk
{
public Z339xLibSdk();
public bool GetImageAndSaveFile(string portname, string filename, int type);
public Bitmap GetImageByBitmap(string portname);
public string SearchDevice_VCOM();
}
}
我需要将此代码转换为 delphi 编程,我在 delphi 中创建一个代码,如下所示:
unit Z339xLib_Sdk;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,Controls,Dialogs,
StdCtrls, ExtCtrls;
Const Z339xLibSdk = 'Z339xLib.dll';
function GetImageAndSaveFile(hport:WideString;ImageDir:WideString;Imagetype:integer): boolean; stdcall;external Z339xLibSdk;
function GetImageByBitmap(hport:WideString): BITMAP; stdcall;external Z339xLibSdk;
function SearchDevice_VCOM : string; stdcall;external Z339xLibSdk;
implementation
end.
调用函数时出现错误:
应用程序未能正确初始化(0xc000007b)
请任何帮助或我的 syantex 代码有任何问题。
这是对功能的解释:
Function bool GetImageAndSaveFile(String Port_Name, String File_Name, int Format);
Parameters String Port_Name = Virual Com Port Name(ex. COM1…).
Or you can just use “AUTO” as a serial port name, system will automatic search the device.
String File_Name A string that contains the name of the file to which to save this Image.
int Format Image Format
0: png
1:bmp
2:Jpeg
3:Tiff
Return values True: Success
False: error occurred.
感谢您的帮助
解决方案
推荐阅读
- amazon-web-services - 如何在aws ec2上以开发模式运行apache超集
- excel - VBA,处理 E-10
- react-native - React Native 将一个组件插入到另一个组件中
- google-sheets-formula - 谷歌表格 - 通过相关下拉查询订单
- ios - Swift - App Store Connect 版本无法检测 Catalyst 环境
- c# - 爱普生ip打印机打印后插入剪切线
- r - dplyr 总结()
- angular - CurtainsJS GSAP WebGL 列表项鼠标悬停问题
- python - 缺少 1 个必需的位置参数:函数中的“次”
- python - 类型错误:_append_dispatcher()