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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 13.1.0 Error found in function PasteFilesFromClipboard
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

foxdingding

77 Posts

Posted - Jun 02 2024 :  04:59:28  Show Profile  Reply
Error found in function iexWindowsFunctions.PasteFilesFromClipboard

13.1.0

xequte

38458 Posts

Posted - Jun 02 2024 :  14:06:27  Show Profile  Reply
Hi

What is the error?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

foxdingding

77 Posts

Posted - Jun 03 2024 :  07:44:19  Show Profile  Reply




I rewrote this function without reporting the error mentioned above.


class function TMyFun.My_PasteFilesFromClipboard(
  out bMoveFiles: Boolean): TArray<String>;
var
  DropHandle, DropEffect, Effect : HDROP;
  FileCount:Integer;
  Counter:Integer;
  FileName:array [0..MAX_PATH] of char;
const
  DROPEFFECT_NONE   = 0;
  DROPEFFECT_COPY   = 1;
  DROPEFFECT_MOVE   = 2;
  DROPEFFECT_LINK   = 4;
  DROPEFFECT_SCROLL = $80000000;
begin
  Result:=[];
  bMoveFiles:=false;

  OpenClipboard(0);
  Try
      DropEffect := RegisterClipboardFormat('Preferred DropEffect');
      DropHandle := GetClipboardData(CF_HDROP);
      if DropHandle>0 then
      begin
        Effect := GetClipboardData(DropEffect);
        if Effect=0 then Effect := DROPEFFECT_COPY
        else Effect := PDWORD(Effect)^;
        case Effect of
          DROPEFFECT_COPY + DROPEFFECT_LINK:bMoveFiles:=false;
          DROPEFFECT_MOVE                  :bMoveFiles:=TRUE;
        end;

        FileCount:=DragQueryFile(DropHandle,Cardinal(-1),nil,0);
        for Counter := 0 to FileCount-1 do
        begin
          DragQueryFile(DropHandle, Counter, FileName, sizeof(FileName));
          Result:=Result+[FileName];
        end;
      end;
  Finally
      CloseClipboard;
  End;
end;



Go to Top of Page

xequte

38458 Posts

Posted - Jun 03 2024 :  23:48:55  Show Profile  Reply
Hi

I cannot see any issues in our method. What version of Delphi are you using? Can you give me some specific steps to reproduce?

Does it only happen with unicode filenames (e.g. filenames that contain Chinese characters)?

There look to be some errors in your code above, so please check it carefully.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

foxdingding

77 Posts

Posted - Aug 06 2024 :  01:38:39  Show Profile  Reply
This error has been corrected in ImageEn 13.5!
ImageEn 13.5.0 did not report this error!


iexWindowsFunctions.PasteFilesFromClipboard is OK!!
Go to Top of Page

xequte

38458 Posts

Posted - Aug 06 2024 :  01:40:28  Show Profile  Reply
Thank you for letting us know.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: