Home > Software engineering >  Please expert guidance, about VB DLL function parameters contained in the structure of the method st
Please expert guidance, about VB DLL function parameters contained in the structure of the method st

Time:10-07

Have following DLL function
Int __stdcall misposTrans (void * input, void * output)
And two structure
 typedef struct 
{
Char TransType [2].//order
Char FuncID [4].//branch feature script ID
Char TransAmount [12].//transaction
Char TipAmount [12].//tip amount
Char TransDate [8].//transaction date

Char MisTraceNo [6].//MIS serial number
Char CardNo [19].//trading card number

} ST_MISPOS_IN;
Typedef struct
{
Char TransType [2].//order
Char CardNo [19].//trading card number
Char Amount [12].//transaction
Char TipAmount [12].//tip amount
Char TransTime [6].//time

Char TransDate [8].//transaction date
Char ExpDate [4].//card validity
Char track 1 [37].//the second track information
Char Track3 [104].//three track information
Char ReferNo [8].//system to retrieve the number

Char AuthNo [6]. No.//authorization
Char RspCode [2].//return code
Char TerminalId [15].//trading terminal number
Char MerchantId [12]. No.//trade merchants
Char YLMerchantId [15]. No.//unionpay merchants

Char InstallmentTimes [2].//stage nper
Char TCData [256].//IC card data
Char MerchantNameEng [50].//English merchant name
Char MerchantNameChs [40].//Chinese merchant name
Char TerminalTraceNo [6].//terminal serial number

Char TerminalBatchNo [6].//terminal batch number
Char IcCardId [4].//IC card serial number
Char BankName [20].//issuer name
?
} ST_MISPOS_OUT;


How do you want this in VB, please directly statement

CodePudding user response:

Your structure type, the members are all char array,
In VB6, and with a byte array to definition,
Just don't know will there be "byte alignment problem,"

CodePudding user response:

Look, with an array of bytes and problem,,

CodePudding user response:

Use VC or other tools to produce a TLB, can avoid the byte alignment problem,

CodePudding user response:

For this, there is also a comparison of BT in VB method, can solve the problem of alignment:
Two parameters, respectively with a sufficient length of an array of bytes to receive all content;
Then, use MidB () function, to the "component" interception,
Because no matter how DLLS there with alignment, each member of the "starting point" is fixed,
Specific starting from how many bytes, VB call it once, to check the results returned to know,

CodePudding user response:

Can indeed, but BT to look,

CodePudding user response:

Use the custom of "byte array" type,
You also have to deal with one by one again!
In essence is not saved,

CodePudding user response:

All I see is a type char, there is no problem of alignment, turn head, a try, just, in the VB BYTE is used more troublesome, can in C, the structure into a character, then to the VB can be good,

CodePudding user response:

Don't be A language code is modified to B language code busywork,
Also don't use A language code to directly invoke B language code base, this complicated things so easy to get wrong,
Just make A, B language code of input and output is redirected to A text file, or modify A, B language code let it through text file input and output,
Can easily make A, B coordination between the two languages,
For example:
A will request data written to A file a.t xt, renamed after finish aa. TXT
B find aa. TXT, read its contents, call the corresponding function, and writes the results file b.t xt, after finish delete aa. TXT, changed its name to bb. TXT
Found A bb. TXT, read the content, after finish delete bb. TXT
Above can be replaced by any kind of A language or development environment, B can be replaced by any kind of with the development of A different language or development environment,
Unless A or B does not support to determine whether A file exists, file read and write and file name,
But who can name does not support to determine whether a file exists, file read and write and file name for the development of language or development environment?
  •  Tags:  
  • API
  • Related