J
jiangpengxmaya
Unregistered / Unconfirmed
GUEST, unregistred user!
我用下列代码复制整个目录可以成功<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> OpStruc: TSHFileOpStruct;<br> frombuf, tobuf: Array [0..128] of Char;<br>Begin<br> FillChar( frombuf, Sizeof(frombuf), 0 );<br> FillChar( tobuf, Sizeof(tobuf), 0 );<br> StrPCopy( frombuf, '源目录' );<br> StrPCopy( tobuf, '目的目录' );<br> With OpStruc DO Begin<br> Wnd:= ;<br> wFunc:= FO_COPY;<br> pFrom:= @frombuf;<br> pTo:=@tobuf;<br> fFlags:= FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;<br> fAnyOperationsAborted:= False;<br> hNameMappings:= Nil;<br> lpszProgressTitle:= Nil;<br> end;<br> ShFileOperation( OpStruc );<br><br>可是我作成如下的过程:<br>procedure copy_ml(res_ml,des_ml:string);<br>var<br> OpStruc: TSHFileOpStruct;<br> frombuf, tobuf: Array [0..128] of Char;<br>Begin<br> FillChar( frombuf, Sizeof(frombuf), 0 );<br> FillChar( tobuf, Sizeof(tobuf), 0 );<br> StrPCopy( frombuf, res_ml );<br> StrPCopy( tobuf, des_ml );<br> With OpStruc do Begin<br> Wnd:=Handle;<br> wFunc:= FO_COPY;<br> pFrom:= @frombuf;<br> pTo:=@tobuf;<br> fFlags:= FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;<br> fAnyOperationsAborted:= False;<br> hNameMappings:= Nil;<br> lpszProgressTitle:= Nil;<br> end;<br> ShFileOperation( OpStruc );<br>end;<br>提示handle没有申明!这是为什么啊!