Home > Software engineering >  Could you tell me how great god VB6 call C DLL
Could you tell me how great god VB6 call C DLL

Time:11-19

VSkysoft. ADSYS. HTTelecontrollerControl a=new vSkysoft. ADSYS. HTTelecontrollerControl ();
String message=null;
String HT_SN=null;
String DSN=null;
List SNDatas=null;
Bool flag=false;
Atul gawande etSNFromMac (08 eb29f43d79, ref HT_SN, ref DSN);
Flag=a.C heckSerialNumberStatus (HT_SN out message, out SNDatas);
Thread.sleep (0);

Could you tell me how great god under VB call c + + to write the DLL?

CodePudding user response:

Look at my blog https://blog.csdn.net/supermanking/article/details/5347763

CodePudding user response:

reference 1st floor still human response:
take a look at my blog https://blog.csdn.net/supermanking/article/details/5347763
handsome boy I was a little don't understand, this is written by c #, how to cut with Vb, there are specific steps?

CodePudding user response:

Didn't know that you are not familiar with C language and VB, and the concept of dynamic libraries and apis, but in terms of VB, called dynamic link library is very simple, the statement can use the API function,
Statement dynamic library Function, statement of API can be global, local module can also be, if you want to Declare globally available API Function, you can create a new module, and then in a module with Public Declare statement Function, if you just want to a class or Windows using the API Function, then you are in the window or the top of the class files with Private Declare statement Function, Declare the rules are simple, if your API Function returns a value, then use the Function declaration, if there is no return value, using Sub statement, followed by the Function name (case), and then use the Lib "dynamic library file name or the full path to the specified dynamic library file, and then is parameterized, if return, plus the AS the return type is ok,
For example, wrote a called myapi. DLL dynamic link library, there are two API functions, C prototypes for:
Void _stdcall TestMy001 (BSTR in_string);
In_buff long _stdcall TestMy002 (BYTE * and * * out_buff BYTE);

Then in VB can be declared that these two functions:
Public Declare Sub TestMy001 Lib "myapi. DLL" (ByVal in_string As String)
Public Declare Function TestMy001 Lib "myapi. DLL" (ByRef in_buff As Any, ByRef out_buff As Any) As Long

If the compiler to ensure that the VB program can use the API functions, so when the installation program can copy the DLL to the Windows of the System32 directory, and also can be placed with the same path for executable files, otherwise you have to specify the full path to the use, such as:... Lib "c: \ DLL \ myapi DLL"...
As for the type of parameter and docking, general VC using BSTR docking VB type String, the C language pointer array type VB use ByRef and Any docking, if they are integer types, VB use ByVal and integer types and docking, if take an integer pointer type, VB use ByRef and integer types and docking, so roughly, the specific you have to use it more clear,

CodePudding user response:

The great god, see I do understand you wrote a lot of, thank you very much,
But I have a little don't understand is as c # al-qeada etsnfrommac this function how do I to vb down?

CodePudding user response:

reference 3 floor still human response:
don't know that you are not familiar with C language and VB, and the concept of dynamic libraries and apis, but in terms of VB, called dynamic link library is very simple, the statement can use the API function,
Statement dynamic library Function, statement of API can be global, local module can also be, if you want to Declare globally available API Function, you can create a new module, and then in a module with Public Declare statement Function, if you just want to a class or Windows using the API Function, then you are in the window or the top of the class files with Private Declare statement Function, Declare the rules are simple, if your API Function returns a value, then use the Function declaration, if there is no return value, using Sub statement, followed by the Function name (case), and then use the Lib "dynamic library file name or the full path to the specified dynamic library file, and then is parameterized, if return, plus the AS the return type is ok,
For example, wrote a called myapi. DLL dynamic link library, there are two API functions, C prototypes for:
Void _stdcall TestMy001 (BSTR in_string);
In_buff long _stdcall TestMy002 (BYTE * and * * out_buff BYTE);

Then in VB can be declared that these two functions:
Public Declare Sub TestMy001 Lib "myapi. DLL" (ByVal in_string As String)
Public Declare Function TestMy001 Lib "myapi. DLL" (ByRef in_buff As Any, ByRef out_buff As Any) As Long

If the compiler to ensure that the VB program can use the API functions, so when the installation program can copy the DLL to the Windows of the System32 directory, and also can be placed with the same path for executable files, otherwise you have to specify the full path to the use, such as:... Lib "c: \ DLL \ myapi DLL"...
As to the type of parameter and docking, general VC using BSTR docking VB type String, the C language pointer array types of VB with ByRef and Any docking, if they are integer types, VB use ByVal and integer types and docking, if take an integer pointer type, VB use ByRef and integer types and docking, so roughly, the specific you have to use it more clear,
great god see you write, I really learned a lot, but I couldn't make the brain there may be some, I don't know how I C # as above al-qeada etsnfrommac to VB down?
  •  Tags:  
  • VBA
  • Related