Kody ascii i połączenie klawiszy.

0

Witam Chciałem ulepszyć procedure przechwytującą klawisze.
Problem mam taki że chciałbym przechwycić polskie znaki i duże znaki (dodatkowe wciśnięcie Shift, Alt, CapsLoock). Część mojego kodu wygląda tak

Kod:

case Key of
       13: Memo.Lines.Add('enter');
       8: Memo.Text := Memo.Text + '[backspace]';
       27: Memo.Text := Memo.Text + '[esc]';
       65: Begin
          if GetKeyState(17) < 0 then Memo.Text := Memo.Text +'ą'  
           else
          if GetKeyState(16) < 0 then Memo.Text := Memo.Text +'A'
           else memo.Text := memo.Text + 'a';

           end;
       else Memo.Text := Memo.Text + Chr(Key);
     end;

Shift -------> #16
Alt -------> #17 lub #18
CapsLock --> #20

Nie wiem jak sie zabrać za połączenie Alt i Shift.

Na samego Alt znalazłem :

// przykładowo dla litery a
65: if GetKeyState(VK_MENU) < 0 then begin Memo1.Text := Memo1.Text + 'ą' end  //  (VK_MENU) to Alt
else begin Memo1.Text := Memo1.Text + 'a';

Dla Shift można zrobić analogicznie ale nie mogę połączyć razem Alt i Shift by mieć 'Ą'

0

Nie wiem czy dobrze zrozumiałem, ale można by np. tak:

[...]
65:
  begin
    if GetKeyState(17) < 0 then
    begin
      if GetKeyState(16) < 0 then
        Memo.Text := Memo.Text + 'Ą'
      else
        Memo.Text := Memo.Text +'ą';
    end
  end;

O to chodziło?
0

Dzięki za pomoc [browar] Przydało sie, trochę pokombinowałem i rozwiązałem problem :-) :-)
Oto kod:

65:begin
                    if getkeystate(17) < 0 then
                      begin
                        if getkeystate(16) < 0 THEN MEMO.Text := memo.text + 'Ą'
                        else memo.text := memo.text + 'ą';
                      end
                    else
                      begin
                        if getkeystate(16) < 0 THEN MEMO.Text := memo.text + 'A'
                        else memo.text := memo.text + 'a';
                    end;
                  end;
0

Brakuje ci jeszcze CapsLock ;-P

         65:
           if getKeystate(20) = 0 then
             begin
               if getkeystate(17) < 0 then
                 begin
                   if getkeystate(16) < 0 THEN MEMO.Text := memo.text + 'Ą'
                   else memo.text := memo.text + 'ą';
                 end
              else
                begin
                  if getkeystate(16) < 0 THEN MEMO.Text := memo.text + 'A'
                  else memo.text := memo.text + 'a';
                end;
               end
            ELSE
              begin
                if getkeystate(17) < 0 then
                  begin
                    if getkeystate(16) < 0 THEN MEMO.Text := memo.text + 'ą'
                    else memo.text := memo.text + 'Ą';
                end
              else
                begin
                  if getkeystate(16) < 0 THEN MEMO.Text := memo.text + 'a'
                  else memo.text := memo.text + 'A'
                end;
             end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1