VB omnipotent 5: Creating "standard" DLL dynamic link library files (2)

Source: Internet
Author: User
VB omnipotent 5: Creating "standard" DLL dynamic link library files (2)  -- Author: bell Blog: http://blog.csdn.net/useway Yesterday we talked about how to get the OBJ file through special methods. Today we will continue to talk about how to compile the connection. Previous yesterday: http://blog.csdn.net/useway/archive/2010/04/14/5487046.aspx 1. First, let's take a look at the operation preparation steps for this special method: Step 1:Create a fake ingress link.exe "; create a new project, create a" form "in that project, and then add the following code in" form ": Sub form_load () msgbox "Now you can copy the OBJ file !! "
End
End sub Compilation: link.exe Step 2:Change "C:/program files/Microsoft Visual Studio/vb98/link.exe”to “link2.exe "; Step 3:Copy the fake link.exe file to "C:/program files/Microsoft Visual Studio/vb98 /". Create an ActiveX DLL Step 1:Create a new project, select "ActiveX dll", and create a "module". Add the following code to the Code: function fun1 (byval A as long, byval B as long) as long
Fun1 = a + B
End Function

Function fun2 () as long
Fun2 = 1
End FunctionStep 2:Create an empty "class ";Step 3:Compile with VB menu;Step 4:Copy the OBJ file. A dialog box is displayed during compilation:Step 5:Quickly copy the three new files in this folder. The three files are class1.obj, module1.obj, and project1.obj, respectively, and copy these files to the "C:/ABC" folder.Iii. Compile and connectStep 1:Create a BAT file with the following content: cd c:/program files/Microsoft Visual Studio/vb98
Link2.exe "C:/ABC/class1.obj" "C:/ABC/module1.obj" "C:/ABC/project1.obj" "D: /program files/Microsoft Visual Studio/vb98/vbaexe6.lib "/entry :__ VBAs/export: fun1/export: fun2/out:" C:/ABC/projectok. DLL "/base: 0x11000000/subsystem: Windows, 4.0/versStep 2:Copy the BAT file to "C:/ABC"Step 3:Execute the BAT file in C:/ABC to generate the DLL file "projectok. dll" in the folder.4. Now let's test it.Create a new project, create a "form", add two buttons, and paste the following code in "form": declare function fun1 lib "projectok. DLL "(byval A as long, byval B as long) as long
Declare function fun2 lib "projectok. dll" () as long

Sub commandementclick () msgbox fun1 (100,200)
End sub

Sub command2_click () msgbox fun2 ()
End sub, test it, haha, success !...Java programmers:
Preface,Directory
Zhuo Yue network sales Link
China-Pub sales Link
Dangdang sales LinkCommemorative post on "Java programmer, work day"

Download an electronic version of "Java programmers at work"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.