VB dynamically calls its own ActiveX DLL

Source: Internet
Author: User
Tags integer
active|activex| dynamic these days in pondering their own writing a Ms-office basic operation of the scoring system, of course, similar system has been a lot of: the National computer level of the secondary learning system, the local computer title examination system, The computer literacy system of colleges and universities, as well as some commercial and personal similar systems. So what are the characteristics of my scoring system?
This type of system. It is simply invoking MS's office class library and then using the various objects it provides to determine the operator's right and wrong. Development tools Preferred VB6.0, the development of high efficiency, the most important is that it and VBA itself is a home. The system framework uses the main program (EXE) plus an ActiveX DLL. The advantage is, the system develops well, the expansion is more convenient. You can add a quiz marking function at any time, such as adding a convenient feature to the word form. And, provide an interface, users can also follow the instructions to increase their own point of marking (make their own ActiveX DLL). The extended DLL name is customized, but you want to fill out the form to tell the main program that the class name is uniform.

Example:
Pclass.dll (ActiveX DLL, class name: Class1)
Public Function MyFunction (ByVal i As Integer) As Integer
myfunction= I
End Function

Main program Call:
Private Sub Command1_Click ()
On Error GoTo Errorhandle:
Dim obj as Object
Set obj = CreateObject ("Pclass.class1")
' Pclass is the name of the DLL, Class1 is the class name in Pclass.dll
' Note: not a module name
MsgBox Obj.myfunction (20)
Set obj = Nothing
Exit Sub
Errorhandle:
MsgBox Err.Description & "--Check the DLL file name, class name, registration, etc.!! "
Err.Clear
End Sub




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.