Solved

Making a program in modules

Posted on 1998-01-27
23
169 Views
Last Modified: 2010-04-04
Hi,

I don't know how this is called or if it even exists, but I want to know for sure. This is what I want to accomplish :
- I wrote a program that collects data and sends it to a remote computer.
- In the future it's possible that other programs have to be written to collect other data, but have to be send to the same computer.
- All the programs, will use the same sending protocol, the same input (serial port & keyboard) etc. The only difference will be the layout and the interpretation of the collected data. The data is stored to a file.
- What I want to make (in the future) is : a program, which is capable of getting the data from the serial port and sending a file to a remote computer. Next to this, I want to make different modules. These modules display the data in there own way. (Get the serial data input from the main program, send the be sended file to the main program).
- BUT! Not all computers need all modules. Sometimes, after a few months, years, the computer need a module, or new written modules become available. So these modules have to be linked to the main program in some way, without recompiling the main program for every different computer.
What I mean with this is, that a site buys a module. And this module can be put into the main program by a way of installing. It even can be removed (updated version of a module).

I know this is a lot to read, but is it possible, is it already archieved? Does there exists information of. Has somebody done this already? Can somebody just give me some clues?

I know it aren't much points, but they can raise depending on the comments or answers.

PLEASE : for this question, give comments!
0
Comment
Question by:ZifNab
  • 9
  • 8
  • 5
  • +1
23 Comments
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
Hi

If I understand you, then: Yes, I did a similar thing like this:

Each time the main program (let's call it Main.exe) loads it reads entries from the registry.  Each entry is the name of an OLE automation object (in a DLL) which supports an interface that Main.exe understands.

Thus to add a new module you have to write a new automation object, register it in the registry (so that the class string is valid) and add an entry to the registry that Main.exe's will read.  The next time Main.exe starts it will read the new OLE class string and load the new module.

You don't have to use OLE.  The registry entries which Main.exe reads could be the paths to DLLs which are not OLE automation servers.  Each DLL could have known functions which Main.exe can call...

If this is not too clear I can send you an example.

JB
0
 
LVL 8

Author Comment

by:ZifNab
Comment Utility
Pfew, I thought to go to DLL's, but this is more than I thought! I'm not an expert so I could use some help by an example. Please, if you can send it to me (Tom.Deprez@uz.kuleuven.ac.be) I would be very gratefull. Thanks a lot. If you need more points, just say hwo much. And I'll see how much I can give.
You are really an expert, with lots of experience. What do you do?
Regards, Zif.
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
I have sent you a sample app.  Let me know if you get it.

Regards,
JB
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
P.S.  The points are fine as is.
0
 
LVL 8

Author Comment

by:ZifNab
Comment Utility
I've received the example! Thanks a lot. I'm going to give it a closer look if I 've some time. Hope you'll help me then too.
But thanks, you are a real expert. You may answer the question, now are later.
Regards,
Zif.
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
I'll answer the question now, but you can answer it after you have had a look at the sample.

JB
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
If this example works it's just great!
btw, can you please send it also to bosism@netvision.nt.il ?

I also thought thought of PhotoShop and 3DS :), it looks like they don't always use dll first of all, and second is that I'm not sure they use the system registery.

Are you sure you can't do it the easy way?
I mean create a file (INI) which your app will read, and depending on what's inside it, it will load the modules needed from dll's.
The modules should access data in a predefined structure, on which you have to decide very carefully for the future.

Do you have a dificult data structure within your project?

Well, taht's what I had in my mind right now, hope it can lead you to some ideas :)
I'll keep thinking!

Matvey

PS: maybe all I wrote is the same as the comment above, it's all really abstract :-)

And JimBob, I don't think it's a good idea to answere the question right now, because other experts might have smth to say, so...
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
Matvey:  I sent the sample to you.  You could use INI files, or even another method, but the registry is just a sample way.

You are right: the data & methods have to be carefully planned for what you might need in the future.

Also, DLLs is just one method.  You could probably use the same concept in many different ways.  The sample I sent you & Zifnab uses DLL function calls.  You could rework it to use OLE.  Or IPC.  Or etc...

Also, you may be right about more comments from other experts.  Zifnab should leave the question for a while, or even reject my answer...

JB
0
 
LVL 8

Author Comment

by:ZifNab
Comment Utility
Ok, for the moment I'll reject, but I 've examined JimBob's example and it works, very well. So, if nobody gives a really better answer than JimBob, then he may answer again.

I know release the question, so any other expert can give comments, ask questions, give solutions about this subject. When a question is in the 'still waiting answers' more experts jump on it.

PS. What is IPC?

JimBob, thanks already for the example and I promise you, you'll get the points you earned!
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
Hi

IPC stands for Inter-Process Communication, i.e. how diffrent apps can communicate with each other.  Delphi comes with a good IPC demo in Delphi\Demos\IpcDemos with a Main app (Monitor.exe) and a whole lot of client apps.  There are advantages & disadvantages to this approach.  I usually use IPC if the clients are stand-alone exe's that must communicate with a "master" app.  I don't use IPC in this way if there is one exe with plug-ins (i.e. the plug-ins are NOT stand-alone).

There are so many ways of doing something.  Different methods have different strengths/weaknesses...

JB
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
JimBob, very sorry, but haven't recieved it -don't know why!
Could you please try again to:

bosism@NetVision.net.il (Matvaey)

or to

Msoft@netmedia.net.il

ZifNab, could you tell what do you plan to put in those add-ons you will make in the future?
Maybe you can send each client just the recompiled EXE? Is this simple way not compatiable with your project?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 8

Author Comment

by:ZifNab
Comment Utility
What the add-ons do:

Let assume I have to collect data with a machine.
Machine is always same, but what it has to collect isn't.

Let say we use machine to check different machines :
 eg. Car, Truck, Bicycle.

Not every client has a car, truck or bicycle, some have all, others have two, others have only one of the three.

They all have to collect the data with the same machine and have to send the data with a same way (email, modem,...)

Some day, maybe client buys a truck, then he needs module for collecting truck, ...

0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
So, let's say... If you have 3 (or howmuchever) RPEDEFINED types, then you can create 3 versions of you project and send updates when needed.
The real need for add-ons occures when you don't have PREDEFINED types, like PhotoShop filters. You see, they all have a data source - the selected image part, and when they run the create output, or chenge the selected image.
If I understand you right, what you have is just three diferent types of program that work with 3 different systems, but with similar data, and similar exchange system, so isn't it possiple to get rid of the need for addons?

I might have missunderstood your needs, sorry, if so could you explain again?

Matvey
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
Hi Matvey

I got a msg yesterday saying: "Returned mail: Host unknown"

I have sent the sample again (to both e-mail addresses you supplied).

JB
0
 
LVL 8

Author Comment

by:ZifNab
Comment Utility
I don't want that one centre needs to use 3 different programs (start up) if  it's possible to make it in one, with all the same behavier. The people who have to use my program aren't so good with computers (if I say then, start this icon, and select from the menu which machine you want to read out) Also this way, it's possible to combine several datafiles and send them in one time. Not possible with three different programs.
The three different data only display the data different. And I don't want that one centre can send data from a machine they don't have, so I needed to find a way to add on some sort of 'forms' depending on the machines they got.
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Hmmm, I've a clearer idea:
Yo send dlls with some sort of predefined name like Zif.*.dll, nevermind, in a every dll you have a standart command like Zif_Execute, and then your program checks for any dlls of this type that were copied to the dir of your project and calls this command. The proccess that will be executed will read the standart data and display whatever it has to display.
It might work... and if it will then it will be easier for both the users and you!

Good luck!
Matvey

0
 
LVL 8

Author Comment

by:ZifNab
Comment Utility
Isn't this the same as JimBob has told me?
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Well, I guess it's almost the same. I wasn't at home at that moment, so I haven't recieved the demo then.
Now I looked at the demo and it works just FINE. And it does not really metters what way you find those dlls and their functions. It's not hard eather!

Thanks JimBob! That was a lesson for me also, because I never had a need to do things with add-ons!
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
You're welcome.  As I said before, there are many ways to do things.  The sample was just a small look at one method...

0
 
LVL 1

Expert Comment

by:millerw
Comment Utility
I just saw your question, Tom, and I have "kind of" done something  like it.  However, I used OBJECTS/CLASSES.  What you can do is create a base class that will be the ancestor of all your other classes.  This base class has the basic calls that are needed--Like Execute, Retrieve, Display, Calculate, Etc.  Then just derive a child of it and redefine all of those methods to be specific to the Car, Truck, Bike.  

All of these can be saved to a file that can be added to by installation programs.  I've never done it, but in theory it is supposed to work.  I'm currently researching this for that parser we were talking about before.

I'll keep you posted,
Scott
0
 
LVL 8

Author Comment

by:ZifNab
Comment Utility
Hi JimBob, I think you can answer the question again. No reaction of other people.
Regards, Zif.
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 20 total points
Comment Utility
Ok.  Just to recap, I sent ZifNab a sample with DLLs interfacing with a main EXE.

JB
0
 
LVL 8

Author Comment

by:ZifNab
Comment Utility
Thanks again.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

11 Experts available now in Live!

Get 1:1 Help Now