Using ActiveX DLLs and forms

Hello,
I am in the process of creating my first ActiveX DLLs, and I have come across a problem.

From my normal startup form I activate my DLL, from which I display "Form2". I use this 2nd form to input a string, which is passed back to the main form.  

After unloading "Form2", I want to use the main form to msgbox this string that I have just input.  But I cannot make the msgbox appear, no matter what I try.  It would seem that using the DLL to display Form2 prevents me from using the msgbox afterwards.

I would really appreciate some code to correct the above problem.

Thanks,
TrimTrom
trimtromAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AjoyConnect With a Mentor Commented:
trimtrom,
This is exactly what i have understood from your first question.
Your second    detailed question    just confirms my view. Try the code what i had sent earlier and it should  work. This is  the      same problem i   had faced and     overcome it the same way mentioned.
TRy    it        out and  any   problem     anywhere let me        know.All  you have to take care(which   will seem  very obvious is that) you have  to Assign the content  of the  textbox  on form2 to  some variable in the code module    of form1 and then   unload form2.I  still don't understand where   your    problem is in implementing the way i had sent.

0
 
ongbpCommented:
Can U pls send me all your codes include the project file(*.vbp). i'm not quite sure how is your program been written. I can trace them & tell U what is wrong.
my email: ongbp@yahoo.com
0
 
AjoyCommented:
trimtrom,
This is very much possible. All you have to do is add a module to your DLL project.In this module have a procedure MAIN()
which you call in a method from class1.Let this procedure MAIN load n number of forms. Put this MAIN as startup for you DLL project(This is optional).
When you link this Dll to your project, create an object of that class and invoke the method of the class that invokes the Procedure MAIN.You can have the msgbox in your form1(of your DLL)
and it will work.
Trimtrom, since you are a beginner with Activex DLL i will just write some code that will help you get some regarding what i have said.In case you still have any problem then you can write to me at atarafder@hotmail.com , i would be glad to help you out.

This is your DLL          
MODULE1
========                                 class1
                                         =======
global frmName2 as string                method mShow()
sub main()                                    call main
  form2.show                             end
end

FORM2
=====
Form_click()
  frmName2 = inputbox("enter")
  form1.show
end

FORM1
======
form1_click()
   dim frmName1 as string
   frmname1 = frmName2
   unload form2
   msgbox frmName1
end    


in your project in which you are using your DLL
===============================================
dim obj1 as new class1
form_load or any other event of your choice
   obj1.mShow
end
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
trimtromAuthor Commented:
It seems that I have explained badly.  Here is a second explanation:

I have two projects, one which is a standard EXE(client), and one which is an ActiveX DLL (server).

1. STANDARD  This is a normal project which loads Form 1, and calls DLLPROJECT.
2. DLLPROJECT.  This is an ActiveX DLL project which loads Form 2, and places it in front of Form1.

I then input a string into a textbox on Form 2.  What I then want to do is unload Form 2, thus redisplaying Form1.  I  want to activate Form 1, and send out a msgbox from it saying what was input into Form 2.

My problem is that after I have unloaded Form 2, I cannot send out a Form 1 msgbox, saying what the Form 2 string was.  The msgbox just disappears.  As you can see, the very fact that I have called the DLLPROJECT seems to disable the Form1 already displayed by the STANDARD project.

I would be very grateful for any explanations and code regarding this,

Sincerely,
TrimTrom
0
 
MikeReillyCommented:
Sounds like form1 isn't activated when the dll unloads.  How are you getting the message back to the exe file?  Are you using a raise events or a callback?  If so, what is the code you are using?  It really helps if we see the source.
0
 
AjoyCommented:
trimtrom,
thanks for the points. Any problem further down in any 3-tier C/S application do let me know. i Would be very glad to help you.
ajoy

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.