Помогите Перевести Код С Ms_v_c++ На Delphi

Тема в разделе "Другие задачи", создана пользователем ClockRu, 5 мар 2012.

  1. ClockRu

    ClockRu New Member

    Регистрация:
    5 мар 2012
    Сообщения:
    1
    Симпатии:
    0
    Код (C++):
    struct app_packet_header
    {
    short app_packet_length;
    short app_command;
    };

    /* definitions for functions */

    LINKDLL void * OpenComPort(const char *ComPort, const char *Baudrate);
    LINKDLL unsigned short CloseComPort(void *hCom);
    LINKDLL void * GetHandle(short ComPortNumber);
    LINKDLL void Make_command(struct app_packet_header *packet_adress, unsigned short command);
    LINKDLL void Make_command_vb(char *packet_adress, unsigned short command);
    LINKDLL void Append_parameter(struct app_packet_header *packet_adress, char *parameter_adress, int parameter_length, int type);
    LINKDLL void Append_parameter_vb(char *packet_adress, char *parameter_adress, int parameter_length, int type);
    LINKDLL unsigned short Get_command ( struct app_packet_header *app_packet);
    LINKDLL unsigned short Get_command_vb (char *app_packet);
    LINKDLL int Get_length ( struct app_packet_header *app_packet);
    LINKDLL int Get_length_vb ( char *app_packet);
    LINKDLL int Get_parameter ( struct app_packet_header *pck_adr, int par_num, char *(*par_adr), int *par_length);
    LINKDLL int Get_parameter_vb ( char *pck_adr, int par_num, char *(*par_adr), int *par_length);
    LINKDLL int Count_parameters ( struct app_packet_header *pck_adr );
    LINKDLL int Count_parameters_vb ( char *pck_adr );
    LINKDLL unsigned short Send_receive(unsigned char *Cmd, unsigned char *Resp, short MaxLength, void* hCom);
    LINKDLL void SetAsync_event_func(async_event_func_pointer lpasync_event_func);
    LINKDLL async_event_func_pointer GetAsync_event_func(void);
    LINKDLL char * GetSwVersion(void);
    LINKDLL void SetRspTimeOutSec(unsigned short NewTimeOut);
    LINKDLL unsigned short GetRspTimeOutSec(void);
    LINKDLL void TraceText(int level,char*format,...);
    LINKDLL void TraceInit(char *traceFileName, int traceFileMaxSize);
    LINKDLL void SetTraceLevel(unsigned char tracingLevel);

    LINKDLL int Wait_kb( char * packet, unsigned int timeout);
    LINKDLL int Init_kb_interface ( void );
    помогите кто может....................

    Добавлено: я перевёл часть кода, но не назнаю правильно или нет:

    Код (Delphi):
     type Ta_p_h = record
    app_packet_length : short;
    app_command : short;
    end;
    Код (Delphi):
    function OpenComPort(ComPort, Baudrate: PChar):THandle; cdecl; external 'EPPAPI_1.dll';
    function GetSwVersion(): PChar;cdecl; external 'EPPAPI_1.dll';
    function CloseComPort(ComH : THandle): integer;cdecl; external 'EPPAPI_1.dll';
    function Wait_kb(text:PChar; timeout:integer): integer; cdecl; external 'EPPAPI_1.dll';
    function Init_kb_interface(): integer;cdecl; external 'EPPAPI_1.dll';
    procedure Make_command(APH : Ta_p_h; command : short);cdecl; external 'EPPAPI_1.dll';
    function Send_receive(cmd,resp : PChar; MaxLength : short; hCom : THandle): short; cdecl; external 'EPPAPI_1.dll';
    function Get_command(var APH : Ta_p_h): short; cdecl; external 'EPPAPI_1.dll';
    function Get_parameter(var APH : Ta_p_h; par_num : integer; par_adr: PChar; par_len:integer): integer; cdecl; external 'EPPAPI_1.dll';
    function Get_parameter_vb(pck_adr :Pchar; par_num : integer; par_adr: PChar; par_len:integer): integer; cdecl; external 'EPPAPI_1.dll';
    procedure Append_parameter(var APH : Ta_p_h; var regname : PChar; len: integer; types : integer);cdecl; external 'EPPAPI_1.dll';
     
Загрузка...

Поделиться этой страницей