Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17



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

Why & What is solution.
Question by:smartvanl5
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
  • 4
  • 3
  • 2
LVL 13

Expert Comment

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...
LVL 13

Expert Comment

ID: 12028371
I meant "I have seen this question asked..."
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... :-(
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.


Author Comment

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.

Author Comment

ID: 12029182

Can you show some example for specified solution.
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.

Author Comment

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

Accepted Solution

Wim ten Brink earned 200 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?

Author Comment

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,

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 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