|
-
May 23rd, 2000, 06:55 PM
#1
Thread Starter
Addicted Member
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]
-
May 23rd, 2000, 07:31 PM
#2
Hyperactive Member
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...)
-
May 23rd, 2000, 07:38 PM
#3
Thread Starter
Addicted Member
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).
-
May 24th, 2000, 02:42 PM
#4
Thread Starter
Addicted Member
Can someone offer me some help
Can someone offer me some help
-
May 24th, 2000, 10:43 PM
#5
Fanatic Member
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!)
-
May 25th, 2000, 01:41 PM
#6
Hyperactive Member
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.
-
May 25th, 2000, 01:47 PM
#7
Fanatic Member
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!)
-
May 25th, 2000, 02:19 PM
#8
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|