We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


ActiveX DLL

hpet asked
Medium Priority
Last Modified: 2020-04-13

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!
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)

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.


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!

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!

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.


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.


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

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)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.