Home > Software engineering >  For help, call DLL return wchart_t * how to do
For help, call DLL return wchart_t * how to do

Time:09-28

VB call c + + DLL return how to implement such as wchart_t wchart_t * * TagName (); Release calls when FreeString (wchart_t * pVal)
Not vb.net
How to call the DLL in vb

CodePudding user response:

Wchart_t * is "wide byte character pointer"!!!! Should be a string of 16 utf-8 encoded string data,
This API is also a return parameter represents the number of characters?

VB6 statement should be like this:
Private Declare Function TagName Lib "XXXX. DLL () as" long
Call, receive a Long variable with the return value,
To get the data, then use a byte array or String type variable, through the API copymemory () to copy,
If there is no "length" return parameter, or function of the interface, so it must be in the vbNullChar to mark the end of the (wchart_t should be used for two consecutive bytes 0),
Anyway, you should pay attention to in the copymemory () before the byte array or String variable, to "create a large enough data area!" "
Receive TagName () returns the value of the variable, is to use Byval form passed to copymemory,

CodePudding user response:

There is a problem of the operating system filetime in VB how to display in the text box

CodePudding user response:

reference 1/f, a toast to invite the bright moon response:
wchart_t * is "wide byte character pointer"!!!! Should be a string of 16 utf-8 encoded string data,
This API is also a return parameter represents the number of characters?

VB6 statement should be like this:
Private Declare Function TagName Lib "XXXX. DLL () as" long
Call, receive a Long variable with the return value,
To get the data, then use a byte array or String type variable, through the API copymemory () to copy,
If there is no "length" return parameter, or function of the interface, so it must be in the vbNullChar to mark the end of the (wchart_t should be used for two consecutive bytes 0),
Anyway, you should pay attention to in the copymemory () before the byte array or String variable, to "create a large enough data area!" "
Receive TagName () returns the value of the variable, is to use Byval form passed to copymemory,

Just like what you said, I use strcpy

CodePudding user response:

Use strcpy should also be able to achieve the effect,
But also must pay attention to the "opening large enough data area in advance,"

CodePudding user response:

refer to the second floor yuan_hs_hf response:
there is a problem of the operating system filetime in VB how to display in the text box

Private Declare Sub GetSystemTimeAsFileTime Lib "Kernel32" (ByRef lpSystemTimeAsFileTime As FILETIME)

CodePudding user response:

reference yuan_hs_hf reply: 3/f
Quote: reference 1/f, a toast to invite the bright moon response:
wchart_t * is "wide byte character pointer"!!!! Should be a string of 16 utf-8 encoded string data,
This API is also a return parameter represents the number of characters?

VB6 statement should be like this:
Private Declare Function TagName Lib "XXXX. DLL () as" long
Call, receive a Long variable with the return value,
To get the data, then use a byte array or String type variable, through the API copymemory () to copy,
If there is no "length" return parameter, or function of the interface, so it must be in the vbNullChar to mark the end of the (wchart_t should be used for two consecutive bytes 0),
Anyway, you should pay attention to in the copymemory () before the byte array or String variable, to "create a large enough data area!" "
Receive TagName () returns the value of the variable, is to use Byval form passed to copymemory,

Told you about, I use strcpy

Think of A problem: strcpy is API version "A", you use it to copy data, incomplete string is likely to happen,
If 16 is utf-8 encoding, any standard ASCII characters of the second character is 0, so as long as the western character, it is considered a string has ended,
Only under the condition of the string does not contain standard ASCII characters only applicable,
Of course, if the wchart_t * points to the string is utf-8, strcpy can also be used to correct copy,
  •  Tags:  
  • API
  • Related