Ошибка в моем приложении delphi с использованием файла dll - PullRequest
1 голос
/ 01 августа 2020

У меня есть код библиотеки в 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 code.

и это объясняет функцию:

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.

спасибо за вашу помощь

...