Home > Software engineering >  VB production standard DLL containing custom data type parameters
VB production standard DLL containing custom data type parameters

Time:10-02

The search on the net, know how to use vb production standard DLL, but now I want to do the standard DLL is a custom data types of passing parameters, could you tell me how to do this the DLL, thanks to the great spirit guide,
PS: VC is not, it will only a bit of VB,

CodePudding user response:

VB produced by the so-called "standard" DLL, can only be called by VB program, can't be other language program calls,

The principle of making standard DLL is that by replacing the parameters of the linker, let the linker will standard module functions as export output, but because of VB is closed source, no one can really change the VB compiler and runtime, and VB program, no matter DLL or exe need the support of the VB virtual machine, even native code,

"Standard" DLL written in VB, because still rely on VB virtual machine, and lack the necessary initialization, so I can't run normally, unless call DLL is VB program, because before this, VB virtual machine has been initialized by the program,

CodePudding user response:

In a word, using VB to make the so-called standard DLL is meaningless, and suggest that you do not waste time here,

CodePudding user response:

Yes, I will only a little VB, do the DLL using VB to call, can you do? Do Active DLL, written in the standard module functions, compile time is can't use a custom type as a parameter, how to do?

CodePudding user response:

Normal writing have what problem

CodePudding user response:

reference 4 floor wy24789 response:
normal writing have what problem?

For example, new ActiveX DLL, first in the class module
Type Student
The Name As String
ID As String
Sex As a Boolean
End Type
In the standard module
The Public Function FindStudent (ByRef AStudent As Student)
AStudent. Name="Mike"
AStudent. ID="10000"
AStudent. Sex=1
End the Function
Compiler to generate standard DLL, UDCDll. DLL, and then a new EXE, in a standard module
Type Student
The Name As String
ID As String
Sex As a Boolean
End Type
Public Declare Function FindStudent Lib "C: \ Program Files \ Microsoft Visual Studio \ VB98 \ UDCDll DLL" (ByRef AStudent As Student)
In the form
Private Sub Command1_Click ()
Dim ABC As Student
Call FindStudent (ABC)
Label1. Caption=ABC. Name
Label2. Caption=ABC. ID
Label3. Caption=ABC. Sex
End Sub
Run time click on the button, what error message and run results all have no, VB window directly is turned off,
I VB very vegetables, do not know where there's a problem, also please give directions, thank you.

CodePudding user response:

Can take a look at this attachment use (I didn't try)
http://download.csdn.net/download/dsq2006/1763933

CodePudding user response:

Baidu vb_dll_link try

CodePudding user response:

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any Source, As Any, Optional ByVal Length As Long=4)
Public Declare Function FindStudent Lib "C: \ Program Files \ Microsoft Visual Studio \ VB98 \ UDCDll DLL" (Byval AStudent As long)
Dim ABC As Student
Dim p1 as long
CopyMemory p1, byval varptr (ABC), 4
FindStudent p1
Have a try

CodePudding user response:


For example, new ActiveX DLL, first in the class module

Type Student
The Name As String
ID As String
Sex As a Boolean
End Type

In the standard module
The Public Function FindStudent (ByRef AStudent As Student)
AStudent. Name="Mike"
AStudent. ID="10000"
AStudent. Sex=1
End the Function

Define your own type and type of utility function called cannot in the same project in
The solution has two:
A, split into two engineering
Engineering to define A type B after A reference project, can use all types of custom in A

Two, modify the function definition, the Public prefix removed (the actual into private) or "ByRef AStudent As Student" such direct definition type changed to "ByRef AStudent As the Variant" does not affect the function using the

CodePudding user response:

If it's just a DLL, need to learn the contents of vc + + is not much, can take two hours,

CodePudding user response:

Using mixed programming, VB6, VS winner-take-all, with good VS design DLL, soft after communication with one another in the message mechanism for parameters

CodePudding user response:

What do you think I this VB write standard DLL call by other language? Try to talk again
http://download.csdn.net/detail/taoguangye/3913144
  •  Tags:  
  • API
  • Related