spiegel-keyman/windows/src/developer/setup/CommonControls.pas
Marc Durdin b65b982584 Keyman Desktop and Keyman Developer open source 10.0 alpha seed (#121)
* Keyman for Windows 10.0 Open Source

* Squashed 'windows/src/ext/jedi/jedi/' content from commit f444ad2

git-subtree-dir: windows/src/ext/jedi/jedi
git-subtree-split: f444ad2da4693851e523f1ea6bd541f701904c24

* Squashed 'windows/src/ext/jedi/jcl/' content from commit d63d3c9fd

git-subtree-dir: windows/src/ext/jedi/jcl
git-subtree-split: d63d3c9fd9ff84efdd8159084ec6a60313644243

* Squashed 'windows/src/ext/jedi/jvcl/' content from commit bee19f3b4

git-subtree-dir: windows/src/ext/jedi/jvcl
git-subtree-split: bee19f3b46909fde2fa92c06cd2706f41d99f6c3

* Add required .res files

* Add required .res files

* Add docbook files (forced)

* Add required libxslt

* Add required jedi files

* Add installation files

* Tweak .gitignore for open

* CI

* Remove KMW from Developer source (#122)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Fixup release build and copy license, readme from kmw during build

* Remove obsolete build help documentation

* Keyman Engine 10 on Windows regression for shift states (#129)

* Improve #128 -- cleaner debug messages

* Fixes #127, shift state now resets correctly; and more work for #128

* Fixes #130 (#131)
2017-07-25 10:53:06 +07:00

70 lines
1.7 KiB
ObjectPascal

(*
Name: CommonControls
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Create Date: 4 Jun 2007
Modified Date: 23 Aug 2007
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 04 Jun 2007 - mcdurdin - Initial version
23 Aug 2007 - mcdurdin - Initial version from Desktop
*)
unit CommonControls;
interface
function InitCommonControl(CC: Integer): Boolean;
implementation
uses
Windows;
type
tagINITCOMMONCONTROLSEX = packed record
dwSize: DWORD; // size of this structure
dwICC: DWORD; // flags indicating which classes to be initialized
end;
PInitCommonControlsEx = ^TInitCommonControlsEx;
TInitCommonControlsEx = tagINITCOMMONCONTROLSEX;
var
ComCtl32DLL: THandle;
_InitCommonControlsEx: function(var ICC: TInitCommonControlsEx): Bool stdcall;
procedure InitCommonControls; external comctl32 name 'InitCommonControls';
procedure InitComCtl;
begin
if ComCtl32DLL = 0 then
begin
ComCtl32DLL := GetModuleHandle(comctl32);
if ComCtl32DLL <> 0 then
@_InitCommonControlsEx := GetProcAddress(ComCtl32DLL, 'InitCommonControlsEx');
end;
end;
function InitCommonControlsEx(var ICC: TInitCommonControlsEx): Bool;
begin
if ComCtl32DLL = 0 then InitComCtl;
Result := Assigned(_InitCommonControlsEx) and _InitCommonControlsEx(ICC);
end;
function InitCommonControl(CC: Integer): Boolean;
var
ICC: TInitCommonControlsEx;
begin
ICC.dwSize := SizeOf(TInitCommonControlsEx);
ICC.dwICC := CC;
Result := InitCommonControlsEx(ICC);
if not Result then InitCommonControls;
end;
end.