Posted on Leave a comment

delphi key state

procedure TForm1.Button1Click(Sender: TObject);
var
  KeyState : Word;
  S : String;
begin
  KeyState := GetKeyState(VK_SCROLL);
  S := 'Клавиша: VK_SCROLL. Состояние:';
  if KeyState and $8000 = $8000 then
    S := s+'down'
  else
    S := s+'up';
  if KeyState and 1 = 1 then
    S := S + 'toggle on'
  else
    S := S + 'toggle off'
  ;
  ShowMessage( S );
end;
Posted on Leave a comment

Delphi keyboard

function GetRealChar(AKey: Word): Char;
var
  Layout: HKL;
  KeyboardState: TKeyboardState;
  RealCode: AnsiString;
  ScanCode: Integer;
  s: string;
begin
  Layout := GetKeyboardLayout(GetCurrentThreadID);
  SetLength(RealCode, 1);
  FillChar(RealCode[1], Length(RealCode), 0);
  FillChar(KeyboardState[0], SizeOf(KeyboardState), 0);
  KeyboardState[AKey] := 0;
  ScanCode := (AKey shr 16) and $FF;
  ToAsciiEx(AKey, ScanCode, KeyboardState, PChar(RealCode), 0, Layout);
  s := RealCode;
  Result := s[1];
end;
Posted on Leave a comment

DLL hell, manifest, side-by-side

DLL Hell is a term for the complications that arise when working with dynamic link libraries (DLLs) used with Microsoft Windows operating systems,[1] particularly legacy 16-bit editions which all run in a single memory space.

Side-by-side technology is a standard for executable files in Windows 98 Second Edition, Windows 2000, and later versions of Windows that attempts to alleviate problems that arise from the use of dynamic-link libraries in Microsoft Windows.

Continue reading DLL hell, manifest, side-by-side