Revision: 11828
http://jvcl.svn.sourceforge.net/jvcl/?rev=11828&view=rev
Author: obones
Date: 2008-07-23 13:28:54 +0000 (Wed, 23 Jul 2008)
Log Message:
-----------
Mantis 4387: Added GetFilenamesW, in unicode
Modified Paths:
--------------
trunk/jvcl/run/JvDragDrop.pas
Modified: trunk/jvcl/run/JvDragDrop.pas
===================================================================
--- trunk/jvcl/run/JvDragDrop.pas 2008-07-21 22:27:50 UTC (rev 11827)
+++ trunk/jvcl/run/JvDragDrop.pas 2008-07-23 13:28:54 UTC (rev 11828)
@@ -36,7 +36,7 @@
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
Windows, Messages, ShellAPI, ActiveX, Classes, Controls,
- JvComponentBase;
+ JvComponentBase, JclWideStrings;
type
TJvDropTarget = class;
@@ -84,15 +84,18 @@
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
- function GetFilenames(List: TStrings): Integer;
// GetFilenames returns the HDROP Filenames. (same as TJvDragDrop).
// Return value: number of filenames
+ function GetFilenames(List: TStrings): Integer;
+ // GetFilenamesW returns the HDROP Filenames, in unicode.
+ // Return value: number of filenames
+ function GetFilenamesW(List: TWideStrings): Integer;
+ // GetFileDescrNames returns the File Descriptor file names (not available for Explorer drag/drop)
function GetFileDescrNames(List: TStrings): Integer;
- // GetFileDescrNames returns the File Descriptor file names (not available for Explorer drag/drop)
+ // GetFileDescrCount returns the number of File Descroptor file names.
function GetFileDescrCount: Integer;
- // GetFileDescrCount returns the number of File Descroptor file names.
+ // GetFileContent returns the file content of the File Descriptor
function GetFileContent(Index: Integer; Stream: TStream): Boolean;
- // GetFileContent returns the file content of the File Descriptor
property DataObject: IDataObject read FDataObject;
published
property AcceptDrag: Boolean read FAcceptDrag write SetAcceptDrag default True;
@@ -713,6 +716,44 @@
end;
end;
+function TJvDropTarget.GetFilenamesW(List: TWideStrings): Integer;
+var
+ DragH: Integer;
+ Medium: TStgMedium;
+ Name: widestring;
+ I, Count, Len: Integer;
+begin
+ Result := 0;
+ if FDataObject.GetData(FileDropFormatEtc, Medium) = S_OK then
+ try
+ try
+ DragH := Integer(GlobalLock(Medium.hGlobal));
+ try
+ Count := DragQueryFileW(DragH, Cardinal(-1), nil, 0);
+ if List <> nil then
+ for I := 0 to Count - 1 do
+ begin
+ Len := DragQueryFileW(DragH, I, nil, 0);
+ if Len > 0 then
+ begin
+ SetLength(Name, Len + 1);
+ DragQueryFileW(DragH, I, PwideChar(Name), Len + 1);
+ SetLength(Name, Len);
+ List.Append(Name);
+ end;
+ end;
+ Result := Count;
+ finally
+ GlobalUnlock(Medium.hGlobal);
+ end;
+ finally
+ ReleaseStgMedium(Medium);
+ end;
+ except
+ Result := 0;
+ end;
+end;
+
function TJvDropTarget.GetFileContent(Index: Integer; Stream: TStream): Boolean;
const
MaxBufSize = 100 * 1024;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|