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
 File DragDrop from Explorer to IEM not working

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
yogiyang Posted - Jan 02 2020 : 01:30:41
Hello,

When I was using IE 8.6.0 the following code was working fine:
procedure TfrmMain.DropFiles(Sender: TObject; ssFiles: TStrings;
  dwEffect: Integer);
{ Add the dropped image files to ImageEnMView }
var
  i: Integer;
  iFileCount: Integer;
  iDroppedFileName: string;
  iDroppedFilePath: string;
  iFileName: string;
  iFrameCount: Integer;
  iIndex: Integer;
begin
  iFileCount := ssFiles.Count;
  if iFileCount = 1 then
  begin { Single file dropped }
    iDroppedFileName := Trim(ssFiles.GetText);
    iDroppedFilePath := ExtractFileDir(iDroppedFileName);
    if FileExists(iDroppedFileName) then
    begin
      iFrameCount := IEGetFileFramesCount(iDroppedFileName);
      if iFrameCount = 0 then
      begin
        MessageBox(0,
          'The dropped file does not contain a supported image type.',
          'No Supported Image Types', MB_ICONWARNING or MB_OK);
        exit;
      end
      else if iFrameCount = 1 then
      begin
        { Single frame file }
        iFileName := ExtractFileName(iDroppedFileName);
        iIndex := iemPhotos.AppendImage(iDroppedFileName);
        if iemPhotos.MIO.Aborting then
        begin
          MessageBox(0,
            'There was an error opening the dropped image.  ImageEn can not open the image.',
            'Error Opening Image', MB_ICONWARNING or MB_OK);
          exit;
        end
        else
        begin
          iemPhotos.ImageBottomText[iIndex] := iFileName;
          iemPhotos.ImageInfoText[iIndex] :=
            IntToStr(iemPhotos.MIO.Params[iIndex].Width) + ' x ' +
            IntToStr(iemPhotos.MIO.Params[iIndex].Height);
          iemPhotos.SelectedImage := iemPhotos.ImageCount - 1; // iIndex;
        end;
      end;
    end;
  end
  else { Multiple files dropped }
  begin
    try
      Screen.Cursor := crHourGlass;
      for i := 0 to iFileCount - 1 do
      begin
        { Get filenames dropped }
        iDroppedFileName := Trim(ssFiles[i]);
        iDroppedFilePath := ExtractFileDir(iDroppedFileName);
        iemPhotos.InsertImage(i, iDroppedFileName);
        if iemPhotos.MIO.Aborting then
        begin
          MessageBox(0,
            'There was an error opening the dropped image.  ImageEn can not open the image.',
            'Error Opening Image', MB_ICONWARNING or MB_OK);
          exit;
        end
        else
        begin
          iemPhotos.ImageBottomText[i] := ExtractFileName(iDroppedFileName);
          iemPhotos.ImageInfoText[i] := IntToStr(iemPhotos.MIO.Params[i].Width)
            + ' x ' + IntToStr(iemPhotos.MIO.Params[i].Height);
        end;
      end;
      iemPhotos.SelectedImage := 0;
    finally
      Screen.Cursor := crDefault;
    end;
  end;
end;

procedure TfrmMain.FormCreate(Sender: TObject);
begin
iemPhotos.LookAhead := 500;
  iemPhotos.MaintainInvisibleImages := -1;
  iemPhotos.ShowText := True;
  iemPhotos.EnableAdjustOrientation := True;

{ Create a TIEFileDragDrop class }
  AFileDrop := TIEFileDragDrop.Create(iemPhotos, DropFiles);
  { Do not explicity free the FileDrop object }
  RegisterExpectedMemoryLeak(AFileDrop);
  { Activate dropping }
  AFileDrop.ActivateDropping := True;
end;



But in newer version this code is not working.

I also tried to use the component - TIEFileDragDrop but and still not able to receive any dropped files.

What to do?

TIA


Yogi Yang
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 05 2020 : 22:10:53
Hi Yogi

What version are you using?

This works fine in in v8.7.6:

procedure TForm1.DropFiles(Sender: TObject; ssFiles: TStrings; dwEffect: Integer);
var
  i: Integer;
  aFileName: string;
begin
  // Add the dropped image files to ImageEnMView
  for i := 0 to ssFiles.Count - 1 do
  begin
    aFileName := Trim(ssFiles[i]);
    iemPhotos.InsertImage(i, aFileName);
    iemPhotos.ImageBottomText[i] := ExtractFileName(aFileName);
  end;
  iemPhotos.SelectedImage := 0;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  AFileDrop := TIEFileDragDrop.Create(Self);
  AFileDrop.DropControl := iemPhotos;
  AFileDrop.OnFileDrop  := DropFiles;

  // Because we do not explicity free the FileDrop object
  RegisterExpectedMemoryLeak(AFileDrop);

  // Activate dropping
  AFileDrop.EnableDropping := True;
end;


Nigel
Xequte Software
www.imageen.com