Code: Select all
private void MouseMove(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left && _draggingHitInfo != null) {
Size dragSize = SystemInformation.DragSize;
var dragRect = new Rectangle(new Point(_eventArgs.X - dragSize.Width / 2, _eventArgs.Y - dragSize.Height / 2), dragSize);
if (!dragRect.Contains(new Point(e.X, e.Y))) {
var selNodes = dataGridView1.SelectedRows;
var paths = new System.Collections.Specialized.StringCollection();
foreach (DataGridViewRow node in selNodes) {
string path = node.Cells[0].Value?.ToString();
if (File.Exists(path))
paths.Add(path);
}
if (paths.Count > 0) {
var dataObj = new DataObject();
dataObj.SetFileDropList(paths);
dataGridView1.DoDragDrop(dataObj, DragDropEffects.Copy);
}
_draggingHitInfo = null;
_eventArgs = null;
}
}
}
private void MouseDown(object sender, MouseEventArgs e) {
HitTestInfo hitInfo = dataGridView1.HitTest(e.X, e.Y);
if (hitInfo.Type == DataGridViewHitTestType.Cell || hitInfo.Type == DataGridViewHitTestType.RowHeader) {
_draggingHitInfo = hitInfo;
_eventArgs = e;
}
}
< /code>
Das Formular enthält eine einfache DataGridView mit einer einzelnen Spalte, die den Vollfilmnamen jeder Datei enthält, wie folgt: < /p>
private void Form1_Load(object sender, EventArgs e) {
// change the file paths to your location.
object[] data1 = new object[] { "C:\\Users\\talignanid\\Desktop\\SampleDragDrop\\SampleDragDrop\\files\\Divisore.bmp" };
object[] data2 = new object[] { "C:\\Users\\talignanid\\Desktop\\SampleDragDrop\\SampleDragDrop\\files\\Esploso.jpg" };
object[] data3 = new object[] { "C:\\Users\\talignanid\\Desktop\\SampleDragDrop\\SampleDragDrop\\files\\Offerta 1.xlsx" };
DataTable dt = new DataTable();
dt.Columns.Add("Filename");
dt.Rows.Add(data1);
dt.Rows.Add(data2);
dt.Rows.Add(data3);
dataGridView1.DataSource = dt;
}
< /code>
Ich habe versucht, den Prozessmonitor zu verwenden, um einen Fehler innerhalb des Explorers beim Löschen, aber ohne Erfolg zu fangen. Gleiches gilt für meine Bewerbung. Wenn Explorer nicht mehr reagiert, friert mein Programm offensichtlich auch ein. Das Töten des Explorer.exe -Prozesses weckt mein Programm auf, aber das gleiche geschieht nicht beim Töten meines Programms: Windows Explorer bleibt in diesem unerschütterlichen Zustand. Schließlich kann ich beim Neustarten von Explorer.exe sehen, dass die Dateien im Ordner korrekt kopiert werden. Das [url=viewtopic.php?t=20324]Problem[/url] muss also [b] nach [/b] die Kopie bereits abgeschlossen sein.
mache ich etwas falsches in meinem Code? Ist es ein bekanntes Problem? Gibt es eine Problemumgehung?*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
KEY_VALUES_STRING: 1
Key : Analysis.CPU.mSec
Value: 5750
Key : Analysis.Elapsed.mSec
Value: 5921
Key : Analysis.IO.Other.Mb
Value: 0
Key : Analysis.IO.Read.Mb
Value: 2
Key : Analysis.IO.Write.Mb
Value: 3
Key : Analysis.Init.CPU.mSec
Value: 14500
Key : Analysis.Init.Elapsed.mSec
Value: 1312266
Key : Analysis.Memory.CommitPeak.Mb
Value: 520
Key : Analysis.Version.DbgEng
Value: 10.0.27829.1001
Key : Analysis.Version.Description
Value: 10.2503.24.01 amd64fre
Key : Analysis.Version.Ext
Value: 1.2503.24.1
Key : Failure.Bucket
Value: APPLICATION_HANG_cfffffff_win32u.dll!NtUserWaitMessage
Key : Failure.Exception.Code
Value: 0xcfffffff
Key : Failure.Hash
Value: {66bc945b-542e-aab8-1a28-2cadf1e83560}
Key : Failure.ProblemClass.Primary
Value: APPLICATION_FAULT
Key : Faulting.IP.Type
Value: Null
Key : Timeline.OS.Boot.DeltaSec
Value: 2488585
Key : Timeline.Process.Start.DeltaSec
Value: 23
Key : WER.OS.Branch
Value: co_release
Key : WER.OS.Version
Value: 10.0.22000.1
Key : WER.Process.Version
Value: 6.2.22000.2538
FILE_IN_CAB: explorer.exe_250506_092301.dmp
COMMENT:
*** C:\Users\talignanid\Desktop\procdump.exe -h -ma explorer.exe
*** Hung window detected: 6034e
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
CONTEXT: (.cxr;r)
rax=000000000000100a rbx=000000000406e5b0 rcx=00007ffb38f213b4
rdx=0000000000000000 rsi=0000000000000298 rdi=0000000000000000
rip=00007ffb38f214d4 rsp=00000000009cf9d8 rbp=00000000009cfb90
r8=000000002423c000 r9=000000008007007a r10=ffffffffdc79221a
r11=000000007ffffffe r12=000000000db602c5 r13=0000000000000000
r14=0000000000000000 r15=0000000000000001
iopl=0 nv up ei pl zr na po nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246
win32u!NtUserWaitMessage+0x14:
00007ffb`38f214d4 c3 ret
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 0000000000000000
ExceptionCode: 80000003 (Break instruction exception)
ExceptionFlags: 00000000
NumberParameters: 0
FAULTING_THREAD: d5e70
PROCESS_NAME: explorer.exe
WATSON_BKT_EVENT: AppHang
BLOCKING_THREAD: d5e70
ERROR_CODE: (NTSTATUS) 0xcfffffff -
EXCEPTION_CODE_STR: cfffffff
DERIVED_WAIT_CHAIN:
Dl Eid Cid WaitType
-- --- ------- --------------------------
0 dab94.d5e70 (null)
WAIT_CHAIN_COMMAND: ~0s;k;;
STACK_TEXT:
00000000`009cf9d8 00007ffb`3a6eda3c : 00000000`0406e5b0 00000000`009cfb90 00000000`00000298 00000000`00000298 : win32u!NtUserWaitMessage+0x14
00000000`009cf9e0 00007ffb`3a6ed97d : 00000000`0413b7d0 00000000`0412cae0 00000000`0406e5b0 00000000`00000298 : shell32!CDesktopBrowser::_MessageLoop+0x4c
00000000`009cfa60 00007ff7`231f0e4f : 00000000`00000000 00000000`0000029a 00000000`00000000 00000000`00000298 : shell32!SHDesktopMessageLoop+0x3d
00000000`009cfa90 00007ff7`232209c0 : 00000000`0000000a 00000000`00000000 00000000`00000000 00000000`00000000 : explorer!wWinMain+0x817
00000000`009cfee0 00007ffb`3a4153e0 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : explorer!__scrt_common_main_seh+0x110
00000000`009cff20 00007ffb`3ba2485b : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x10
00000000`009cff50 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x2b
STACK_COMMAND: ~0s; .ecxr ; kb
SYMBOL_NAME: win32u!NtUserWaitMessage+14
MODULE_NAME: win32u
IMAGE_NAME: win32u.dll
FAILURE_BUCKET_ID: APPLICATION_HANG_cfffffff_win32u.dll!NtUserWaitMessage
OS_VERSION: 10.0.22000.1
BUILDLAB_STR: co_release
OSPLATFORM_TYPE: x64
OSNAME: Windows 10
IMAGE_VERSION: 6.2.22000.2538
FAILURE_ID_HASH: {66bc945b-542e-aab8-1a28-2cadf1e83560}
Followup: M a c h i n e O w n e r < b r / > - - - - - - - - - < b r / > < / c o d e > < b r / > < h r / > < b r / > < b r / > < c o d e > < b r / > S c a n n e d 6 4 c r i t i c a l s e c t i o n s < b r / > < / c o d e > < b r / > < h r / > < b r / > < b r / > < c o d e > U s e r M o d e T i m e < b r / > T h r e a d T i m e < b r / > 0 : d 5 e 7 0 0 d a y s 0 : 0 0 : 0 0 . 7 8 1 < b r / > 1 1 : b a e 3 c 0 d a y s 0 : 0 0 : 0 0 . 4 6 8 < b r / > 1 1 5 : d 9 3 8 8 0 d a y s 0 : 0 0 : 0 0 . 4 5 3 < b r / > 4 : d e 3 a 4 0 d a y s 0 : 0 0 : 0 0 . 2 0 3 < b r / > 2 5 : d 2 9 e 8 0 d a y s 0 : 0 0 : 0 0 . 1 8 7 < b r / > 5 : d f a 2 c 0 d a y s 0 : 0 0 : 0 0 . 1 0 9 < b r / > 1 0 6 : d e 1 2 8 0 d a y s 0 : 0 0 : 0 0 . 0 9 3 < b r / > 1 3 1 : e 3 2 4 0 0 d a y s 0 : 0 0 : 0 0 . 0 7 8 < b r / > 4 3 : d 4 3 2 4 0 d a y s 0 : 0 0 : 0 0 . 0 7 8 < b r / > 1 0 : d c 5 8 0 0 d a y s 0 : 0 0 : 0 0 . 0 6 2
97:e3b1c 0 days 0:00:00.046
8:e2600 0 days 0:00:00.046
81:dbdec 0 days 0:00:00.031
52:e07d0 0 days 0:00:00.031
14:e09c8 0 days 0:00:00.031
9:cb93c 0 days 0:00:00.031
128:e2de8 0 days 0:00:00.015
50:cf3a0 0 days 0:00:00.015
32:e2440 0 days 0:00:00.015
22:e415c 0 days 0:00:00.015
21:e2478 0 days 0:00:00.015
18:e4238 0 days 0:00:00.015
6:bbcdc 0 days 0:00:00.015
2:d55e4 0 days 0:00:00.015
132:dfda0 0 days 0:00:00.000
130:e3be4 0 days 0:00:00.000
129:c8f1c 0 days 0:00:00.000
127:e00dc 0 days 0:00:00.000
126:ddea8 0 days 0:00:00.000
125:b67c8 0 days 0:00:00.000
124:da148 0 days 0:00:00.000
123:debf8 0 days 0:00:00.000
122:e4168 0 days 0:00:00.000
121:dad50 0 days 0:00:00.000
120:d7e74 0 days 0:00:00.000
119:dabe8 0 days 0:00:00.000
118:da73c 0 days 0:00:00.000
117:d8a14 0 days 0:00:00.000
116:cb684 0 days 0:00:00.000
114:c95cc 0 days 0:00:00.000
113:d5848 0 days 0:00:00.000
112:cf3ac 0 days 0:00:00.000
111:d4690 0 days 0:00:00.000
110:e2fbc 0 days 0:00:00.000
109:dc7c0 0 days 0:00:00.000
108:e2f54 0 days 0:00:00.000
107:daa90 0 days 0:00:00.000
105:e14d8 0 days 0:00:00.000
104:dbc64 0 days 0:00:00.000
103:e0f34 0 days 0:00:00.000
102:dab8c 0 days 0:00:00.000
101:e2cf8 0 days 0:00:00.000
100:d4c28 0 days 0:00:00.000
99:b0a58 0 days 0:00:00.000
98:c8710 0 days 0:00:00.000
96:e31e8 0 days 0:00:00.000
95:e2fd0 0 days 0:00:00.000
94:e1584 0 days 0:00:00.000
93:d62d4 0 days 0:00:00.000
92:e3ea8 0 days 0:00:00.000
91:e34bc 0 days 0:00:00.000
90:e2154 0 days 0:00:00.000
89:d7718 0 days 0:00:00.000
88:da608 0 days 0:00:00.000
87:d3174 0 days 0:00:00.000
86:cde98 0 days 0:00:00.000
85:abad4 0 days 0:00:00.000
84:c0570 0 days 0:00:00.000
83:e2fc8 0 days 0:00:00.000
82:d9580 0 days 0:00:00.000
80:dc5b0 0 days 0:00:00.000
79:e3578 0 days 0:00:00.000
78:db12c 0 days 0:00:00.000
77:e2f8c 0 days 0:00:00.000
76:e0348 0 days 0:00:00.000
75:d787c 0 days 0:00:00.000
74:d6260 0 days 0:00:00.000
73:dffdc 0 days 0:00:00.000
72:e1d88 0 days 0:00:00.000
71:bd60c 0 days 0:00:00.000
70:d5180 0 days 0:00:00.000
69:c9ee8 0 days 0:00:00.000
68:dbd60 0 days 0:00:00.000
67:e1968 0 days 0:00:00.000
66:dc44c 0 days 0:00:00.000
65:e417c 0 days 0:00:00.000
64:dba4c 0 days 0:00:00.000
63:e0098 0 days 0:00:00.000
62:e2a58 0 days 0:00:00.000
61:e13d8 0 days 0:00:00.000
60:e29dc 0 days 0:00:00.000
59:e2198 0 days 0:00:00.000
58:e3e78 0 days 0:00:00.000
57:96be0 0 days 0:00:00.000
56:e41f0 0 days 0:00:00.000
55:b6d40 0 days 0:00:00.000
54:d2898 0 days 0:00:00.000
53:b0760 0 days 0:00:00.000
51:ce040 0 days 0:00:00.000
49:e0f0c 0 days 0:00:00.000
48:daf84 0 days 0:00:00.000
47:e3110 0 days 0:00:00.000
46:e190c 0 days 0:00:00.000
45:bab4c 0 days 0:00:00.000
44:d4018 0 days 0:00:00.000
42:e26b8 0 days 0:00:00.000
41:e1b0c 0 days 0:00:00.000
40:e3218 0 days 0:00:00.000
39:d99b4 0 days 0:00:00.000
38:e3838 0 days 0:00:00.000
37:e24a0 0 days 0:00:00.000
36:e4100 0 days 0:00:00.000
35:e3618 0 days 0:00:00.000
34:e3984 0 days 0:00:00.000
33:e43b0 0 days 0:00:00.000
31:e29c4 0 days 0:00:00.000
30:bac9c 0 days 0:00:00.000
29:ccb20 0 days 0:00:00.000
28:dab24 0 days 0:00:00.000
27:e175c 0 days 0:00:00.000
26:e3a54 0 days 0:00:00.000
24:da1b4 0 days 0:00:00.000
23:e418c 0 days 0:00:00.000
20:c7528 0 days 0:00:00.000
19:d71ec 0 days 0:00:00.000
17:dfce0 0 days 0:00:00.000
16:c6438 0 days 0:00:00.000
15:e1c4c 0 days 0:00:00.000
13:e188c 0 days 0:00:00.000
12:cd1d8 0 days 0:00:00.000
7:dafb4 0 days 0:00:00.000
3:d0b08 0 days 0:00:00.000
1:e3f9c 0 days 0:00:00.000