Results 1 to 4 of 4

Thread: Making A GUID BASED DLL

Threaded View

  1. #3
    Hyperactive Member umilmi81's Avatar
    Join Date
    Sep 2005
    Location
    Sterling Heights, Mi.
    Posts
    335

    Re: Making A GUID BASED DLL

    Ok, there are two ways you can do it.

    1) If your forms are standalone. Meaning they are all by themselves. Self contained.

    Start VB, and start an "Active X DLL" project. Right click on the project and say "Add new Form". Then just design your form as normal.

    In the Class portion of the dll make a sub called ShowMyForm or something like that. Then set your form to visible. Then just hide it when the form is done doing it's work.

    VB Code:
    1. Public Sub ShowCustomForm
    2.   Form1.Visible=True
    3. End Sub

    All the things in the form inside the DLL will not be visible to programs that actually USE the DLL. But they are visible to the class that makes up the DLL.

    So you can make properties for everything you want to expose to the calling program.

    Like say you have a checkbox on the form inside your DLL. You could do this in your class

    VB Code:
    1. Public Property Get FormsCheckBox() as Boolean
    2.       If Form1.Checkbox1.Value = True Then
    3.            FormsCheckBox = True
    4.       Else
    5.            FormsCheckBox = False
    6.       End If
    7. 'Written just to demoncstrate code in Propery.  It could easily have been just:
    8. '  FormsCheckBox = Form1.Checkbox1.Value
    9. End Property
    Or lets say you wanted to set a property on that form. Like the title of the form
    VB Code:
    1. Public Property Let FormTitle(Value as String)
    2.   Form1.Caption = Value
    3. End Property

    Then in the calling application, you would have access to those methods of the class. You will have to include your DLL in the Project->References menu.

    VB Code:
    1. Dim MyClass As YourClass
    2. Set MyClass = New YourClass
    3.  
    4. MyClass.ShowCustomForm
    5. If MyClass.FormsCheckBox = True Then
    6.  'Do Something
    7. End If
    8. MyClass.FormTitle = "Testing123"

    You will also have to register the DLL on any system that uses it. But the Package and Deployment Wizard helps you make the setup programs needed.


    Now if you want to make a standard set of controls that are linked in some way, and put them on various forms in the future. Then you want to select the "ActiveX Control" project type at VB startup.

    These are more difficult to do, but really cool
    Last edited by umilmi81; Nov 25th, 2005 at 08:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width