Solved

Using ActiveX DLLs and forms

Posted on 1998-06-22
6
181 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

706 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

22 Experts available now in Live!

Get 1:1 Help Now