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
Solved

Using ActiveX DLLs and forms

Posted on 1998-06-22
6
185 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

856 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