Difference between revisions of "Windows API units"

From Free Pascal wiki
Jump to navigationJump to search
(New page: {{RTL}} Under windows (win32/win64/wince) one can access the windows API via several Windows API units. This article will try to sketch an overview of what is available and what changes t...)
 
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RTL}}
+
{{Platform only|Windows|Windows|Windows}}
  
Under windows (win32/win64/wince) one can access the windows API via several Windows API units. This article will try to sketch an overview of what is available and what changes to these units. In general this page will describe the current (SVN) status of 2.2.1+, and only detail the situation before when it is needed for the understanding of the current structure.  Here and there I will describe what changed from 2.2.0 to the current situation though.
+
''Note: this article probably will need to be updated to reflect the current (FPC 2.7.1) situation. Also, it apparently was called RTL - does another article called RTL need to be added/substituted? BigChimp, October 2012''
 +
 
 +
Under windows (win32/win64/wince) one can access the Windows API via several Windows API units. This article will try to sketch an overview of what is available in FPC. Lazarus of course also supports Windows APIs (e.g. to show dialogs) which is not covered here.
 +
 
 +
In general this page will describe the status as of FPC 2.2.1+, and only detail the earlier situation when it is needed for the understanding of the current structure.
  
 
== Organization ==
 
== Organization ==
Line 7: Line 11:
 
The Windows API units have been redivided over directories/packages several times, currently the situation is as follows:
 
The Windows API units have been redivided over directories/packages several times, currently the situation is as follows:
  
* The windows and some other units (winsock,winsock2) reside in the RTL. This because these units contain functions used by the RTL.
+
* The ''windows'' and some other units (''winsock'',''winsock2'') reside in the RTL. This is because these units contain functions used by the RTL.
* The other units from FPC origin reside in a package "winunits-base"
+
* The other units originating from FPC reside in a package ''winunits-base'' and some might be in rtl-extra
* The current version of the (independant) JEDI windows API translation resides in a package winunits-jedi.
+
* The current version of the (independent) JEDI windows API translation resides in a package ''winunits-jedi''.
  
In older versions, the both winunits packages were merged in one package (base/winunits or extra/winunits, the location changed a few times), also in older versions more windows units were in the RTL directory. This has now been reduced to the ones that the RTL actually has depandancies on.
+
In older versions, both winunits packages were merged in one package (base/winunits or extra/winunits, depending on FPC version). In older versions more windows units were present in the RTL directory. This has now been reduced to the ones that the RTL actually has dependencies on.
  
== reducing the Windows unit ===
+
== Reducing the Windows unit ==
  
In the past, before the existance of winunits-base, most missing API symbols were added to unit windows. Currently efforts are underway to remove these symbols and put them in the unit where Delphi puts them (comdlg, commctrl, activex). To avoid scoping problems they are already removed from the Windows unit. This might slightly reduce 2.2.0 compability of 2.2.2 a bit, but solves dangerous situations where the order of commctrl and windows in the uses clause matter.  
+
In the past, before ''winunits-base'' existed, most missing API symbols were added to unit windows. Currently efforts are underway to remove these symbols and put them in the unit where Delphi puts them (''comdlg'', ''commctrl'', ''activex''). To avoid scoping problems (e.g. dangerous situations where the order of ''commctrl'' and ''windows'' in the uses clause matter) they are already removed from the Windows unit.  
This poses a barrier for lazarus to use the winunits-base units, which was unacceptable. On top of this, the Windows unit versions weren't translated properly.
+
This poses a barrier for Lazarus to use the winunits-base units, which was unacceptable. On top of this, the Windows unit versions weren't translated properly.
  
Specifically, listview_* functions were removed (already in commctrl) and openfilename* and some other precooked dialogue related functions were moved to commdlg.  
+
Specifically, listview_* functions were removed (already in [[commctrl]]) and openfilename* and some other precooked dialogue related functions were moved to ''commdlg''.
  
 
== Expansion ==
 
== Expansion ==
Line 25: Line 29:
  
 
This process will probably continue for a while.
 
This process will probably continue for a while.
 +
 +
=== 3.2.x series ===
 +
 +
The 3.2.x series has mostly some organic fixes and enhancements to the windows header units.
 +
 +
It should also enable structured exception handling which should improve handling COM objects that use exceptions internally
 +
 +
 +
[[Category:FPC]]
 +
[[Category: Windows]]
 +
[[Category:Windows Widgetsets]]

Latest revision as of 15:28, 26 January 2020

Windows logo - 2012.svg

This article applies to Windows only.

See also: Multiplatform Programming Guide

Note: this article probably will need to be updated to reflect the current (FPC 2.7.1) situation. Also, it apparently was called RTL - does another article called RTL need to be added/substituted? BigChimp, October 2012

Under windows (win32/win64/wince) one can access the Windows API via several Windows API units. This article will try to sketch an overview of what is available in FPC. Lazarus of course also supports Windows APIs (e.g. to show dialogs) which is not covered here.

In general this page will describe the status as of FPC 2.2.1+, and only detail the earlier situation when it is needed for the understanding of the current structure.

Organization

The Windows API units have been redivided over directories/packages several times, currently the situation is as follows:

  • The windows and some other units (winsock,winsock2) reside in the RTL. This is because these units contain functions used by the RTL.
  • The other units originating from FPC reside in a package winunits-base and some might be in rtl-extra
  • The current version of the (independent) JEDI windows API translation resides in a package winunits-jedi.

In older versions, both winunits packages were merged in one package (base/winunits or extra/winunits, depending on FPC version). In older versions more windows units were present in the RTL directory. This has now been reduced to the ones that the RTL actually has dependencies on.

Reducing the Windows unit

In the past, before winunits-base existed, most missing API symbols were added to unit windows. Currently efforts are underway to remove these symbols and put them in the unit where Delphi puts them (comdlg, commctrl, activex). To avoid scoping problems (e.g. dangerous situations where the order of commctrl and windows in the uses clause matter) they are already removed from the Windows unit. This poses a barrier for Lazarus to use the winunits-base units, which was unacceptable. On top of this, the Windows unit versions weren't translated properly.

Specifically, listview_* functions were removed (already in commctrl) and openfilename* and some other precooked dialogue related functions were moved to commdlg.

Expansion

Since 2.0.4, the winunits-base units have been vastly expanded. Most notably retranslations of many headers were done to take advantage of better 2.0 support. (unicode versions now useful due to widestrings, interfaces, winbools/bytebools), and numerous small fixes that improve the Delphi compability of the declarations.

This process will probably continue for a while.

3.2.x series

The 3.2.x series has mostly some organic fixes and enhancements to the windows header units.

It should also enable structured exception handling which should improve handling COM objects that use exceptions internally