Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using COP command
#15
It is Windows bug or strange undocumented behavior.
cop uses Windows API function SHFileOperation.
On XP, it fails if flags FOF_SILENT and FOF_NOCONFIRMMKDIR are used together. Works well on Windows 7.
But succeeds if SHFILEOPSTRUCT.hwnd is nonzero. I'll add it in next QM.

Macro Macro1423
Code:
Copy      Help
str a="$desktop$\1234\A\QP\test.txt"
str b="$desktop$\1234\B\QP\test.txt"

;for testing:
;create a
mkdir "$desktop$\1234\A\QP"
_s.all(5*1024*1024 2 '.')
_s.setfile(a)
;also delete B
del- "$desktop$\1234\B"; err
;mkdir "$desktop$\1234\B\QP"

int t1=perf

;cop a b FOF_SILENT|FOF_NOCONFIRMMKDIR
;cop a b FOF_NOCONFIRMMKDIR
;cop a b

a.expandpath; a.fromn(a -1 "" 1)
b.expandpath; b.fromn(b -1 "" 1)
SHFILEOPSTRUCTW x
x.hwnd=GetDesktopWindow
x.wFunc=FO_COPY
x.pFrom=@a
x.pTo=@b
;x.fFlags=FOF_NOCONFIRMMKDIR
x.fFlags=FOF_SILENT|FOF_NOCONFIRMMKDIR
int e=SHFileOperationW(&x)
if(e) out _s.dllerror("Error: " "" e)

int t2=perf
out t2-t1

This code succeeds because of x.hwnd=GetDesktopWindow. QM currently uses x.hwnd=0.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)