Solved

MDI - DLL

Posted on 2004-09-10
9
422 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 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