Solved

Using ActiveX DLLs and forms

Posted on 1998-06-22
6
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 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