Home Forums HTBasic Forum DLL help

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4984
    ZeRider
    Participant

    Hi,
    Could someone help me translate this C++ code with DLL into HTBasic ?

    1/ The C++ original is :

    SESSION sessionID; /// Handles current session
    DWORD cardNum; /// Card’s logical number
    char ID_String[100]; /// Holds string of a card

    /// The Function obtains identification string of a specified card
    /// The function retrievs information of card’s “Model name, serialNum, firmwareRevisison”
    status = PIPLX_CardId(sessionID, cardNum, ID_String, sizeof(ID_String));

    2/ My actual HTBasic nonfunctional translate is :

    LONG Status
    LONG Session
    LONG Card
    INTEGER Size

    DIM Data$(1:100)[1] ! <— I think the issue is on these 2 parameters …
    Size=SIZE(Data$,1) ! =100
    !
    DLL GET “STDCALL LONG Piplx_w32:_PIPLX_CardId@16” AS “Identity”
    Status=FNIdentity((Session),(Card),Data$(1),(Size))

    #4993
    ZeRider
    Participant

    Here is the function description, if that could help …

    PIPLX_CardId

    unsigned long PIPLX_CardId (long session, unsigned long cardNumber, char cardID[], unsigned long length);

    Purpose
    Obtains the identification string of the specified card. The string contains these elements:
    “model code;serial number;revision code”
    The <revision code> value represents the hardware version of the unit – cards have no firmware on-board.

    Parameters

    Session/ Type/ Description
    Input/ long /Handle of current session.

    cardNumber/ Type/ Description
    Input/ unsigned long/ Card number.

    length/ Type/ Description
    Input/ unsigned long/ Length of character string buffer.

    CardID/ Type/ Description
    Output/ char []/ Identification string of the specified card. The string contains these elements:
    “model code;serial number;revision code”
    The <revision code> value represents the hardware version of the unit – cards have no firmware on-board.

    Return Value/ Type/ Description
    Return/ unsigned long/ Zero for success, or no-zero error code.

    • This reply was modified 6 days, 4 hours ago by ZeRider.
    #4995
    ZeRider
    Participant

    Solution found !!!

    Size=100
    ALLOCATE Data$[Size]
    !
    DLL GET “STDCALL LONG Piplx_w32:_PIPLX_CardId@16” AS “Identity”
    Status=FNIdentity((Session),(Card),Data$,(Size))

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.