FIX: Bug [0001074] CTRL+V and CTRL+C do not work acrsoss Remote Desktop

This commit is contained in:
Alexander Koblov 2016-07-06 17:44:24 +00:00
commit 51bbc0f8bc
2 changed files with 37 additions and 3 deletions

View file

@ -91,7 +91,7 @@ implementation
uses
Clipbrd
{$IFDEF MSWINDOWS}
, Windows, ActiveX, uOleDragDrop, fMain
, Windows, ActiveX, uOleDragDrop, fMain, uShellContextMenu
{$ELSE IFDEF UNIX}
, LCLIntf
{$ENDIF}
@ -581,6 +581,16 @@ begin
hGlobalBuffer := GetClipboardData(CF_HDROP);
if hGlobalBuffer = 0 then
begin
with frmMain do
begin
CloseClipboard;
uShellContextMenu.PasteFromClipboard(Handle, ActiveFrame.CurrentPath);
Exit(False);
end;
end;
filenames := uOleDragDrop.TFileDropTarget.GetDropFilenames(hGlobalBuffer);
if Assigned(filenames) then

View file

@ -68,13 +68,14 @@ type
property OnClose: TNotifyEvent read FOnClose write FOnClose;
end;
function GetShellContextMenu(Handle: HWND; Files: TFiles; Background: boolean): IContextMenu;
procedure PasteFromClipboard(Parent: HWND; const Path: String);
function GetShellContextMenu(Handle: HWND; Files: TFiles; Background: boolean): IContextMenu;
implementation
uses
graphtype, intfgraphics, Graphics, uPixMapManager, uExts, LCLProc, Dialogs, uLng, uMyWindows, uShellExecute,
fMain, uDCUtils, uFormCommands, DCOSUtils, uOSUtils, uShowMsg;
fMain, uDCUtils, uFormCommands, DCOSUtils, uOSUtils, uShowMsg, uFileSystemFileSource;
const
USER_CMD_ID = $1000;
@ -786,5 +787,28 @@ begin
FOnClose(Self);
end;
procedure PasteFromClipboard(Parent: HWND; const Path: String);
var
AFile: TFile;
Files: TFiles;
ShellMenu: IContextMenu;
begin
Files:= TFiles.Create(EmptyStr);
try
AFile := TFileSystemFileSource.CreateFile(EmptyStr);
AFile.FullPath := Path;
AFile.Attributes := faFolder;
Files.Add(AFile);
ShellMenu:= GetShellContextMenu(Parent, Files, True);
if Assigned(ShellMenu) then begin
TShellThread.Create(Parent, ShellMenu, sCmdVerbPaste).Start;
end;
except
on E: Exception do
MessageDlg(E.Message, mtError, [mbOK], 0);
end;
FreeAndNil(Files);
end;
end.