ActiveX DLL

Posted on 1998-11-07
Medium Priority
Last Modified: 2010-04-30

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!
Question by:hpet
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
  • 3
  • 2
  • 2

Accepted Solution

david_levine earned 200 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:
LVL 15

Expert Comment

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.

Author Comment

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!
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 15

Expert Comment

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!


Expert Comment

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.

Author Comment

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.


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

LVL 15

Expert Comment

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)

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
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…
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…
Suggested Courses

649 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