什么URL的拖放?
倒是可以对任意的输入焦点如Edit,将其中的内容取出,
用GetFocus
//定义一个全局热键。 (Win + A)
procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterHotKey(Handle, 1001, MOD_WIN, 65);
end;
//定义:procedure WMHotKey(var Msg: TMessage); message WM_HOTKEY;
procedure TForm1.WMHotKey(var Msg: TMessage);
var
CurThreadID, AttThreadID: THandle;
begin
if Msg.WParam = 1001 then //如果是收到自定义的消息。则将当前正在输入焦点的内容copy, 然后paste 到memo中
begin
CurThreadID := GetCurrentThreadID;
AttThreadID := GetWindowThreadProcessId(GetForegroundWindow, nil);
AttachThreadInput(CurThreadID, AttThreadID, True);
SendMessage(GetFocus, WM_COPY, 0, 0);
SendMessage(Memo1.Handle, WM_PASTE, 0, 0);
AttachThreadInput(CurThreadID, AttThreadID, False);
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(Handle, 1001);
end;