Call the DLL developed in the VC environment in the VB application

zhaozj2021-02-11  249

Call the VC environment to develop applications in VB DLL Author: Dingjun Jian Published: 2001/01/03

Thesis:

This paper discusses the issues of DLL entry points, array parameters, and summarizes how to call the DLL developed in the VC environment in the VB application. Keywords: DLL, VB, VC

text:

The DLL developed in the VC environment in the VC environment 1. Call DLL's superior dynamic link library (DLL) as the foundation of the Windows operating system, with superior application performance: DLL extends the feature of the application. Since the DLL can dynamically load the address space of the process, the application can determine what to do at runtime and then load the corresponding code to perform these operations as needed. DLL can be written in a variety of languages. For example, use VB to write an interface interface, and use C to prepare a underlying operation such as an algorithm and communication. DLL simplifies the management of software projects. If different working groups work in different modules during software development, then this project is easier. DLL helps save memory. If two or more applications use the same DLL, the DLL page will share all of its pages as long as the page is placed in RAM. DLL helps resources for resources. The DLL can include resources such as dialog templates, strings, icons, and bitmaps, and multiple applications can use DLL to share these resources. The DLL helps the application's localization. For example, an application containing only code without including a user interface component, can load a DLL containing a localized user interface component. The DLL helps to solve the platform difference. Different versions of Windows are equipped with different functions, developers often want to call new functions. However, if the source code contains calls to a new function, the application will run on a Windows version that cannot provide the function, then the operating system's loader will reject the process. If these new functions are saved in the DLL, the application can be successfully called on the old version of Windows to successfully call the function. 2. Users who find DLL's entry point for the first time to contact DLL often encounter a problem: DLL created in the VC environment, running in the VC, but when they call in the VB application, it will always appear "call agreement errors". "Finding the entry point" and the like. This is mainly caused by the following omissions. First, pay attention to the functions in the DLL and the function declaration in the VB must be exactly the same in the name, return type, parameter type, parameter number, etc., especially pay attention to the problem. Second, an inlet function must be added in the DLL. DEF file. Finally, you must add externaln "c" before the function definition, _ stdcall keyword. Specific formats can be found in the application example. 3. The transfer of array parameters in the DLL is often used by DLLs to perform some underlying arithmetic operations, so applications often need to pass a large amount of data to the DLL. In C , the pointer is the best choice for array operation, but there is no concept of pointer in VB. This usually can be solved in two ways. First, when DLL is declared in VB, use Byref instead of ByVal, you can pass the array pointer to the DLL. In addition, the array is declared as a variant type (VARIANT), you can pass the array to the DLL directly. 4. Application Example The process of calling the DLL created in the VC environment in VB is described below by an example. Create a DLL, "SigPro.dll" for signal processing, where there is a function "Fourier" for the calculation of Fushan.

转载请注明原文地址:https://www.9cbs.com/read-4991.html

New Post(0)