Windows 8 x64 I can't drag&drop files from Windows Explo
Moderators: Hacker, petermad, Stefan2, white
Windows 8 x64 I can't drag&drop files from Windows Explo
I have OS Windows 8 x64 and using TC x64 v. 8.01 and I can't drag&drop files from Windows Explorer.
Running as Administrator is not elevated !jurot wrote:I'm running TC as administrator.
But I tried to run TC as non-administrator - no change.
Elevated is when the UAC asks for more rights and you say yes.
Drag and Drop from normal Windows Explorer to any normal running TC works fine here for the same environment.
2jurot
Is it really necessary for you to run TC with admin privileges? For example, most of the time I don't need them. And when I want to do a bunch of operations that need such privileges, TC asks me for them and I choose "All as Administrator". That way TC won't asks for them again for a few minutes and usually that's all the time I need.
It's safer this way, not too cumbersome (at least for me) and it solves a few issues (like the drag-and-drop).
Is it really necessary for you to run TC with admin privileges? For example, most of the time I don't need them. And when I want to do a bunch of operations that need such privileges, TC asks me for them and I choose "All as Administrator". That way TC won't asks for them again for a few minutes and usually that's all the time I need.
It's safer this way, not too cumbersome (at least for me) and it solves a few issues (like the drag-and-drop).
Windows 10 Pro x64, Windows 11 Pro x64
The problem will be solved in the future, as the Author said, maybe in Total Commander 8.1. See this thread: http://www.ghisler.ch/board/viewtopic.php?t=34523.
Regards
Regards
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Actually I have tried this workaround, but it doesn't work with OLE drag&drop, because it uses callbacks and not Windows messages.
Here you can find the explanation why it doesn't work: Stackoverflow
Here you can find the explanation why it doesn't work: Stackoverflow
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Mmmhmm, strange. They tell in this thread about RegisterDragDrop API, which uses IDropTarget interface. Is there any reason for using interfaces directly, in order to be a _target_ of drag&drop operations?
The simple code below works for me. I just tested it now with Win7 64-bit, my elevated application was 32-bit and I successfully draged&dropped files from Explorer to this application. After removing "DragDropInit(Handle);" line, application - when elevated - stopped to receive drag&drop from Explorer.
The simple code below works for me. I just tested it now with Win7 64-bit, my elevated application was 32-bit and I successfully draged&dropped files from Explorer to this application. After removing "DragDropInit(Handle);" line, application - when elevated - stopped to receive drag&drop from Explorer.
Code: Select all
unit Unit1;
interface
uses
Messages, Classes, Controls, Forms, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
procedure WMDropFiles(var Message : TMessage); message WM_DROPFILES;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
uses
Windows, ShellAPI;
procedure TForm1.FormCreate(Sender: TObject);
begin
DragDropInit(Handle); {http://www.ghisler.ch/board/viewtopic.php?t=34523}
DragAcceptFiles(Handle,True);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
DragAcceptFiles(Handle,False);
end;
procedure TForm1.WMDropFiles(var Message : TMessage);
var
I : Cardinal;
FileName : packed array[0..MAX_COMPUTERNAME_LENGTH+MAX_PATH] of AnsiChar;
begin
Memo1.Clear;
I:=DragQueryFile(Message.wParam,Cardinal(-1),FileName,Length(FileName));
for I:=0 to I-1 do
if DragQueryFile(Message.wParam,I,FileName,SizeOf(FileName)) > 0 then
begin
Memo1.Lines.Add(FileName);
Application.BringToFront;
end;
DragFinish(Message.wParam);
{Don't call "inherited" here!}
end;
end.
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Yes, TC is registering IDropTarget so it can receive OLE objects other than files (e.g. drags from virtual folders or mail attachments).
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Well, Microsoft states that there is definitely no way to perform drag&drop from non-elevated to elevated applications, when using COM objects:
The COM Elevation Moniker: "Drag and drop is not allowed from non-elevated to elevated applications."
The COM Elevation Moniker: "Drag and drop is not allowed from non-elevated to elevated applications."