Android smartphone

2009-10-22

Delphi DLL

Author:Friend88

Delphi DLL


File an extension. DLL File is still more mysterious is the File that we dare not even own your own delete it certainly did not know that the Application of which must be used. Associated with it or what. If you accidentally deleted. May cause system performance or Application error, especially File. DLL in Windows Folder, then the DLL is what stands DLL Dynamic Linked Library is bringing both snippets Procedure and Function come together in a single File. we call this type that File Library.

It is a special DLL that is not an Application to Run as self-General Application, but it will wait act. Application programming services to sub for the other sub-programs run within the File DLL 2 format is possible.


1. Static Loading means that once the Application is running and running. Snippets from the File DLL File Load which will be used to keep forever.
2. Dynamic Loading means snippets from Load File DLL is only when they want to run sub-programs only.

When the pin mold package integrated run both models will see Static Loading a result, the Application does not work when no File DLL reference. Also, the behavior. At wasting memory space than it is to the desired Load all stored in memory before when some Function may be running in just a little time. However, it is stored. In memory without using any no.
However, Dynamic Loading is even more better in terms of user memory space. Effectively. have any more busy, but its use and make work behind. Operating system worse. Therefore choose to use depends on the size of a small Application is subject to Article Ka Static Loading to no speed. If the waste area slightly larger Application packet as we often must use Dynamic Loading already.

Top.
Advantages DLL.
For a DLL that has major advantages are as follows: 3 points.
1. To share the resources of the Ne system effectively. Let us consider why the program is 5 each with the same working Function. If each of File 500 KB in size, this means we lose the region to approximately 2.5 MB, but if we separate out the same as Function of working out the same. Used in packet
File, which allows the same area as if the packet into filtration microsurgery at work when a well is approximately 300 KB and that the resources will be 5 File Ns only 1.3 MB instead of 2.5 MB.
2. Easy to change. The work must be frequently changed. We tend to keep the changes in the File DLL because it allows us to edit easily. The only change that changes in the File DLL only more work and the frequent changes. Is used by many more Application should be stored in each Share File DLL and use.
3. Bringing recyclability. Bringing back a new or Reuse is important in the development process Software can program it. Large. SOI has a piece of small packet. By each sub-store may act Function J. bring it clear. Is the same concept to create a Component sure enough, just keep Function File DLL will help us take it that no new Function to write every time if ever existing. They use what is the best to all.

Top.
Creating DLL.

We will try to create a DLL to create step by using the Function Calculator way. Electronics and electric power on measuring voltage and resistance is the power we will see a 4 Function in the work associated with the following Sut.
E = IR.
I = E / R.
R = E / I.
P = EI.
E is the voltage with the attack is Volt.
I was a power failure is the Ampare.
R is the resistance to attack Ohm.
P is the power of the attack is Watt.
We begin to create a DLL 4 Function work out
.
Delphi Open menu File> New> Other ... When Dialog New Items up Click Select DLL Wizard, and then Click the OK button image.













Delphi Code Editor will display just to Application DLL only because there is no user interface is not shown in the Form Designer to the images.












Over time we will write that we need both Code 4 Function follows.












These pictures are from a point that there are 2 points Palace Gate is a Function with a stdcall suffix and point 2 is based on exports declared Application note and the other running from the name listed if we want. build. Function / Procedure in the DLL, but do not want to be running, we do not have to end with the line name Function stdcall application then do not add names. Function / Procedure. After the write command exports after bone MRI are paid will have to Compile a File DLL Function 4 Function in the DLL of us.

To understand more Download Sample Source Code Here.

Top.
Run a DLL and Static.

After we have created the DLL, then we will try to create Application Run DLL as we write more.
Open Delphi and create a new Project was designed as a Form layout.

Double Click a button calculate voltage and write Code to bring the information to complete the calculation by measuring voltage to run the Function EVolt File ElectronicsCal.dll. We have created the following.













For activation. Will be announced prior to the Function follows from DLL.


function EVolt(IVal,RVal : double) : double; stdcall;
external 'ElectronicsCal.dll';
function IAmpare(EVal,RVal : double) : double; stdcall;
external 'ElectronicsCal.dll';
function ROhm(EVal,IVal : double) : double; stdcall;
external 'ElectronicsCal.dll';
function PWatt(EVal,IVal : double) : double; stdcall;
external 'ElectronicsCal.dll';


For activation. Will be announced prior to the Function follows from DLL.

Top.
Running a DLL Dynamic.

Examples from the past. We run a Function of Static Loading DLL that is the way to Load Application Function or Procedure to remove it from the DLL from running at startup, so if the Application for File DLL not found. Will error. And not available. The run is a Static Loading preceded by words that specify the steps announced enternal Function.
Although Static Loading is easy to use. But there are disadvantages is that the Function and Procedure are Load in memory at all times when not being used in a Dynamic Loading at any time, so it will be more appropriate. But running is more difficult. It will be run from Windows, including more specific Function LoadLibrary, FreeLibrary and GetProcAddress.
To understand we will update the original Application to Dynamic Load a following.








The code will see that we use Function LoadLibrary to run a DLL that you want to use the Function by Function Return value is called a packet Hnadle figures referred to by the File Handle This value is used to. Function calls in the DLL, we will use the Function GetProcAddress called last when finished will be used to perform Function FreeLibrary returned to the operating system resources. This makes running a Dynamic Loading is minimal because the resources do not remove the Function of Load File DLL you want it from the Terminal itself.
To understand more Download Sample Source Code Here.

Top.
Caution in the running DLL.

DLL File is created. We rely on the structure of language Object Pascal and Delphi is a tool used to create the Application that will run most ideal is generated by Delphi Application because the concepts and DLL File should be run from Application created by any language. time whether a C or Visual Basic, but practical problems might occur as well.
Primarily from the inherent structure of language. This may be the data type. The different actions. Some do not make the same. The best option for creating a DLL is usually conclude that because the C language is the original language. That works with Windows because Windows is using C, but will write a DLL to create more complex because we must understand. The C programming language and data structures. Within the Windows operating system to create a DLL in addition, we should use the Exception Handling to help because if a problem occurs. We were able to Clear the resource rebate operating system without problems. A way to create a DLL as a professional.
Use information as a standard Windows user.
Programming using the Exception Handilng.
Overload Function is used to check the name or names Function Procedure is the same name but different Parameter sets together with data by category.
Form included into DLL.
Use Windows API in the DLL.
That said, the. We must learn more. About System Programming for Windows provides a deeper below.
Work and an Event Driven Programming in Windows, which must be C and I will bring this issue into part of the C Builder.
Message Loop and Message types.
Structure of important information in Windows.
Memory management of Windows.
Process and Thread.
Top.
Windows API.

Windows API (Application Program Interface) is that thousands of other Function Function of the process has provided the Windows Application developers can run them by Function that is stored in multiple DLL File File operating system that File. that are important to know.
Function included in the KERNEL32.DLL functions associated with Process and memory management of operating systems. In addition to managing the. Use of resources. System together.
GDI32.DLL contained within the act Function Management System Graphic Display of the operating system.
USER32.DLL Function that acts within the packaging associated with the management of users. Application switcher like the right to use and the use of such Component.
To understand more Download Sample Source Code Here.
Top.
Stream.

Management about reading. And written information that we use to create the Object Class called Stream Stream management can help manage the review. And write. A range of formats such as Buffer, String, File, or Socket TStream As for a Class of Stream brings to us to deal with reading. And write. We need to identify the media. To read and write because that is inherited from Class TStream to manage, especially as Class TFileStream will read and write or File Class TMemoryStream. Will be used to read and write. Data from memory, etc. Class includes inherited from TStream.


  • THandleStream


  • TFileStream


  • TCustomMemoryStream


  • TMemoryStream


  • TStringStream


  • TResourceStream


  • TWinSocketStream

Method of Stream


Read read. We need to locate. Read the first to start the type of storage. And length of data to be read by Method Return Value This is the length of data read unit is structured as follows: Byte function Read (var Buffer; Count: longint): longint;
Write to write data. We must identify the starting point to write the type of storage. And length of data to be written by this Method Return value is the length of data written into the unit is structured as follows: Byte function Write (const Buffer; Count: longint): longint;
Top.
FileStream.

With Stream variety, but an interesting model year is that we will use FileStream Questions in reading and writing data to a File, especially in the Text File that we will use in Class TFileStream Stream to build. read and write data on a Disk File in addition to Read and Write Method major, we also recognize the need for the Create Method Create Method is a packet used to create or open the File that must be named File. that will create or open the File name and what to create or open the File Mode with any details.
fmCreate if File is not mentioned previously. To create a File if it was already open for writing File.
fmOpenRead File to open a read-only.
fmOpenWrite is open to authors only File. The packet will be overwritten as the original File.
fmOpenReadWrite File to open a read and write

No comments: