Results 1 to 8 of 8

Thread: ActiveX DLL with forms

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Angry

    Hi,
    I want to create a ActiveX DLL that also has a form in it.
    So far, I keep getting some strange error messages. I want to be able to load a form from the ActiveX DLL that allows to user to enter data, that's all. Similar to a plugins used by Winamp. All I need are the basics. I know how to add a form to the ActiveX DLL as Design Time but I don't know how to use it at Runtime

    any help or suggestions.

    [Edited by omarswan on 05-24-2000 at 08:04 AM]
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    You need to write a wrapper class, a form is not visible from outside the dll, so you'll need to write a class which will expose the stuff you want to a calling application.
    I use it for a general search window to search in a database and it works fine (even passing a parentform for the form works pretty well...)
    Hope this helps

    Crazy D

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Exclamation I don't want to be a bother.

    Hi,
    Thanks for your reply. Do you have a simple exaple that you could give to me (code).

    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Unhappy Can someone offer me some help

    Can someone offer me some help
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  5. #5
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Originally posted by omarswan
    Can someone offer me some help
    Your request slipped off the top page so I thought I'd move it back up.

    I think by wrapper class CrazyD means write a class with a public function or get property and have the class load your form as you would normally load it.

    In an activeX dll, if a class or componant object doesn't call the form it won't load.

    Is that what you meant CrazyD?

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  6. #6
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Forgot to check ;-)

    Yeah the class as I wrote it has a few functions, one of them is show, to uhmm show the form. I return a boolean from that function, since my form is either "selected a record" or "cancelled". Also a few functions to init my form.
    Declare an instance of your form in the class (eg Private m_frm as MyForm), and use m_frm to load and show the form. Note though that if you want to assign a parent form, it's a but of a pain. From within VB, I had to write a 2nd show function which doesn't have a parentobject as parameter (the original one had), but basically your class might look something like:

    Code:
    Private m_frm as MyForm
    
    Private Sub Class_Initialize()
        Set m_frm = New MyForm
        Load m_frm
    End Sub
    Private Sub Class_Terminate()
        unload m_frm
    Set m_frm = Nothing
    End Sub
    
    Public Property Let Caption(ByVal New_Caption As String)
        m_frm.Caption = New_Caption
    End Property
    Public Property Get Caption() As String
        Caption = m_frm.Caption
    End Propert
    
    Public Sub ShowForm(ByRef pParent As Object)
        m_frm.Show vbModal, pParent
    End Sub
    Depending on what you want you can add some fun stuff (passing Me (the class) to the form, so the form can call some Friend functions etc. to handle certain things, but basically it's kinda like above.
    Hope this helps.
    Hope this helps

    Crazy D

  7. #7
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Thumbs up

    Nice piece of code CrazyD

    Think I'll borrow it!




    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Smile Thanks Guys

    Thanks Alot Guys
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

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