Quantcast
Channel: Delphi Forum - Delphi Programming Kings of Code - Delphi Programming
Viewing all articles
Browse latest Browse all 173

Windows 8 keyboard template source code

$
0
0
İmage
PHP Code:
unit SensorKeyBoardWindows;
interface

uses
System
.SysUtilsSystem.TypesSystem.UITypesSystem.ClassesSystem.VariantsFMX.FormsFMX.DialogsFMX.Edit,
FMX.StdCtrlsShellApiWinapi.WindowsWinapi.messages;

type

TSensorKeyBoardWindows 
= class
private
class function 
ExpandEnvironmentVar(var Valuestring): Boolean;
protected
public
class 
procedure onEnterEdit(SenderTObject);
class 
procedure onExitEdit(SenderTObject);
end;

procedure KeyBoardInitialization(AFormTObject);

implementation

// Инициализация сенсорной клавиатуры для всех эдитов на форме
procedure KeyBoardInitialization(AFormTObject);
var
kInteger;
begin
if AForm is TForm then
begin
for := 0 to TForm(AForm).ComponentCount do
if 
TForm(AForm).Components[kis TEdit then
begin
TEdit
(TForm(AForm).Components[k]).OnEnter := TSensorKeyBoardWindows.onEnterEdit;
TEdit(TForm(AForm).Components[k]).OnExit := TSensorKeyBoardWindows.onExitEdit;
end;
end
else
raise Exception.Create('Передан не верный параметр: ' AForm.ClassName);
end;

TSensorKeyBoardWindows }

class function 
TSensorKeyBoardWindows.ExpandEnvironmentVar(var Valuestring): Boolean;
var
RInteger;
Expandedstring;
procedure StrResetLength(var Sstring);
var
IInteger;
begin
for := 0 to Length(S) - do
if 
S[1] = #0 then
begin
SetLength
(SI);
Exit;
end;
end;

begin
SetLength
(Expanded1);
:= ExpandEnvironmentStrings(PChar(Value), PChar(Expanded), 0);
SetLength(ExpandedR);
Result := ExpandEnvironmentStrings(PChar(Value), PChar(Expanded), R) <> 0;
if 
Result then
begin
StrResetLength
(Expanded);
Value := Expanded;
end;
end;

class 
procedure TSensorKeyBoardWindows.onEnterEdit(SenderTObject);
var
Sstring;
begin
:= '%CommonProgramW6432%\microsoft shared\ink\tabtip.exe';
ExpandEnvironmentVar(S);
ShellExecute(0PChar('open'), PChar(S), nilnilSW_SHOWNORMAL);
end;

class 
procedure TSensorKeyBoardWindows.onExitEdit(SenderTObject);
var
KeyBoardHandleTHandle;
begin
KeyBoardHandle 
:= FindWindow('IPTip_Main_Window'nil);
if 
KeyBoardHandle <> 0 then
PostMessage
(KeyBoardHandleWM_SYSCOMMANDSC_CLOSE0);
end;

end

 

Viewing all articles
Browse latest Browse all 173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>