CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2000
    Location
    Canada
    Posts
    59

    DLL's Have Form's ??

    I was told to create a ActiveX dll that has a form with certain information on it. He said create a new ActiveX dll project and add a form.
    That was easy but when I execute the project something weird happens. No sub main exists. So in the class that the dll gives you I inserted a sub main. Nothing works.

    Any help???


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: DLL's Have Form's ??

    yap, no sub main in the class but Sub Initialize as declare like this :

    Private Sub Class_Initialize()

    where Class is your class name.

    HTH

    cksiow
    http://vblib.virtualave.net - share our codes


  3. #3
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: DLL's Have Form's ??

    In order to use your DLL, you will need a Client Project that uses your DLL. You create your DLL then start a new project and, using PRoject/References menu item, you gain access to your DLL. Your DLL can have a Form but it must be activated by your DLL once the Client form gains access to it and begins using it. Doesn't make much sense so here is another attempt to explain.
    Create your DLL so it looks something like this

    Project1
    Class1
    Class2
    Form1
    Module
    etc



    Compile your Dll.
    Then start a new project. Using Project/References find your DLL and add it to the list of available references for this project.
    Somewhere in the new project, do this

    Dim somevarname as MYDLL

    Set somevarname = New MYDLL

    you then have access to your DLL. In your DLL is some function that will do a FORM1.Show which allows your DLL to display its From.
    Below is a sample I have that uses a DLL of Mine called "PageManager".
    '
    '
    PageManager is a Class within my DLL. To construct and debug this mess, I created a Group that looks like this.


    PrintPreview ' This is my DLL (Project1)
    frmPreview
    modGlobal
    Page ' Class module
    PageManager ' Class module
    Project2 ' Client Project
    frmTest
    modTest
    '
    '
    ' This code is in frmTest
    option Explicit
    Dim o_Preview as PageManager
    private Sub Command1_Click()
    set o_Preview = new PageManager
    With o_Preview
    .AddPage
    End With
    End Sub
    '
    private Sub Form_Unload(Cancel as Integer)
    set o_Preview = nothing
    End Sub



    '
    '
    Project2 is what starts off the whole mess and receives control when you hit F5 (Run). In frmTest I have the code listed above.

    John G

  4. #4
    Join Date
    Dec 2000
    Location
    Canada
    Posts
    59

    Re: DLL's Have Form's ??

    Thank You
    I got that figured.
    Now I have a client app that calls my dll.
    My dll has a show_form function. It displays my new form from my dll class. Now I have all this user information. How do I give it back to my client app that called my dll.

    Thank you


  5. #5
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: DLL's Have Form's ??

    Well, you can have public PROPERTIES/VARIABLES that hold the information entered by user in your DLL. This way, your client will be able to access that once user finishes entering information in your DLL.

    -Cool Bizs

    Good Luck,
    -Cool Bizs

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

Featured