Home > Software engineering >  Vb6 call DLL
Vb6 call DLL

Time:10-09

'========name GS_Interface. DLL===how statements and call the function=====
The File Type: DLL

Section contains the following exports for GS_Interface. DLL

0 characteristics
0 time date stamp Thu Jan 01 08:00:00 1970
0.00 version
1 the ordinal base
18 the number of functions provides
18 the number of names

The ordinal hint RVA name

8 0 001477 d4 BatchFeeDetail_H
2 1 00147810 CallManInfo
1 2 00147 a60 CallManList
18 March 001476 d0 CheckNet
May 4, 001477 e8 ChgFacAndBed
16 May 001476 ec DelDetail_M
October 6, 001477 ac DelFeeDetail_H
3 July 00147754 DelRegister
September 8, 001477 c0 FeeDetail_H
15 September 00147700 FeeDetail_M
17 A 001476 d8 ManRegister_M
11 B 00147740 ManRegister_Z
13 C 0014772 C OutCurtain_M
6 D 0014777 c OutFeeCurtain
7 E 00147794 PreCurtain_H
14 F 00147714 PreCurtain_M
4 to 10 001477 fc RtnCurtain
12 November 00147768 RtnTicket

The Summary

1000. The adata
2000. Aspack
1000. The edata
3000. The idata
15000. Reloc
1 a000. RSRC
2000 BSS
148000 CODE
The DATA of 4000

'============================

CodePudding user response:

Declaration process DLL


Although Visual Basic in Win32api. TXT offers a wide range of predefined statement, but still need to know how to write a statement personally, for example, sometimes want to access the DLL written in other languages in the process, or rewrite the Visual Basic predefined statement, in order to meet the special needs,

To Declare a DLL process, need to be in the "declaration" section of the code window to add a Declare statement, if return a value, the process should be declared as Function:

Declare the Function publicname Lib "libname" [Alias "Alias"] [([[ByVal] variable [As type], [[ByVal] variable [As type]]...])] As type

If no return value, it can be declared as Sub:

Declare Sub publicname Lib "libname" [Alias "Alias"] [([[ByVal] variable [As type], [[ByVal] variable [As type]]...]]]

By default, in the standard module declaration process of DLL is public, you can call it anywhere in the application, in the process of other types of modules are defined in the DLL module is Private, must be declared Private in front of their keywords, distinguished by the,

In 32-bit Visual Basic procedure name is case-sensitive, 16 before version, the procedure name is case-insensitive,

Details please refer to the "online manual" in "" statements," in the language reference "

Specify the library
Declare statement in the Lib clause to tell how Visual Basic find contain process. The DLL file, if the reference process belongs to the Windows core library (User32, Kernel32 or GDI32), you can not include file extensions:

Declare the Function GetTickCount Lib "kernel32 Alias" _
"GetTickCount () As" Long

For other DLLS, Lib clause of the specified file path:

Declare the Function lzCopy Lib "c: \ Windows \ lzexpand DLL" _
(ByVal S As an Integer, ByVal D As an Integer) As Long

If you do not specify the path of the libname, Visual Basic will consult the files according to the following order:

.exe files in the directory


In the current directory


The Windows System directory (usually a \ Windows \ System)


Windows directory (not necessarily \ Windows)


The Path environment variable in the directory
In the table below lists the common operating system environment library files,

Dynamic link library description
Senior Advapi32. DLL API service, support a lot of API (including many safety and registered call)
Comdlg32. General dialog DLL API library
Gdi32. DLL graphics device interface API library
Kernel32. DLL Windows 32-bit core API support
Lz32. DLL 32-bit compression routines
Mpr. DLL interface more routers library
Netapi32. DLL 32-bit network API library
Shell32. DLL 32-bit Shell API library
User32. DLL user interface example Cheng Ku
Version. DLL Version library
Winmm. DLL Windows multimedia library
Winspool. DRV spooled interface, including spooled API calls,


Using a string of Windows API process
If the calling Windows API process to use the string, then declare statement must add an Alias clause, to specify the correct character set that contains the string of Windows API function actually has two formats: ANSI and Unicode, therefore, in the Windows header files, each containing a string of functions with ANSI and Unicode versions at the same time,

For example, the following are two SetWindowText function of C language description, you can see, the first to describe the function defined as SetWindowTextA, at the end of the "A" indicates that it is an ANSI function:

WINUSERAPI
BOOL
WINAPI
SetWindowTextA (
The HWND HWND,
LPCSTR lpString);

The second description defines it as SetWindowTextW, "W" at the end of the show that it is a Unicode functions:

WINUSERAPI
BOOL
WINAPI
SetWindowTextW (
The HWND HWND,
LPCWSTR lpString);

Because the two functions are not to be "SetWindowText" the name of the actual, to reference the correct function it has to add an Alias clause:

Private Declare Function SetWindowText Lib "user32" _
Alias "SetWindowTextA" (ByVal HWND As Long, ByVal _
LpString As Long As String)

Please note that Alias clause at the back of the string must be the true name of the process, and must be case-sensitive,

Key for the use of API functions in Visual Basic, you should specify the functions of the ANSI version, because only support Unicode version, Windows NT and Windows 95 does not support this version, only when the application runs only on Windows NT platform can be used only when the Unicode version of

Using value or reference
By default, Visual Basic to pass all parameter reference way, this means that did not pass the actual parameter values, Visual Basic only transmit a 32-bit address data, the Declare statement does not require contains ByRef keyword, but if you include the keywords, can clear that in what way the data transfer,

Many DLL process requires parameters passed in value way, which means that they need the actual data, rather than the data memory address, if the process needs to pass a value parameter, and passed to its argument is a pointer, then can get the wrong data, the process does not work properly,

To make the parameters by using the value transfer, in front of the parameter declaration is needed in the Declare statement plus ByVal keyword, for example, the first parameter InvertRect process required to use value, and the second using a reference:

Declare the Function InvertRect Lib "user32 Alias" _
"InvertRectA" (ByVal HDC As Long, _
LpRect As Long As the RECT)

Can also be used in the calling process ByVal keyword,

Pay attention to in the process of view using C language syntax DLL document, please remember to pass by value C array parameters,

String argument is a special case, if the string passed in using value way, then pass the string will be in the first data byte address; If using a reference way to pass a string, then the actual delivery will be used to hold another address of memory units; Behind the "address" is actually the first of a string of data bytes of memory address, later in this chapter help topic "the string to a DLL process" explains how to determine the string parameter passing the right way,

Don't have standard name
Sometimes, the name of the individual process of DLL is not a valid identifier, for example, it may contain illegal characters (e.g., a hyphen), or the name is a Visual Basic keyword (e.g., GetObject), in this case, you can use the Alias keyword,

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • API
  • Related