You've already forked lazarus-ccr
aarre
applications
bindings
components
Comba_Animation
ZVDateTimeCtrls
aboutcomponent
acs
beepfp
callite
chelper
cmdline
cmdlinecfg
colorpalette
cryptini
csvdocument
epiktimer
flashfiler
fpsound
fpspreadsheet
fractions
freetypepascal
geckoport
gradcontrols
industrialstuff
iosdesigner
iphonelazext
jujiboutils
jvcllaz
kcontrols
help
source
kcontrols.inc
kcontrols.lrs
kcontrols.pas
kcontrols.res
kcontrolsdesign.lrs
kcontrolsdesign.pas
kcontrolslaz.lpk
kcontrolslaz.pas
kdbgrids.pas
kdialogs.pas
keditcommon.pas
kfunctions.pas
kgraphics.pas
kgrids.lrs
kgrids.pas
kgrids.res
khexeditor.pas
khexeditordesign.lrs
khexeditordesign.pas
khexeditorlaz.lpk
khexeditorlaz.pas
kicon.pas
kprintpreview.dfm
kprintpreview.lfm
kprintpreview.lrs
kprintpreview.pas
kprintsetup.dfm
kprintsetup.lfm
kprintsetup.lrs
kprintsetup.pas
kwidewinprocs.pas
xpman.res
kcontrols_readme.txt
kgrid_readme.txt
khexeditor_readme.txt
kicon_readme.txt
lazautoupdate
lazbarcodes
lclextensions
longtimer
manualdock
mbColorLib
mplayer
multithreadprocs
nvidia-widgets
onguard
orpheus
playsoundpackage
poweredby
powerpdf
rgbgraphics
richmemo
richview
rtfview
rx
scrolltext
smnetgradient
spktoolbar
svn
tdi
thtmlport
tparadoxdataset
tvplanit
virtualtreeview
virtualtreeview-new
xdev_toolkit
zlibar
examples
lclbindings
wst
97 lines
3.0 KiB
ObjectPascal
97 lines
3.0 KiB
ObjectPascal
![]() |
{ @abstract(This unit contains Unicode equivalents of ANSI Win32 API functions
|
||
|
not supported in Win9X without Unicode Layer for Win9X)
|
||
|
@author(Tomas Krysl (tk@tkweb.eu))
|
||
|
@created(10 Jun 2008)
|
||
|
@lastmod(14 Oct 2009)
|
||
|
|
||
|
Copyright � 2008 Tomas Krysl (tk@@tkweb.eu)<BR><BR>
|
||
|
|
||
|
<B>License:</B><BR>
|
||
|
This code is distributed as a freeware. You are free to use it as part
|
||
|
of your application for any purpose including freeware, commercial and
|
||
|
shareware applications. The origin of this source code must not be
|
||
|
misrepresented; you must not claim your authorship. You may modify this code
|
||
|
solely for your own purpose. Please feel free to contact the author if you
|
||
|
think your changes might be useful for other users. You may distribute only
|
||
|
the original package. The author accepts no liability for any damage
|
||
|
that may result from using this code. }
|
||
|
|
||
|
unit KWideWinProcs;
|
||
|
|
||
|
{$include kcontrols.inc}
|
||
|
|
||
|
interface
|
||
|
|
||
|
{$IFDEF USE_WIDEWINPROCS}
|
||
|
|
||
|
type
|
||
|
{ Procedural type for @link(TKWideWinProcs.CompareString). }
|
||
|
TCompareStringW = function(Locale, dwCmpFlags: Cardinal; lpString1: PWideChar; cchCount1:
|
||
|
Integer; lpString2: PWideChar; cchCount2: Integer): Integer; stdcall;
|
||
|
|
||
|
{ Procedural type for @link(TKWideWinProcs.LStrLenW). }
|
||
|
TLStrLenW = function(lpString: PWideChar): Integer;
|
||
|
|
||
|
{ Unicode equivalents of ANSI Win32 API functions not available in Win9X
|
||
|
without Unicode Layer for Win9X. Only those used in KControls. }
|
||
|
TKWideWinProcs = class(TObject)
|
||
|
private
|
||
|
FCompareStringW: TCompareStringW;
|
||
|
FLStrLenW: TLStrLenW;
|
||
|
public
|
||
|
{ Creates the instance. }
|
||
|
constructor Create;
|
||
|
{ See MSDN for help. }
|
||
|
function CompareString(Locale, dwCmpFlags: Cardinal; lpString1: PWideChar;
|
||
|
cchCount1: Integer; lpString2: PWideChar; cchCount2: Integer): Integer;
|
||
|
{ See MSDN for help. }
|
||
|
function LStrLenW(lpString: PWideChar): Integer;
|
||
|
end;
|
||
|
|
||
|
var
|
||
|
WideWinProcs: TKWideWinProcs;
|
||
|
|
||
|
{$ENDIF}
|
||
|
|
||
|
implementation
|
||
|
|
||
|
{$IFDEF USE_WIDEWINPROCS}
|
||
|
|
||
|
uses
|
||
|
Windows, KFunctions;
|
||
|
|
||
|
{ TWideWinProcs }
|
||
|
|
||
|
constructor TKWideWinProcs.Create;
|
||
|
begin
|
||
|
FCompareStringW := GetProcAddress(GetModuleHandle('kernel32.dll'), 'CompareStringW');
|
||
|
FLStrLenW := GetProcAddress(GetModuleHandle('kernel32.dll'), 'lstrlenW');
|
||
|
end;
|
||
|
|
||
|
function TKWideWinProcs.CompareString(Locale, dwCmpFlags: Cardinal;
|
||
|
lpString1: PWideChar; cchCount1: Integer; lpString2: PWideChar;
|
||
|
cchCount2: Integer): Integer;
|
||
|
begin
|
||
|
if Assigned(FCompareStringW) then
|
||
|
Result := FCompareStringW(Locale, dwCmpFlags, lpString1, cchCount1,
|
||
|
lpString2, cchCount2)
|
||
|
else
|
||
|
Result := CompareStringA(Locale, dwCmpFlags, PAnsiChar(WideCharToAnsiString(lpString1)),
|
||
|
cchCount1, PAnsiChar(WideCharToAnsiString(lpString2)), cchCount2);
|
||
|
end;
|
||
|
|
||
|
function TKWideWinProcs.LStrLenW(lpString: PWideChar): Integer;
|
||
|
begin
|
||
|
if Assigned(FLStrLenW) then
|
||
|
Result := FLStrLenW(lpString)
|
||
|
else
|
||
|
Result := LStrLenA(PAnsiChar(WideCharToAnsiString(lpString)));
|
||
|
end;
|
||
|
|
||
|
initialization
|
||
|
WideWinProcs := TKWideWinProcs.Create;
|
||
|
finalization
|
||
|
WideWinProcs.Free;
|
||
|
{$ENDIF}
|
||
|
end.
|