Drag/Dropping files onto program
Posted on 2002-03-19
good day all,
i use the following code to open a file that is dropped on my program.
problem is my prog looks to see if file is already open.
if user double clicks on a file.. it is opened normally.
but if user drags/drops file.. the filename is changed to short name (ie: 'program files' becomes 'progra~1').
so now filecompare function sees it as 2 different files.
i would like to either show longfilename as dropped file or alternatively compare short to short.
this code is in a program written in delphi 3
thanx 4 all help..
procedure TForm1.WMDropFiles(var Msg: TWMDropFiles);
FileName: array[0..MAX_PATH] of Char;
if (DragQueryFile(Msg.Drop, 0, FileName, MAX_PATH) > 0) and (FileExists(FileName)) then
if AnsiCompareFileName(somefile,FileName) = 0 then
###file is already open###
Msg.Result := 0;