Hi all,

For an application I am making I want to allow the user to drag an image off their browser directly into my app. There are a number of examples on the net and that is what I used. The code i have works with IE and also seems to work in Windows XP.

However, with Vista dragging a jpg off a internet site to the app results in the temp file not being available.

When dragging from firefox acFileName has a link to a file that no longer exists. I can't work out why that happens. If I drag from firefox to say Photoshop then I have no problems.

Anyone got a solution? Or a different routine I could try?

Code:
procedure TForm1.AcceptFiles(var Msg: TMessage);
const
 cnMaxFileNameLen = 255;
var
 nCount, i : Integer;
 acFileName : Array [0..cnMaxFileNameLen] Of Char;
 DropPosition : TPoint;
 DropControl : TControl;
begin
 nCount := DragQueryFile(Msg.WParam,$FFFFFFFF,acFileName,cnMaxFileNameLen);


 for i := 0 to -1 + nCount do
  begin
  Try
   DragQueryFile(Msg.WParam,i,acFileName,cnMaxFileNameLen);


   If UpperCase(ExtractFileExt(acFileName)) = '.JPG' Then
    begin
    image2.Picture.LoadFromFile(acFileName);
   end
   Else If UpperCase(ExtractFileExt(acFileName)) = '.BMP' Then
    begin
    image2.Picture.LoadFromFile(acFileName);
   end;
  Finally
  memo1.Lines.Insert(0, acFileName) ;
  end;
 end;
 DragFinish(Msg.WParam);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 DragAcceptFiles(Handle,True);
end;
http://www.orangepeel.co.nz/cabal/dragndrop_delphi.zip

So it does work with images off local machine and using IE but it doesn't work correctly for Firefox (might be working under windows xp)