• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Storing informations in keybord keys ctrl

Hi,
How storage a text in a specificate key(for exemple: ctrl + Y), and when i press it, paste the text, in a form, for exemple. tnx
0
cels9
Asked:
cels9
  • 4
  • 3
1 Solution
 
cels9Author Commented:
these topics doenst matchs with my q. but, tnx
0
 
shaneholmesCommented:
What part doesn't answer your question?

You register the key sequence (Ctrl + Y)


when its pressed, you can assign it to do what you want - in your case put some text somewhere



  private
    { Private declarations }
    Procedure WMHotkey( Var msg: TWMHotkey ); message WM_HOTKEY;





procedure TForm1.WMHotkey( Var msg: TWMHotkey );
  Begin
    If msg.hotkey = 1 Then
   Begin
    //paste the text you want to paste where you want to paste it!
    // example
   //edit1.text:= SomeText;
   End;
  End;

procedure TForm1.FormCreate(Sender: TObject);
begin
if RegisterHotKey(Handle,1, MOD_CONTROL ,ord('Yy)) = false then
      MessageDlg('Failed to register Hot Key',mtError,[mbOk],0);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  UnRegisterHotkey( Form1.Handle, 1 );
end;

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
cels9Author Commented:
ohh.. sorry. im newb :P tnx! and if i wanna ctrl + F ? :))
0
 
shaneholmesCommented:
if RegisterHotKey(Handle,2, MOD_CONTROL ,ord('f')) = false then
      MessageDlg('Failed to register Hot Key',mtError,[mbOk],0);


procedure TForm1.WMHotkey( Var msg: TWMHotkey );
  Begin
    If msg.hotkey = 1 Then
   Begin
    //paste the text you want to paste where you want to paste it!
    // example
   //edit1.text:= SomeText;
   End
  else
    If msg.hotkey = 2 Then
   Begin
    //paste the text you want to paste where you want to paste it!
    // example
   //edit1.text:= SomeText;
   End
  End;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  UnRegisterHotkey( Form1.Handle, 2 );
end;
0
 
cels9Author Commented:
tnx again
0
 
shaneholmesCommented:
NP

<SMILE>

Happy Coding!

Shane
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now