Solved

MDI - DLL

Posted on 2004-09-10
9
415 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Filemaker 14 vs Delphi Embarcadero 7 186
Syntax Check Delphi Seattle IOS app without MAC ? 1 92
code issue 8 100
Strange behavior when a form is closed 6 51
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 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

17 Experts available now in Live!

Get 1:1 Help Now