Click to See Complete Forum and Search --> : DLL's Have Form's ??


Raistlin
May 10th, 2001, 05:32 PM
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???

cksiow
May 10th, 2001, 07:24 PM
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

John G Duffy
May 10th, 2001, 07:36 PM
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

Raistlin
May 11th, 2001, 03:34 PM
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

coolbiz
May 12th, 2001, 09:22 AM
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