Solved

ActiveX DLL

Posted on 1998-11-07
7
307 Views
Last Modified: 2010-04-30
Hi,

i am trying to learn something on how to make programs modular (in VB). So i came to ActiveX controls.
Now i would like (if possible) make some EXE with an MDIForm as main form. On a command this MDIForm would call ActiveX DLL (with its own interface) and this would run in as child of calling MDIForm.

Like: MDIForm ->calls ActiveX DLL with some form saying "Hello"  (this form runs in as a child).

I would appriciate some help on it..

Thank you!
0
Comment
Question by:hpet
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Accepted Solution

by:
david_levine earned 50 total points
ID: 1443750
You can make VB modular without creating ActiveX controls. I feel ActiveX controls would be useful if you wanted to share functionality across many applications. An example would be reading a proprietary database which you would want to do in many applications.

For just making an application modular, you should look at defining your own classes within a VB program and encapsulating the code within that class.

But regardless, if you are just looking for a way to create a simple OCX, check out the following:
http://msdn.microsoft.com/vbasic/downloads/download.asp?ID=082
http://msdn.microsoft.com/vbasic/technical/articles/create/default.asp
0
 
LVL 15

Expert Comment

by:ameba
ID: 1443751
You cannot do that (have MDIChild form in DLL).
It is possible to use SetParent API to have a DLL form as child of MDIForm, but this will only create problems (sizing, re-seting parent...).
Best you can do for your MDI-idea: Create OCX that will have all controls needed for your MDI-Child form.
In your main program load MDI-Child form with your ActiveX on it, or in VB6 you can use AddControls to dinamically add your Control to the form.
0
 
LVL 1

Author Comment

by:hpet
ID: 1443752
Why am i thinking about ActiveX DLL:
first i would like to appologise because english is not my first language so i may not set
or explained my problem well.
I will build my question on example.
Let's assume i have an application that is made from many little "sub applications".
Those subapplications can more or less do their job on their own.
Those subapplications may not neccerly be present. (some may missing etc)
Those subapplications can be added to main program later on...

I don't have clear picture of classes, but i think with david_levine's solution i am still limited
to one final EXE? or am i wrong?
I just wish i would have one EXE there and some different type of files (not self executive), like DLL's that may be present or not. What you can do with main app depends on what kind of subapps (DLL's) you have present.

Why i want to use parent and child is just the idea with which i would like to enclose everything in one "window".

So i think ameba's solution is more what i expected as an answer... but still if david_levine can explain me just a bit more on what encapsulating classes means?

Thanks for your help!
0
What Is Threat Intelligence?

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

 
LVL 15

Expert Comment

by:ameba
ID: 1443753
Please, don't get me wrong. I said what is possible, but this is not recommended (meaning it is not simple).It is easier to use modules. You should NOT INSIST on DLL-modularity for everything. There are only few situations to have dll-s. Example is 3-tier database applications: UI is in EXE, bussiness rules are in one dll and one dll is on the server, near database.
The other reasons can be team development or functional reasons.
So, try creating OCX-es for binary reuse and modules for source reuse.
Again, don't go too deep with "total reuse" - it is very expensive and benefits are not great. VB changes very often, APIs cannot be reused in new OS,... Be warned!

0
 
LVL 9

Expert Comment

by:david_levine
ID: 1443754
Yes, with classes/modules, they are included into the final executable. Shouldn't be a problem. I'm not sure why you don't want that.

To compare this strategy to other environments, in cobol it would be a copybook, in C a header file or another module. Same kind of thing. The final executable contains the code.

You can reuse the modules as totally seperate entities if you create them as standalone and encapsulate all the functionality in them. Re-use is as simple as including the module in another program and calling it.

Also, I'll certainly agree with ameba's Total Reuse statement.. it's very expensive (time) and the benefits are not that great. If you are going to do something more then once in multiple applications, then creating for re-use could be justified. Many times, you can create a module in the same amount of time regardless of whether you are specifically coding for re-use or just to encapsulate the data/logic. In other instances, it's a significant effort to do so. As an example, if you are creating an output file to feed another system/program, why would you want to make that a re-useable module? It's only for that one specific program to create a file another program can read. If you are going to feed 20 programs, maybe you would look at making a generic extract program that reads a set of parameters to create the file, in which case on the parameter file changes for the 19 other programs, but it's a huge effort to do the generic program, in this case, vs the very specific and non-reusable code.

What are you trying to decide on now? In your original question, you asked about help in creating ActiveX controls.
0
 
LVL 1

Author Comment

by:hpet
ID: 1443755
Ok, thank you both very much on your efford trying to help me...

Why am i stucked to ActiveX DLL's?
Why don't i want modules?
I will give you a specific example and then you two tell me how would
you solve this in most simple and efficiant way.
Let's say we have an accounting application.
Accounting app. includes many so called subapplications (like book keeping,
diary, etc etc).
Let's say we have a main app that is above all this.
You can call subapps from there, you can set security parameters for subapps
from there etc etc.

NOW

When customer gets the software it depends on them what all they will take.
For example: I wish to take only book keeping... BUT!! later on i might want
diary too!...
Now, we don't want to compile everything all over again do we?
Why wouldn't we just copy this needed files and show main app. what is new
and customer can use this additional software in no time!

Like: MainApp ----- Book keeping    |
                            Diary                |- kind of add-ons
                            Cashier            |
                            etc                   |

Why an MDI... it is just question of visual look.. (but not neccery)

(i don't know english terms for accounting topics.. I hope you understand)

Anyway, I'm student of computer science so we are getting some projects
and we must find solutions to it... and since it is interesting to me i am
so noisy. I hope you don't mind...

Thanks a lot

0
 
LVL 15

Expert Comment

by:ameba
ID: 1443756
I would suggest SDI model for your modular-application. It is the only practical.
If you need MDI, you should use 1 big compiled app. When customer buys "Diary module", you shoud enable this in your app.
Using "MDI and dlls for MDIChild usage" is possible, but this is pure theoretical or academic (read inpractical, expensive)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now