Solved

MDI - DLL

Posted on 2004-09-10
9
414 Views
Last Modified: 2010-04-04
I am loading MDI from DLL, but Tab Key not working for control.

Why & What is solution.
0
Comment
Question by:smartvanl5
  • 4
  • 3
  • 2
9 Comments
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12028126
I have seen this question answered a lot throughout the years... and I haven't seen an answer, neither have I tried (never needed)... the closest thing to an answer (from several TeamB members) I have seen is this:

"Dll's have their own copies of the Application object and other VCL global
objects.  If you instead switched to packages this would all go away.  That is a
main reason packages were developed in the first place.  Build both your app and
the package with packages and you won't have these problems."

what version of Delphi are you using? this problem arised when switching from Delphi 4 to 5, I don't know if it still exists in 7...
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12028371
I meant "I have seen this question asked..."
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12028467
I've had to deal with this problem too and never found a solution. You have a similar problem when you're adding ActiveForms to your application. AFAIK, this seems to be a flaw in the way Delphi applications have been designed and it's probably never going to be solved. My solution was a nasty hack, though. Just add one more control to your MDI form. Make it as small as possible and whenever it gets focus, send an event to the owner of the form to focus a control on the mainform...

But that solution I don't have available anymore... :-(
0
 

Author Comment

by:smartvanl5
ID: 12028552
I am using Delphi 7, My requirement is make EXE file as small as possible and split the application in form of DLLs.

Is there any other solutions or Component available which can be use for same.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:smartvanl5
ID: 12029182
BlackTigerX,

Can you show some example for specified solution.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12036122
Don't put the forms in the DLL's. Put the business logic in the DLL's. The forms are just for the user interface so all they have to do is display stuff.
0
 

Author Comment

by:smartvanl5
ID: 12042923
But what about the validation and database connections. It has to put with the forms
0
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 50 total points
ID: 12044702
Not really... Even that logic can be arranged from the DLL's, albeit a bit more complicated than you're used to do. The biggest problems with DLL's is keeping track of all the memory management, worrying about where memory is allocated and making sure it gets freed propertly again. Which is why I like to use lots of interfaces while working with DLL's. (Thus, many methods in my DLL's return an interface, not a class.) With interfaces memory gets allocated and deallocated in the proper context/location.

But remember also that you might decrease the size of the executable, your whole application just becomes bigger because of the additional DLL's. An executable size between 1 and 2 megabytes isn't unusual. Paint Shop Pro 8, for example, is almost 6 megabytes in size for the main executable alone. And a lot more for all the separate DLL's. Dividing a project in multiple DLL's just to keep the main executable small isn't a good solution. (Because the gain you get from the smaller EXE is lost again by the size of the DLL's...)

If you want to make the executable smaller, you could consider using a TClientDataset (Midas) instead. Then the real database logic could be moved to a separate DLL. And that's a start for creating multi-tier applications. Or replace Midas with ADO, using TADODatasets only in your project, that connect to a DLL that provides the recordsets to your executable. Basically, it means splitting the business logic from the user interface.

It is possible to create very small executables, though. Unfortunately this means you cannot use the Delphi VCL in your code. A new console unit that doesn't use any units will be around 20 KB. If you include the SysUtils unit, it grows to about 45 KB. Add the Classes unit instead and it grows to almost 100 kb. If you include just the forms unit, and not one other unit, your executable will already be around the 300 KB, basically doing nothing. It's most likely that you've included DBTables in your project, somewhere, thus your exe is a minimum size between 500 and 600 KB...
One way to reduce the size is by checking the uses clause of all your own sources and remove those units that you don't use. With a bit of luck, this will save on some additional overhead. Problem with Delphi is if you add some component to a form, save the project, then remove the component, the unit of this component will still be listed amonst the other units, adding more bytes to the final exe. Remove it, check if the code still works and you could save quite a few bytes.

Having all your forms in one exe will increase it's size, true. But if you can keep all other logic outside of these forms, you can keep the main exe a lot smaller.

One question, though. Why are you so concerned about having a small executable?
0
 

Author Comment

by:smartvanl5
ID: 12052622
Hi Workshop_Alex,

Thanks a lot, for giving me all the detail information, I want to create very big Financial Package, which includes different modules, I was first like to DLL to split my project in different modules like plugin but MDI not working properly.

I already created a Financial Software but it executable is very big approx. 15 MB so my of my clients complaines that the software takes time to execute and even on LAN it is taking too much time as I was using PARADOX database, Now I am using MYSQL and MYDACSQL component to access database.

So I am more convern about EXE size and spliting application in small modules which work like plugins.

If you have any other good suggession or idea about spliting project in moduls, kindly share with me.

Thanks & Regards,
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

24 Experts available now in Live!

Get 1:1 Help Now