PDA

View Full Version : سوال: تغییر کلید های میانبر ویندوز



Mask
چهارشنبه 26 آبان 1389, 09:49 صبح
با سلام
چطوری میتونم یه رشته رو به جای ctrl+v ;o که paste بشه رو با کلید مثلا F12 انجام بشه.
یا به جای استفاده از ctrl+c در ویندوز دکمه F11 رو قرار بدم.
ممنون.

hadisalahi2
چهارشنبه 26 آبان 1389, 10:14 صبح
فکر میکنم از Hot Key باید استفاده کنی.
بهتره یه سرچ بزنی ببینی چیزی دستگیرت میشه.
یا حق

Felony
چهارشنبه 26 آبان 1389, 10:24 صبح
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
id1, id2, id3, id4: Integer;
procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

// Trap Hotkey Messages
procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
if Msg.HotKey = id1 then
ShowMessage('Ctrl + A pressed !');
if Msg.HotKey = id2 then
ShowMessage('Ctrl + Alt + R pressed !');
if Msg.HotKey = id3 then
ShowMessage('Win + F4 pressed !');
if Msg.HotKey = id4 then
ShowMessage('Print Screen pressed !');
end;

procedure TForm1.FormCreate(Sender: TObject);
// Different Constants from Windows.pas
const
MOD_ALT = 1;
MOD_CONTROL = 2;
MOD_SHIFT = 4;
MOD_WIN = 8;
VK_A = $41;
VK_R = $52;
VK_F4 = $73;
begin
// Register Hotkey Ctrl + A
id1 := GlobalAddAtom('Hotkey1');
RegisterHotKey(Handle, id1, MOD_CONTROL, VK_A);

// Register Hotkey Ctrl + Alt + R
id2 := GlobalAddAtom('Hotkey2');
RegisterHotKey(Handle, id2, MOD_CONTROL + MOD_Alt, VK_R);

// Register Hotkey Win + F4
id3 := GlobalAddAtom('Hotkey3');
RegisterHotKey(Handle, id3, MOD_WIN, VK_F4);

// Globally trap the Windows system key "PrintScreen"
id4 := GlobalAddAtom('Hotkey4');
RegisterHotKey(Handle, id4, 0, VK_SNAPSHOT);
end;

// Unregister the Hotkeys
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(Handle, id1);
GlobalDeleteAtom(id1);
UnRegisterHotKey(Handle, id2);
GlobalDeleteAtom(id2);
UnRegisterHotKey(Handle, id3);
GlobalDeleteAtom(id3);
UnRegisterHotKey(Handle, id4);
GlobalDeleteAtom(id4);
end;

end.

Mahmood_M
چهارشنبه 26 آبان 1389, 15:30 عصر
قبل از ایجاد تاپیک جستجو کنید ! : " مقاله : استفاده ار HotKey ها (http://www.barnamenevis.org/forum/showthread.php?t=242705) "