API (Application Programming Interface) application programming interface, all the computer language to be used in it. What is API? API is the program uses the services provided by the operating system as a means of programming most of us are not operating directly on hardware, but rather call these API, the direct operation by the operating system, hardware, it is we do not have programming and hardware test filter compatibility issues, more importantly, from the operating system level to achieve a code-sharing. Therefore, if the programming API can be used to achieve the function, we try to use it.
Delphi How to use the Windows API
Development in their daily work, we often have to use the Windows API function, then the API function exists where? We can interpret it this way, API function that is encapsulated in the Windows system's DLL system files. As we often use the Beep procedure (Bell), is called Windwos system directory user32.dll in MessageBeep realized; SendMessage (message) is a direct call to user32.dll's SendMessageA. Delphi Dll most frequently used are: advapi32.dll, kernel32.dll, mpr.dll, version.dll, comctl32.dll, gdi32.dll, opengl32.dll, user32.dll, wintrust.dll, msimg32.dll.
So Delphi is how to use this API function for? Since the API function exists in the system DLL, then we can call their own, as written in the same DLL API function call friends. Call the DLL function in two ways, one is a static method, a dynamic way. Call the Windows API are based on the static approach, and why? This is because the DLL is the most basic services provided by the operating system, the operating system at boot time on already loaded into memory, and large and the operating system also use them.
API and daily programming
Delphi encapsulates the Windows API function, the majority of (mainly in the Windows.pas unit), it should be said to complete most of our work, we generally do not directly call the API function. But sometimes there are special requirements, we may have to call off a number of Delphi did not package API, sometimes even calling Windows API functions not released. So how to call these API functions? As mentioned before, using the static method call just fine. See more details call the relevant information.
Delphi did not call these API functions encapsulated key is to know the parameters. Can check to see the latest MSDN or related information.
API and VCL
Microsoft's MFC a lot of packages in Windows API, VCL is no exception. VCL features can not be separated to achieve most of the Windows API, either directly call, either through a simple package and then call. Repaint if TControl's implementation (Control unit):
if (Visible or (csDesigning in ComponentState) and not (
csNoDesignVisible in ControlStyle)) and (Parent <> nil) and
if csOpaque in ControlStyle then
/ / Direct call to the GetDC user32.Dll
DC: = GetDC (Parent.Handle);
/ / Direct call gdi32.Dll of IntersectClipRect
IntersectClipRect (DC, Left, Top, Left + Width, Top +
/ / Parent.PaintControls a large number of API calls
Parent.PaintControls (DC, Self);
/ / Directly call the ReleaseDC user32.Dll
ReleaseDC (Parent.Handle, DC);
/ / The following two calls through the package
Can be seen in everywhere VCL API, we understood from the other side is VCL: VCL is a large number of package API function libraries, such a result is to make it easier to use the API, do not care about those annoying API parameter.
Delphi and Windwos COM Service
What is COM? COM (Component Object Model), Component Object Model, which is based on the Windows platform for the different independent objects can communicate with each other without any constraint of software computing language component model, which defines a standard API, and a binary. The definition of abstract, first of all it is a component model defines a component object specification model to achieve this COM object is the COM object. COM object is through the interface (Interface) to achieve access to a COM object can contain one or more interfaces form the COM objects function, you can visit the VCL objects like the same way as the interface method to access COM objects. COM objects in order to achieve resource sharing, it is a binary code level to achieve a shared, so it can be implemented in different programming languages can also be by a different programming language to call, similar to DLL (COM fact, the ideological sources DLL).
VCL and COM
COM is highly recommended by Microsoft before something so ubiquitous Windows operating system, Delphi's VCL has also called Windows COM service, the most obvious example is the field component of all ADO ADO page components, such as TADOQuery, it is inherited from the TCustomADODataSet while TCustomADODataSet defined as follows:
TCustomADODataSet = class (TDataSet, IUnknown,
ADO (Microsoft ActiveX Data Objects), it is a set by Microsoft OLE DB Provider to access the database a collection of COM objects. If we look at the First TADOQuery realization methods:
TADOQuery.First-> TDataSet.First-> TdataSet.InternalFirst-> TCustomADODataSet. InternalFirst -> Recordset15. MoveFirst
TADOQuery inherited from TCustomADODataSet, but TCustomADODataSet inherited from TdataSet, TdataSet.InternalFirst virtual method is defined, while the sub-class TCustomADODataSet. InternalFirst covers it. TCustomADODataSet. InternalFirs Recordset15 the MoveFirst method call interface.
Not difficult to find, TADOQuery.First eventually calling COM object through the interface implemented.
Delphi and the Windows shell
What is the Windows shell does? Windows Shell is the Windows interface operating environment, it also provides a powerful our programming scalability. We use Windows shell functions to achieve some of the programming, known as shell extension. For example, if your machine has been installed WinRAR, right-click menu in the folder will see the WinRAR compression menu. These features is through the Windows shell extensions to achieve.
Windows shell is based on COM, so all the shell extensions is through the interface. Delphi also defines a number of shell extension interface, the installation directory Delphi7 SourcertlWinShlObj.pas unit.
In Delphi's Demo directory there is a Virtual Listview example is achieved by Windows shell extension disk browsing, interested readers can look.
Embedded assembly language
Assembly language code to embed in Delphi is one of the characteristics, such as the VCL implementation of the root class Tobjce compilation of statements on a range of embedded.
Assembly language is a relatively low-level computer languages, and the closer relationship between hardware. So we usually try not to use it programming, but in some special occasions (such as high performance requirements, the need for direct manipulation of hardware), the use of it can still play a significant role.
Shop Dictionaries Education
Yum 2007 "Ten key words"
Unlimited access to the LATEST trick for Gmail account
Official air strike 2 Cheats
Expert Anti-Virus Tools
Youtube Video Formats
Huang Guangyu of "money POWER" and the weak power
Rmvb On Ps3
Meiling: Select Game Gu Gu and back
Kaspersky Lab Set Up Regional Offices In Canada
3 ACCOUNTING in a drama, colorful festival Foshan accounting
Wmv To Flv Converter Free
My Favorite Firewall And Proxy Servers
Windows media player m4v
Ubuntu will build a full team in China
Zha Yufeng: build "long flight" Back pillar