Generally, EXE files created with Delphi are larger than EXE files created with another programming language. The reason is the VCL. (Sure, VCL has many advantages...)

 

There are several ways to reduce a EXE's size:

 

01) Use a EXE-Packer (UPX, ASPack,...)

02) Use KOL.

03) Write your application without VCL

04) Use the ACL (API Controls Library)

05) Use StripReloc.

06) Deactivate remote debugging information and TD32.

07) You might want to put code in a dll.

08) Don't put the same images several times on a form. Load them at runtime.

09) Use compressed images (JPG and not BMP)

10) Store less properties in DFM files

(See Link below "How To Make Your EXE's Lighter")

 

11) Use the TStringList replacement by ~LOM~

Use the Minireg - TRegistry replacement by Ben Hochstrasser

 

 Data segment too large error

 

Typed constants are added to the Program's data segment. Untyped constants are added to the code segment of the application only if they are used. Unless you are going to reassign the value of a typed constant, you should use an untyped constant instead. Typed constants should be replaced with initialized variables to be compatible with future versions of the compiler.

 

Example:

Code:

{This adds the constant to the data segment}

const SomeTypedString : string = 'Test';

const SomeTypedInt : integer = 5;

 

{This adds the constant to the code segment if used}

const SomeUnTypedString = 'Test';

const SomeUnTypedInt = 5;

 

 

I receive an "Interface is not supported" error when trying to use an interface.

 

Verify that STDVCL32.DLL and your type library are registered. If casting an interface, you must be using DCOM and the type library must be registered on the client.

Delphi's online help documentation seems to miss the run-time error codes. I usually looked them up in my old Borland Pascal for Windows help file - now they are here for fast access:

 

1        Invalid function number        

2        File not found        

3        Path not found        

4        Too many open files        

5        File access denied        

6        Invalid file handle        

12        Invalid file access code        

15        Invalid drive number        

16        Cannot remove current directory        

17        Cannot rename across drives        

100        Disk read error        

101        Disk write error        

102        File not assigned        

103        File not open        

104        File not open for input        

105        File not open for output        

106        Invalid numeric format        

200        Division by zero        

201        Range check error        

202        Stack overflow error        

203        Heap overflow error        

204        Invalid pointer operation        

205        Floating point overflow        

206        Floating point underflow        

207        Invalid floating point operation        

210        Object not initialized        

211        Call to abstract method        

212        Stream registration error        

213        Collection index out of range        

214        Collection overflow error        

215        Arithmetic overflow error        

216        General protection fault        

 


Взято с сайтаhttps://www.delphifaq.com

The error is usually caused because the server can't be located. Make sure you can ping the server machine using the string you typed into the ComputerName property of the TRemoteServer. You might also want to try using an IP address instead in case there is some problem with your DNS configuration or the hosts file. Try setting the "Default Authentication Level" to (Run DCOMCNFG on the server to do this.) Lastly, check the Microsoft Developer's Network on the Web for the latest information on this Microsoft transport. The MSDN can be located at the time of the writing at www.microsoft.com/msdn.

 

When I try to add a resource to my project's .res file, I get a "Duplicate Resource" error when linking. The resource I have added is a unique resource. How can I successfully add the resource to my project?

 

 

The projects resource file is generated by the IDE wizard, and is not intended to be modified. To add additional resources to your project, create a separate resource file with a unique name that does not conflict with either the project or any of  the unit names. Then to add the resource file to Delphi, simply add the following line to any unit file in the project:

 

{$R MyRes.Res}

 

(where MyRes.Res is the name of the resource file).

 

To add the resource to Borland's C++ Builder, add the resource

from the project manager.

 

Stack Overflow, Runtime error 202

Simply put, stack overflows are caused by putting too much on the stack. Usually, they are caused by recursive procedures that never end. A good example would be creating an event handler for the TMemo's onChange event, and making a change to the Memo during the processing of the event. Every time the OnChange event gets fired, another change is made, so the OnChange event gets fired again in an almost endless loop. The loop finally ends when the stack overflows, and the application crashes.

 

Here is an example of a recursive procedure:

 

Code:

procedure RecursiveBlowTheStack;

begin

RecursiveBlowTheStack;

end;

 

Sometimes, a stack overflow is caused by too many large procedures. Each procedure calls another procedure, until the stack simply overflows. This can be remidied by breaking up large procedures into smaller ones. A good rule of thumb in regard to a procedures size is if the procedure's source code takes up more than a screen, its time to break it down into smaller procedures.

 

Перед тем как Дельфи сможет использовать любые ActiveX/COM (в том числе и ADO компоненты) должна быть выполнена строка Application.Initialize - которая инициализирует использование COM. Если пишется DLL или консольное приложение, которые не имеют объекта Application, то надо просто добавить в Uses ещё один модуль: "oleauto"

HKEY_CURRENT_USER\Software\Borland\Delphi\4.0\Debugging

 

ViewCPUOnException=0

This usually occurs when you move a project to another drive or directory. Simply deleting the project's .DSM and .DSK files should remedy the situation.

 

Code:

Try

{здесь вы пишите код в котором может произойти ошибка}

Except

{здесь вы пишите код который выполнится если ошибка произойдёт, если ошибки не будет то этот код не выполняется}

End

 

Вот как будет выполняться код: