Skip to content

Commit 6a28eaf

Browse files
committed
If files were dropped and drop effect was "move", then override to "copy" so original item is not deleted
1 parent 278793b commit 6a28eaf

File tree

5 files changed

+92
-35
lines changed

5 files changed

+92
-35
lines changed

OutlookFileDrag/DragDropHook.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,15 @@ public static int DoDragDropHook(NativeMethods.IDataObject pDataObj, IntPtr pDro
8989
log.Info("Virtual files found -- starting new drag adding CF_HDROP format");
9090
log.InfoFormat("Files: {0}", string.Join(",", DataObjectHelper.GetFilenames(pDataObj)));
9191

92-
NativeMethods.IDataObject newDataObj = new OutlookDataObject(pDataObj);
92+
OutlookDataObject newDataObj = new OutlookDataObject(pDataObj);
9393
int result = NativeMethods.DoDragDrop(newDataObj, pDropSource, dwOKEffects, out pdwEffect);
9494

95+
//If files were dropped and drop effect was "move", then override to "copy" so original item is not deleted
96+
if (newDataObj.FilesDropped && pdwEffect == NativeMethods.DROPEFFECT_MOVE)
97+
pdwEffect = NativeMethods.DROPEFFECT_COPY;
98+
9599
//Get result
96-
log.InfoFormat("DoDragDrop result: {0}", result);
100+
log.InfoFormat("DoDragDrop effect: {0} result: {1}", pdwEffect, result);
97101
return result;
98102
}
99103
catch (Exception ex)

OutlookFileDrag/OutlookDataObject.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class OutlookDataObject : NativeMethods.IDataObject, ICustomQueryInterface
1414
private string[] tempFilenames;
1515
private static ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
1616

17+
public bool FilesDropped { get; private set; }
18+
1719
public OutlookDataObject(NativeMethods.IDataObject innerData)
1820
{
1921
this.innerData = innerData;
@@ -143,6 +145,7 @@ public int GetData(ref FORMATETC format, out STGMEDIUM medium)
143145
//Get list of dropped files
144146
log.Debug("Setting drop files");
145147
DataObjectHelper.SetDropFiles(ref medium, tempFilenames);
148+
FilesDropped = true;
146149
return NativeMethods.S_OK;
147150
}
148151
else if (format.cfFormat == NativeMethods.CF_TEXT || format.cfFormat == NativeMethods.CF_UNICODETEXT || format.cfFormat == (ushort)DataObjectHelper.GetClipboardFormat("Csv"))

OutlookFileDrag/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[assembly: AssemblyConfiguration("")]
1212
[assembly: AssemblyCompany("Tony Federer")]
1313
[assembly: AssemblyProduct("Outlook File Drag")]
14-
[assembly: AssemblyCopyright("Copyright © 2018 Tony Federer")]
14+
[assembly: AssemblyCopyright("Copyright © 2019 Tony Federer")]
1515
[assembly: AssemblyTrademark("")]
1616
[assembly: AssemblyCulture("")]
1717

@@ -33,6 +33,6 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("1.0.8.0")]
37-
[assembly: AssemblyFileVersion("1.0.8.0")]
36+
[assembly: AssemblyVersion("1.0.9.0")]
37+
[assembly: AssemblyFileVersion("1.0.9.0")]
3838

OutlookFileDragSetup/OutlookFileDragSetup.vdproj

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@
6464
"Entry"
6565
{
6666
"MsmKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
67-
"OwnerKey" = "8:_54EF5F74A56C4AEE96D4330B540B4A3A"
67+
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
6868
"MsmSig" = "8:_UNDEFINED"
6969
}
7070
"Entry"
7171
{
7272
"MsmKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
73-
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
73+
"OwnerKey" = "8:_54EF5F74A56C4AEE96D4330B540B4A3A"
7474
"MsmSig" = "8:_UNDEFINED"
7575
}
7676
"Entry"
@@ -142,61 +142,61 @@
142142
"Entry"
143143
{
144144
"MsmKey" = "8:_UNDEFINED"
145-
"OwnerKey" = "8:_591351D571FEB540A92347F0F74B55CE"
145+
"OwnerKey" = "8:_CE28E7CBCA9C5EDB3BD3A2F1F2116DF9"
146146
"MsmSig" = "8:_UNDEFINED"
147147
}
148148
"Entry"
149149
{
150150
"MsmKey" = "8:_UNDEFINED"
151-
"OwnerKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
151+
"OwnerKey" = "8:_15F0BD9071B5889215577FD20EC63766"
152152
"MsmSig" = "8:_UNDEFINED"
153153
}
154154
"Entry"
155155
{
156156
"MsmKey" = "8:_UNDEFINED"
157-
"OwnerKey" = "8:_9B3B11113C57483FCBDDB37CB3ED5F37"
157+
"OwnerKey" = "8:_C3161A936F4192497A0972C3EC781BF6"
158158
"MsmSig" = "8:_UNDEFINED"
159159
}
160160
"Entry"
161161
{
162162
"MsmKey" = "8:_UNDEFINED"
163-
"OwnerKey" = "8:_BB365CE8FF8B85A3589349A35DAB0785"
163+
"OwnerKey" = "8:_12FE3AC54ED17E0AB1007324ABFD58D1"
164164
"MsmSig" = "8:_UNDEFINED"
165165
}
166166
"Entry"
167167
{
168168
"MsmKey" = "8:_UNDEFINED"
169-
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
169+
"OwnerKey" = "8:_133D4E0B8AD91071625356F7F9F22C66"
170170
"MsmSig" = "8:_UNDEFINED"
171171
}
172172
"Entry"
173173
{
174174
"MsmKey" = "8:_UNDEFINED"
175-
"OwnerKey" = "8:_133D4E0B8AD91071625356F7F9F22C66"
175+
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
176176
"MsmSig" = "8:_UNDEFINED"
177177
}
178178
"Entry"
179179
{
180180
"MsmKey" = "8:_UNDEFINED"
181-
"OwnerKey" = "8:_12FE3AC54ED17E0AB1007324ABFD58D1"
181+
"OwnerKey" = "8:_BB365CE8FF8B85A3589349A35DAB0785"
182182
"MsmSig" = "8:_UNDEFINED"
183183
}
184184
"Entry"
185185
{
186186
"MsmKey" = "8:_UNDEFINED"
187-
"OwnerKey" = "8:_C3161A936F4192497A0972C3EC781BF6"
187+
"OwnerKey" = "8:_9B3B11113C57483FCBDDB37CB3ED5F37"
188188
"MsmSig" = "8:_UNDEFINED"
189189
}
190190
"Entry"
191191
{
192192
"MsmKey" = "8:_UNDEFINED"
193-
"OwnerKey" = "8:_15F0BD9071B5889215577FD20EC63766"
193+
"OwnerKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
194194
"MsmSig" = "8:_UNDEFINED"
195195
}
196196
"Entry"
197197
{
198198
"MsmKey" = "8:_UNDEFINED"
199-
"OwnerKey" = "8:_CE28E7CBCA9C5EDB3BD3A2F1F2116DF9"
199+
"OwnerKey" = "8:_591351D571FEB540A92347F0F74B55CE"
200200
"MsmSig" = "8:_UNDEFINED"
201201
}
202202
}
@@ -321,6 +321,11 @@
321321
"AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Tools.Applications.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
322322
"ScatterAssemblies"
323323
{
324+
"_12FE3AC54ED17E0AB1007324ABFD58D1"
325+
{
326+
"Name" = "8:Microsoft.VisualStudio.Tools.Applications.Runtime.dll"
327+
"Attributes" = "3:512"
328+
}
324329
}
325330
"SourcePath" = "8:Microsoft.VisualStudio.Tools.Applications.Runtime.dll"
326331
"TargetName" = "8:"
@@ -347,6 +352,11 @@
347352
"AssemblyAsmDisplayName" = "8:Microsoft.Office.Tools.Outlook.v4.0.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
348353
"ScatterAssemblies"
349354
{
355+
"_133D4E0B8AD91071625356F7F9F22C66"
356+
{
357+
"Name" = "8:Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll"
358+
"Attributes" = "3:512"
359+
}
350360
}
351361
"SourcePath" = "8:Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll"
352362
"TargetName" = "8:"
@@ -373,6 +383,11 @@
373383
"AssemblyAsmDisplayName" = "8:EasyHook, Version=2.7.6578.0, Culture=neutral, PublicKeyToken=4b580fca19d0b0c5, processorArchitecture=MSIL"
374384
"ScatterAssemblies"
375385
{
386+
"_15F0BD9071B5889215577FD20EC63766"
387+
{
388+
"Name" = "8:EasyHook.dll"
389+
"Attributes" = "3:512"
390+
}
376391
}
377392
"SourcePath" = "8:EasyHook.dll"
378393
"TargetName" = "8:"
@@ -399,6 +414,11 @@
399414
"AssemblyAsmDisplayName" = "8:Microsoft.Office.Tools.Outlook, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
400415
"ScatterAssemblies"
401416
{
417+
"_3DBBABF7C43171A6F7B4D8D682699556"
418+
{
419+
"Name" = "8:Microsoft.Office.Tools.Outlook.dll"
420+
"Attributes" = "3:512"
421+
}
402422
}
403423
"SourcePath" = "8:Microsoft.Office.Tools.Outlook.dll"
404424
"TargetName" = "8:"
@@ -425,6 +445,11 @@
425445
"AssemblyAsmDisplayName" = "8:Microsoft.Office.Tools, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
426446
"ScatterAssemblies"
427447
{
448+
"_5575AAAA0CAC3763D8DCDDD642FBD25F"
449+
{
450+
"Name" = "8:Microsoft.Office.Tools.dll"
451+
"Attributes" = "3:512"
452+
}
428453
}
429454
"SourcePath" = "8:Microsoft.Office.Tools.dll"
430455
"TargetName" = "8:"
@@ -451,6 +476,11 @@
451476
"AssemblyAsmDisplayName" = "8:stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
452477
"ScatterAssemblies"
453478
{
479+
"_591351D571FEB540A92347F0F74B55CE"
480+
{
481+
"Name" = "8:stdole.dll"
482+
"Attributes" = "3:512"
483+
}
454484
}
455485
"SourcePath" = "8:stdole.dll"
456486
"TargetName" = "8:"
@@ -497,6 +527,11 @@
497527
"AssemblyAsmDisplayName" = "8:Microsoft.Office.Tools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
498528
"ScatterAssemblies"
499529
{
530+
"_9B3B11113C57483FCBDDB37CB3ED5F37"
531+
{
532+
"Name" = "8:Microsoft.Office.Tools.Common.dll"
533+
"Attributes" = "3:512"
534+
}
500535
}
501536
"SourcePath" = "8:Microsoft.Office.Tools.Common.dll"
502537
"TargetName" = "8:"
@@ -543,6 +578,11 @@
543578
"AssemblyAsmDisplayName" = "8:Microsoft.Office.Tools.Common.v4.0.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
544579
"ScatterAssemblies"
545580
{
581+
"_BB365CE8FF8B85A3589349A35DAB0785"
582+
{
583+
"Name" = "8:Microsoft.Office.Tools.Common.v4.0.Utilities.dll"
584+
"Attributes" = "3:512"
585+
}
546586
}
547587
"SourcePath" = "8:Microsoft.Office.Tools.Common.v4.0.Utilities.dll"
548588
"TargetName" = "8:"
@@ -569,6 +609,11 @@
569609
"AssemblyAsmDisplayName" = "8:Microsoft.Office.Tools.v4.0.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
570610
"ScatterAssemblies"
571611
{
612+
"_C3161A936F4192497A0972C3EC781BF6"
613+
{
614+
"Name" = "8:Microsoft.Office.Tools.v4.0.Framework.dll"
615+
"Attributes" = "3:512"
616+
}
572617
}
573618
"SourcePath" = "8:Microsoft.Office.Tools.v4.0.Framework.dll"
574619
"TargetName" = "8:"
@@ -595,6 +640,11 @@
595640
"AssemblyAsmDisplayName" = "8:log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"
596641
"ScatterAssemblies"
597642
{
643+
"_CE28E7CBCA9C5EDB3BD3A2F1F2116DF9"
644+
{
645+
"Name" = "8:log4net.dll"
646+
"Attributes" = "3:512"
647+
}
598648
}
599649
"SourcePath" = "8:log4net.dll"
600650
"TargetName" = "8:"
@@ -690,15 +740,15 @@
690740
{
691741
"Name" = "8:Microsoft Visual Studio"
692742
"ProductName" = "8:Outlook File Drag"
693-
"ProductCode" = "8:{F198B620-5A06-4AE0-883E-B948E8DEEB3A}"
694-
"PackageCode" = "8:{E5ACAFF7-42AA-4A04-93FB-EF1BA5CEF265}"
743+
"ProductCode" = "8:{1D0185D6-D937-4CBF-BF9E-53727890A6D4}"
744+
"PackageCode" = "8:{BCC58C14-E43D-4F5D-9B37-CA085087F60A}"
695745
"UpgradeCode" = "8:{2F626147-8F83-4FC1-9190-32AA4F25D487}"
696746
"AspNetVersion" = "8:4.0.30319.0"
697747
"RestartWWWService" = "11:FALSE"
698748
"RemovePreviousVersions" = "11:TRUE"
699749
"DetectNewerInstalledVersion" = "11:TRUE"
700750
"InstallAllUsers" = "11:TRUE"
701-
"ProductVersion" = "8:1.0.8"
751+
"ProductVersion" = "8:1.0.9"
702752
"Manufacturer" = "8:Tony Federer"
703753
"ARPHELPTELEPHONE" = "8:"
704754
"ARPHELPLINK" = "8:https://github.com/tonyfederer/OutlookFileDrag"

OutlookFileDragSetup_x64/OutlookFileDragSetup_x64.vdproj

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@
5858
"Entry"
5959
{
6060
"MsmKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
61-
"OwnerKey" = "8:_54EF5F74A56C4AEE96D4330B540B4A3A"
61+
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
6262
"MsmSig" = "8:_UNDEFINED"
6363
}
6464
"Entry"
6565
{
6666
"MsmKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
67-
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
67+
"OwnerKey" = "8:_54EF5F74A56C4AEE96D4330B540B4A3A"
6868
"MsmSig" = "8:_UNDEFINED"
6969
}
7070
"Entry"
@@ -148,61 +148,61 @@
148148
"Entry"
149149
{
150150
"MsmKey" = "8:_UNDEFINED"
151-
"OwnerKey" = "8:_591351D571FEB540A92347F0F74B55CE"
151+
"OwnerKey" = "8:_CE28E7CBCA9C5EDB3BD3A2F1F2116DF9"
152152
"MsmSig" = "8:_UNDEFINED"
153153
}
154154
"Entry"
155155
{
156156
"MsmKey" = "8:_UNDEFINED"
157-
"OwnerKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
157+
"OwnerKey" = "8:_15F0BD9071B5889215577FD20EC63766"
158158
"MsmSig" = "8:_UNDEFINED"
159159
}
160160
"Entry"
161161
{
162162
"MsmKey" = "8:_UNDEFINED"
163-
"OwnerKey" = "8:_9B3B11113C57483FCBDDB37CB3ED5F37"
163+
"OwnerKey" = "8:_C3161A936F4192497A0972C3EC781BF6"
164164
"MsmSig" = "8:_UNDEFINED"
165165
}
166166
"Entry"
167167
{
168168
"MsmKey" = "8:_UNDEFINED"
169-
"OwnerKey" = "8:_BB365CE8FF8B85A3589349A35DAB0785"
169+
"OwnerKey" = "8:_12FE3AC54ED17E0AB1007324ABFD58D1"
170170
"MsmSig" = "8:_UNDEFINED"
171171
}
172172
"Entry"
173173
{
174174
"MsmKey" = "8:_UNDEFINED"
175-
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
175+
"OwnerKey" = "8:_133D4E0B8AD91071625356F7F9F22C66"
176176
"MsmSig" = "8:_UNDEFINED"
177177
}
178178
"Entry"
179179
{
180180
"MsmKey" = "8:_UNDEFINED"
181-
"OwnerKey" = "8:_133D4E0B8AD91071625356F7F9F22C66"
181+
"OwnerKey" = "8:_3DBBABF7C43171A6F7B4D8D682699556"
182182
"MsmSig" = "8:_UNDEFINED"
183183
}
184184
"Entry"
185185
{
186186
"MsmKey" = "8:_UNDEFINED"
187-
"OwnerKey" = "8:_12FE3AC54ED17E0AB1007324ABFD58D1"
187+
"OwnerKey" = "8:_BB365CE8FF8B85A3589349A35DAB0785"
188188
"MsmSig" = "8:_UNDEFINED"
189189
}
190190
"Entry"
191191
{
192192
"MsmKey" = "8:_UNDEFINED"
193-
"OwnerKey" = "8:_C3161A936F4192497A0972C3EC781BF6"
193+
"OwnerKey" = "8:_9B3B11113C57483FCBDDB37CB3ED5F37"
194194
"MsmSig" = "8:_UNDEFINED"
195195
}
196196
"Entry"
197197
{
198198
"MsmKey" = "8:_UNDEFINED"
199-
"OwnerKey" = "8:_15F0BD9071B5889215577FD20EC63766"
199+
"OwnerKey" = "8:_5575AAAA0CAC3763D8DCDDD642FBD25F"
200200
"MsmSig" = "8:_UNDEFINED"
201201
}
202202
"Entry"
203203
{
204204
"MsmKey" = "8:_UNDEFINED"
205-
"OwnerKey" = "8:_CE28E7CBCA9C5EDB3BD3A2F1F2116DF9"
205+
"OwnerKey" = "8:_591351D571FEB540A92347F0F74B55CE"
206206
"MsmSig" = "8:_UNDEFINED"
207207
}
208208
}
@@ -716,15 +716,15 @@
716716
{
717717
"Name" = "8:Microsoft Visual Studio"
718718
"ProductName" = "8:Outlook File Drag"
719-
"ProductCode" = "8:{4D17A106-6F0C-469A-BC97-9B71E79B3CA8}"
720-
"PackageCode" = "8:{EBCA38DE-16CA-486D-AF62-B375FD13A4B5}"
719+
"ProductCode" = "8:{46A0554A-5E74-4C98-8B83-C039167DA9C3}"
720+
"PackageCode" = "8:{7004BDCB-140D-41EC-A370-FBA5CF6056A1}"
721721
"UpgradeCode" = "8:{65870D9B-6652-4150-830B-C5199F26E62C}"
722722
"AspNetVersion" = "8:4.0.30319.0"
723723
"RestartWWWService" = "11:FALSE"
724724
"RemovePreviousVersions" = "11:TRUE"
725725
"DetectNewerInstalledVersion" = "11:TRUE"
726726
"InstallAllUsers" = "11:TRUE"
727-
"ProductVersion" = "8:1.0.8"
727+
"ProductVersion" = "8:1.0.9"
728728
"Manufacturer" = "8:Tony Federer"
729729
"ARPHELPTELEPHONE" = "8:"
730730
"ARPHELPLINK" = "8:https://github.com/tonyfederer/OutlookFileDrag"

0 commit comments

Comments
 (0)