ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Drag and Drop from explorer Win7

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
klausdoege Posted - Feb 04 2014 : 09:24:21
Hello,
how can i with drag and drop, a imagefile from windows explorer
insert into a imageenview ?
Have everybody a example ?

Klaus
www.klausdoege.de
10   L A T E S T    R E P L I E S    (Newest First)
Vitaly Posted - Sep 14 2016 : 12:26:00
procedure CreateParams(var Params: TCreateParams); override;

procedure TUFormOrImEnView.CreateParams(var Params: TCreateParams);
begin
inherited

CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_ACCEPTFILES;
end;


465124
w2m Posted - Feb 09 2014 : 11:03:14
In case others are following this thread I suggest the following:

On Vista and Windows 7 you can't send messages to a process with a higher integrity level. If your process is being run as administrator then it will have a higher integrity level than explorer and so won't accept the dropped files. If you are running Windows as administrator with UAC turned off, turn UAC back on and then recompile the demo.

All Delphi developers are encouraged to always run Delphi with UAC (User Account control) turned on.

This solved Klaus's problem.

Here is a link that shows how to turn UAC on/off with Windows 7.
http://windows.microsoft.com/en-us/windows/turn-user-account-control-on-off#1TC=windows-7

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
klausdoege Posted - Feb 07 2014 : 07:14:56
Hi Bill,
the Demeo works with XP fine, but not with Windows 7.
Tank you for your Help.


Klaus
www.klausdoege.de
w2m Posted - Feb 05 2014 : 08:59:23
Did you get the demo I emailed you?

William Miller
w2m Posted - Feb 05 2014 : 06:47:35
What version of Windows?
What version of ImageEn?

I am using Windows 8.1 and DelphiXE4 now, but previously the code also worked with Windows 7 and previous versions of ImageEn.

I have no problems here.

William Miller
klausdoege Posted - Feb 05 2014 : 06:19:27
It's only one form.
When i start with f4 in the wmdropfile procedure, i can
see nothing by drag and drop?

klaus


Klaus
www.klausdoege.de
w2m Posted - Feb 05 2014 : 05:34:54
The code I posted was tested and it works here. How many forms are you dragging and dropping to? This code just allows dropping to the main form as I have not tested dropping to secondary forms.

William Miller
klausdoege Posted - Feb 05 2014 : 05:11:54
Hello William,
it not works ?
Must i set every property by TForm or Imageenview ?
The Procedure WMDropFiles(var Message: TWMDropFiles);
not work.
regards
Klaus


Klaus
www.klausdoege.de
klausdoege Posted - Feb 04 2014 : 14:08:06
Hello William,

thank you, I have looked exactly for that.
I will immediately try it.

greet
Klaus

Klaus
www.klausdoege.de
w2m Posted - Feb 04 2014 : 10:16:01
Here is one way to do it.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, imageenview, ieview, ComCtrls;

type
  TForm1 = class(TForm)
    ImageEnView1: TImageEnView;
    StatusBar1: TStatusBar;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  protected
    { Protected declarations }
    procedure WMDropFiles(var Message: TWMDropFiles); message WM_DROPFILES;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses ShellAPI, hyieutils, imageenio;

procedure TForm1.FormCreate(Sender: TObject);
begin
  { Activate accepting files from the Windows shell }
  DragAcceptFiles(Self.Handle, True);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  { Deactivate accepting files from the Windows shell }
  DragAcceptFiles(Self.Handle, False);
end;

procedure TForm1.WMDropFiles(var Message: TWMDropFiles);
{ Handle dropping files to the form from Windows Explorer }
var
  i: Integer;
  iFilename: array [0 .. 256] of char;
  iNumberOfFiles: Integer;
  DropInfo: HDROP;
begin
  Screen.Cursor := crHourGlass;
  try
    try
      iNumberOfFiles := DragQueryFile(message.Drop, $FFFFFFFF, nil, 0);
      if iNumberOfFiles = 1 then
      begin
        DragQueryFile(message.Drop, 0, iFilename, SizeOf(iFilename));
        if (FileExists(iFilename)) and (IsKnownFormat(iFilename)) then
        begin
          ImageEnView1.IO.LoadFromFile(iFilename);
          ImageEnView1.Proc.ClearAllUndo;
          ImageEnView1.Proc.ClearAllRedo;
          ImageEnView1.MouseInteract := [];
          StatusBar1.Panels[0].Text := ExtractFileDir(iFilename);
          StatusBar1.Panels[1].Text := ExtractFileName(iFilename);
        end
        else
        begin
          MessageBox(0, 'The file is not supported.', 'Warning',
            MB_ICONWARNING or MB_OK);
        end;
      end
      else
        MessageBox(0,
          'This application only allows dropping one file at a time.',
          'Warning', MB_ICONWARNING or MB_OK);
    finally
      DragFinish(message.Drop);
    end;
    inherited;
  finally
    Screen.Cursor := crDefault;
  end;
end;

end.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html