1
{******************************************************************************}
3
{ Windows API interface Unit for Object Pascal }
4
{ Master file for Windows applications }
6
{ Portions created by Microsoft are Copyright (C) Microsoft Corporation. }
7
{ All Rights Reserved. }
9
{ The original Pascal code is: JwaWindows.pas, released September 2005. }
10
{ The initial developer of the Pascal code is }
11
{ Robert Marquardt (robert_marquardt att gmx dott de). }
13
{ Portions created by Robert Marquardt are Copyright (C) 2005 }
14
{ Robert Marquardt. All Rights Reserved. }
16
{ Portions created by Christian Wimmer are Copyright (C) 2007 }
17
{ Christian Wimmer. All Rights Reserved. }
19
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
21
{ You may retrieve the latest version of this file at the Project JEDI }
22
{ APILIB home page, located at http://jedi-apilib.sourceforge.net }
24
{ The contents of this file are used with permission, subject to the Mozilla }
25
{ Public License Version 1.1 (the "License"); you may not use this file except }
26
{ in compliance with the License. You may obtain a copy of the License at }
27
{ http://www.mozilla.org/MPL/MPL-1.1.html }
29
{ Software distributed under the License is distributed on an "AS IS" basis, }
30
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
31
{ the specific language governing rights and limitations under the License. }
33
{ Alternatively, the contents of this file may be used under the terms of the }
34
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
35
{ provisions of the LGPL License are applicable instead of those above. }
36
{ If you wish to allow use of your version of this file only under the terms }
37
{ of the LGPL License and not to allow others to use your version of this file }
38
{ under the MPL, indicate your decision by deleting the provisions above and }
39
{ replace them with the notice and other provisions required by the LGPL }
40
{ License. If you do not delete the provisions above, a recipient may use }
41
{ your version of this file under either the MPL or the LGPL License. }
43
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
45
{******************************************************************************}
46
{ Description: JwaWindows.pas has the goal to bring all windows conversion }
47
{ units into one big unit. There is no need to include many units. Only one }
48
{ unit - just this - one is needed. The resulted binary file will enlarge }
49
{ about 100-300kb. This depends which parts are used. However it is also }
50
{ possible to use all header units without this one. But you should not use }
51
{ both versions at the same time. Delphi will fail on some cases because }
52
{ types and so other things from two different units are completly different.}
53
{ You also have the possibility to remove some headers from the file by using}
54
{ compiler defines. For more information about that see the define comments }
56
{ HowTo: You can compile this file by creating a new package and just put this }
57
{ unit into it. You also have to include the "Common" path in search path }
58
{ options. If you use the default tree folder structure just use "..\Common".}
59
{ You should also define output paths (e.g. "output7" for D7) }
61
{ You can define compiler defines to change the compilation. }
62
{ Change the compiler defines in this source code or use the compiler }
63
{ condition option in the package. }
64
{ To use dynamic linked function use this: }
65
{ PACKAGE_CONDITIONS;DYNAMIC_LINK;JWA_INCLUDE_SETUP_API }
66
{ For static linking just remove DYNAMIC_LINK . }
67
{ You can also define debug definitions and so on. }
69
{ Warning: Compiling this unit needs a little bit more time than a delphi }
70
{ programmer is used to. Therefore we recommend that you create a standalone }
71
{ JwaWindows.dcu file to use in projects and remove every search path to }
72
{ the source codes except for debugger search path (so you can browse the }
73
{ sources in the Delphi IDE). You can also create dynamic and static linked }
74
{ JwaWindows.dcu seperatly and just change the search path. There can also }
75
{ be a debug and a much smaller release version of the file. }
76
{ In conclusion there can be 4 JwaWindows.dcu versions: }
78
{ |- Static linked Debug version }
79
{ |- Static linked Release version }
80
{ |- Dynamic linked Debug version }
81
{ |- Dynamic linked Release version }
82
{ Be aware that dcu files are incompatible between delphi versions! }
84
{ Hints: If you get an error in a file you don't know or need you can remove }
85
{ it from the include list in this code. You must do this twice: The first }
86
{ is an interface include the second one is an implementation include. }
87
{ It is very likely that this unit is needed by another one behind the }
88
{ excluded one. In this case you must also exclude the other one. }
89
{ Units at the beginning are mostly highly necessary for others. This }
90
{ includes the first ten units. Errors in them won't probably be fixed easily}
92
{******************************************************************************}
94
// $Id: JwaWindows.pas,v 1.20 2007/10/19 19:54:18 dezipaitor Exp $
98
The following defines can be changed to remove headers from JwaWindows.
99
PACKAGE_CONDITIONS can be set in the options of a project
100
to disable these source code compiler defines and use
101
the one of the project.
104
{$IFNDEF PACKAGE_CONDITIONS}
106
{$DEFINE DYNAMIC_LINK} //link most of functions dynamically ?
108
{$DEFINE JWA_INCLUDE_SETUP_API} //include setup api ?
110
{.$DEFINE JWA_WINSOCK_1} //use winsock.pas instead of winsock2.pas ?
114
{The following directive includes the file jwaAdsTlb.pas
115
This unit needs the units OleServer, OleCtrls which do install
116
a windows handle in newer delphi versions.
117
This handle prevents SetThreadDesktop to work on the main thread. It
118
works on a new thread!
120
ActiveX and COM is not supported by this lib on Freepascal yet!
122
{$DEFINE JWA_INCLUDE_JWAADSTLB}
125
{$UNDEF JWA_INCLUDE_JWAADSTLB}
126
{$UNDEF JWA_INCLUDE_SETUP_API}
128
{$ENDIF PACKAGE_CONDITIONS}
132
{------ end of your business ------}
136
{Exclude some units that are not compilabe under FPC
137
JwaSensEvts.pas - not supported
138
JwaWinFax.pas - partially fixed
139
JwaFaxDev.pas depends on jwaWinFax
140
JwaFaxExt.pas depends on jwaWinFax
141
JwaFaxMmc.pas depends on jwaWinFax
142
JwaFaxRoute.pas depends on jwaWinFax
145
{$DEFINE EXCLUDE_FPC}
151
{The following defines should not be changed!}
152
{$DEFINE JWAWINDOWS_PAS} //include mode activated
153
{$DEFINE JWA_INCLUDEMODE} //exclude duplicate things - do not remove!
156
{$IFDEF DYNAMIC_LINK}
157
{$DEFINE RTDL} //native api dynamic link compiler define
158
{$ENDIF DYNAMIC_LINK}
160
//exclude VCL from freepascal
166
//extra compiler options
168
{$I jediapilib.inc} // paths here break FPC dir structure.
176
{$IFDEF USE_DELPHI_TYPES}
178
{$IFDEF HAS_UNIT_DATEUTILS}
179
DateUtils, //used by JwaWinSta.pas
181
{$IFDEF JWA_INCLUDE_JWAADSTLB}
182
{The following units may not be included because of problems}
184
//OleUnits creates window handles that prevents SetThreadDesktop to work
185
OleServer, //[warning] requires D5 or higher - required by jwaAdsTLB.pas
187
//JwaAdsTlb.pas and JwaDde.pas use these units and is therfore excluded
188
{$ENDIF JWA_INCLUDE_JWAADSTLB}
190
{$ENDIF USE_DELPHI_TYPES}
193
{$IFDEF JWA_INCLUDE_SETUP_API}
194
CommCtrl, //used by SetupAPI.pas
195
{$ENDIF JWA_INCLUDE_SETUP_API}
197
ActiveX, Classes, ComObj
206
{$IFNDEF COMPILER6_UP}
208
type PCardinal = ^Cardinal;
216
(* To include a new converted header file
217
you must use this structure:
219
{$IFNDEF JWA_OMIT_SECTIONS}
224
{$ENDIF JWA_OMIT_SECTIONS}
226
{$IFNDEF JWA_IMPLEMENTATIONSECTION}
227
your interface declarations here
228
{$ENDIF JWA_IMPLEMENTATIONSECTION}
231
//do no cross JWA_IMPLEMENTATIONSECTION or JWA_INTERFACESECTION with JWA_OMIT_SECTIONS here!
232
{$IFNDEF JWA_OMIT_SECTIONS}
235
{$ENDIF JWA_OMIT_SECTIONS}
237
//do no cross JWA_IMPLEMENTATIONSECTION or JWA_INTERFACESECTION with JWA_OMIT_SECTIONS here!
239
{$IFNDEF JWA_INTERFACESECTION}
240
your implementation here
241
{$ENDIF JWA_INTERFACESECTION}
243
{$IFNDEF JWA_OMIT_SECTIONS}
245
{$ENDIF JWA_OMIT_SECTIONS}
249
{$DEFINE JWA_OMIT_SECTIONS}
250
{$DEFINE JWA_INTERFACESECTION}
252
{The following constant are version and compiler control instruments to be used
256
//include mode active?
257
JWA_CONST_INCLUDEMODE = {$IFDEF JWA_INCLUDEMODE} True; {$ELSE} False; {$ENDIF}
258
{dynamic linking active? Warning: Not all function will be linked dynamically.
259
Some functions cannot be linked dynamically because of their
261
JWA_CONST_DYNAMICLINK = {$IFDEF DYNAMIC_LINK} True; {$ELSE} False; {$ENDIF}
262
{Like JWA_CONST_DYNAMICLINK but for native win api.}
263
JWA_CONST_RDTL = {$IFDEF RTDL} True; {$ELSE} False; {$ENDIF}
264
{Use delphi types instead of our own.}
265
JWA_CONST_USE_DELPHI_TYPES = {$IFDEF USE_DELPHI_TYPES} True; {$ELSE} False; {$ENDIF}
266
{Setup api headers included?}
267
JWA_CONST_INCLUDE_SETUP_API = {$IFDEF JWA_INCLUDE_SETUP_API} True; {$ELSE} False; {$ENDIF}
268
{Version of this header. Its not a CVS, SVN or compile version}
269
JWA_CONST_VERSION = '1.5';
273
{Beginning of interface section.
274
These files must be in a correct order!
275
These files are included a second time in the implementation section!
278
{$I JwaWinDLLNames.pas}
285
{-$I JwaDde.pas} //do not include - see uses remarks
295
{ I JwaDDEml.pas} // TODO convert
297
{ I JwaMMSystem.pas} // TODO convert
299
{ I JwaShellAPI.pas} // TODO convert
304
{.$IFNDEF JWA_INCLUDE_JWAADSTLB}
306
{.$ENDIF JWA_INCLUDE_JWAADSTLB}
309
{The following files cannot be included because of unfixed errors and problems.
310
The list has no order!}
313
{******** WINSOCK *******************}
315
{$IFDEF JWA_WINSOCK_1}
318
{$DEFINE JWA_WINSOCK_2}
341
{$ENDIF JWA_WINSOCK_1}
344
{******** various headers that must be included before rest *********}
350
{ I JwaWinScard.pas} // TODO convert
351
{ I JwaWinSpool.pas} // TODO convert
352
{ I JwaOle2.pas} // TODO convert
353
{ I JwaCommDlg.pas} // TODO convert
354
{ I JwaStrAlign.pas} // TODO convert
356
{ I JwaMCX.pas} // TODO convert
357
{ I JwaIMM.pas} // TODO convert
373
{******** Ads TLB ************}
374
{$IFDEF JWA_INCLUDE_JWAADSTLB}
378
{$ENDIF JWA_INCLUDE_JWAADSTLB}
383
{$IFDEF JWA_INCLUDE_JWAADSTLB}
389
{$ENDIF JWA_INCLUDE_JWAADSTLB}
398
{$IFDEF JWA_INCLUDE_JWAADSTLB}
400
{$ENDIF JWA_INCLUDE_JWAADSTLB}
402
{******** LAN Manager **********}
403
{do not include JwaLM.pas!}
405
{$DEFINE JWA_OMIT_SECTIONS_LM} //define special LM section omitting
406
{$I JwaLmAccess.pas} // Access, Domain, Group and User classes
407
{$I JwaLmAlert.pas} // Alerter
408
{$I JwaLmShare.pas} // Connection, File, Session and Share classes
409
{$I JwaLmMsg.pas} // Message class
410
{$I JwaLmRemUtl.pas} // Remote Utility class
411
{$I JwaLmRepl.pas} // Replicator class
412
{$I JwaLmServer.pas} // Server class
413
{$I JwaLmSvc.pas} // Service class
414
{$I JwaLmUse.pas} // Use class
415
{$I JwaLmWkSta.pas} // Workstation class
416
{$I JwaLmApiBuf.pas} // NetApiBuffer class
417
{$I JwaLmErrLog.pas} // NetErrorLog class
418
{$I JwaLmConfig.pas} // NetConfig class
419
{$I JwaLmStats.pas} // NetStats class
420
{$I JwaLmAudit.pas} // NetAudit class
421
{$I JwaLmJoin.pas} // NetJoinDomain class
427
{******** the rest **********}
433
{$IFDEF JWA_INCLUDE_JWAADSTLB}
437
{$ENDIF JWA_INCLUDE_JWAADSTLB}
446
{$I JWaBthSdpDef.pas}
447
{$I JwaBluetoothAPIs.pas}
449
{$I JwaWs2Bth.pas} //depends JwaBtHDef.pas
450
{$I JwaCryptUIApi.pas}
496
{.$IFNDEF EXCLUDE_FPC}
498
{.$ENDIF EXCLUDE_FPC}
515
{$I JwaSrRestorePtApi.pas}
520
{$I JwaSchemaDef.pas}
529
{$IFDEF JWA_INCLUDE_JWAADSTLB}
532
{$ENDIF JWA_INCLUDE_JWAADSTLB}
540
{.$IFNDEF EXCLUDE_FPC}
545
{.$ENDIF EXCLUDE_FPC}
550
{$I JwaImapiError.pas}
563
{$IFDEF JWA_INCLUDE_JWAADSTLB}
565
{$ENDIF JWA_INCLUDE_JWAADSTLB}
569
{$DEFINE JWA_INCLUDEMODE}
570
{$IFDEF COMPILER6_UP}
577
{.$I JwaWinternl.pas}
579
{$I ModuleLoader.pas}
580
{$IFDEF JWA_INCLUDE_SETUP_API}
581
{$DEFINE SETUPAPI_LINKONREQUEST}
582
{If the compiler cannot find "SaCMAPI" its
583
because it should be "Setup and Config Manager API".
584
But the compiler cannot include files with spaces in it.
585
Simply hard link or copy the following files into the new folder.
587
{$I ..\SaCMAPI\SetupApi.pas}
588
{$I ..\SaCMAPI\Cfg.pas}
589
{$I ..\SaCMAPI\CfgMgr32.pas}
590
{$ENDIF JWA_INCLUDE_SETUP_API}
592
{$UNDEF JWA_INTERFACESECTION}
594
{$UNDEF JWA_OMIT_SECTIONS}
598
{$DEFINE JWA_OMIT_SECTIONS}
599
{$DEFINE JWA_IMPLEMENTATIONSECTION}
601
{Implementation section.
602
These files must be in a correct order!
605
{$I JwaWinDLLNames.pas}
612
{-$I JwaDde.pas} //do not include - see uses remarks
622
{ I JwaDDEml.pas} // TODO convert
624
{ I JwaMMSystem.pas} // TODO convert
626
{ I JwaShellAPI.pas} // TODO convert
633
{The following files cannot be included because of unfixed errors and problems.
634
The list has no order!}
638
{******** WINSOCK *******************}
640
{$IFDEF JWA_WINSOCK_1}
643
{$DEFINE JWA_WINSOCK_2}
666
{$ENDIF JWA_WINSOCK_1}
668
{******** various headers that must be included before rest *********}
674
{ I JwaWinScard.pas} // TODO convert
675
{ I JwaWinSpool.pas} // TODO convert
676
{ I JwaOle2.pas} // TODO convert
677
{ I JwaCommDlg.pas} // TODO convert
678
{ I JwaStrAlign.pas} // TODO convert
680
{ I JwaMCX.pas} // TODO convert
681
{ I JwaIMM.pas} // TODO convert
698
{$IFDEF JWA_INCLUDE_JWAADSTLB}
699
{******** Ads TLB ************}
703
{$ENDIF JWA_INCLUDE_JWAADSTLB}
708
{$IFDEF JWA_INCLUDE_JWAADSTLB}
714
{$ENDIF JWA_INCLUDE_JWAADSTLB}
723
{$IFDEF JWA_INCLUDE_JWAADSTLB}
725
{$ENDIF JWA_INCLUDE_JWAADSTLB}
727
{******** LAN Manager **********}
728
{do not include JwaLM.pas!}
730
{$DEFINE JWA_OMIT_SECTIONS_LM} //define special LM section omitting
731
{$I JwaLmAccess.pas} // Access, Domain, Group and User classes
732
{$I JwaLmAlert.pas} // Alerter
733
{$I JwaLmShare.pas} // Connection, File, Session and Share classes
734
{$I JwaLmMsg.pas} // Message class
735
{$I JwaLmRemUtl.pas} // Remote Utility class
736
{$I JwaLmRepl.pas} // Replicator class
737
{$I JwaLmServer.pas} // Server class
738
{$I JwaLmSvc.pas} // Service class
739
{$I JwaLmUse.pas} // Use class
740
{$I JwaLmWkSta.pas} // Workstation class
741
{$I JwaLmApiBuf.pas} // NetApiBuffer class
742
{$I JwaLmErrLog.pas} // NetErrorLog class
743
{$I JwaLmConfig.pas} // NetConfig class
744
{$I JwaLmStats.pas} // NetStats class
745
{$I JwaLmAudit.pas} // NetAudit class
746
{$I JwaLmJoin.pas} // NetJoinDomain class
752
{******** the rest **********}
758
{$IFDEF JWA_INCLUDE_JWAADSTLB}
762
{$ENDIF JWA_INCLUDE_JWAADSTLB}
772
{$I JWaBthSdpDef.pas}
773
{$I JwaBluetoothAPIs.pas}
775
{$I JwaWs2Bth.pas} //depends JwaBtHDef.pas
776
{$I JwaCryptUIApi.pas}
822
{.$IFNDEF EXCLUDE_FPC}
824
{.$ENDIF EXCLUDE_FPC}
843
{$I JwaSrRestorePtApi.pas}
848
{$I JwaSchemaDef.pas}
857
{$IFDEF JWA_INCLUDE_JWAADSTLB}
860
{$ENDIF JWA_INCLUDE_JWAADSTLB}
868
{.$IFNDEF EXCLUDE_FPC}
873
{.$ENDIF EXCLUDE_FPC}
877
{$I JwaImapiError.pas}
890
{$IFDEF JWA_INCLUDE_JWAADSTLB}
892
{$ENDIF JWA_INCLUDE_JWAADSTLB}
896
{$DEFINE JWA_INCLUDEMODE}
898
{.$I JwaWinternl.pas}
899
//these files needs a newer version due to missing units
900
{$IFDEF COMPILER6_UP}
902
{$ENDIF COMPILER6_UP}
907
{$I ModuleLoader.pas}
908
{$IFDEF JWA_INCLUDE_SETUP_API}
909
{$DEFINE SETUPAPI_LINKONREQUEST}
911
{If the compiler cannot find "SetupApi.pas" its
912
because it resides in "Setup and Config Manager API".
913
But the compiler cannot include folders with spaces in it.
914
Simply hard link or copy the following files
915
into the new folder named "SaCMAPI".
916
This issue should be fixed in newer versions of JEDI API LIB.
917
If you get this error you should do the things described or upgrade.
919
{$I ..\SaCMAPI\SetupApi.pas}
920
{$I ..\SaCMAPI\Cfg.pas}
921
{$I ..\SaCMAPI\CfgMgr32.pas}
922
{$ENDIF JWA_INCLUDE_SETUP_API}
924
{$UNDEF JWA_IMPLEMENTATIONSECTION}
926
{$UNDEF JWA_OMIT_SECTIONS}