Solved

Using ActiveX DLLs and forms

Posted on 1998-06-22
6
182 Views
Last Modified: 2010-05-03
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
0
Comment
Question by:trimtrom
6 Comments
 

Expert Comment

by:ongbp
ID: 1464011
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
 

Expert Comment

by:Ajoy
ID: 1464012
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
 

Author Comment

by:trimtrom
ID: 1464013
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:MikeReilly
ID: 1464014
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
 

Accepted Solution

by:
Ajoy earned 100 total points
ID: 1464015
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
 

Expert Comment

by:Ajoy
ID: 1464016
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 42
How to debug this code 7 56
Access 2013 combo box not working 3 38
Create Files based on Cell Values in a Range in Excel 12 20
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now