复制整个目录出现的问题 (50分)

  • 主题发起人 主题发起人 jiangpengxmaya
  • 开始时间 开始时间
J

jiangpengxmaya

Unregistered / Unconfirmed
GUEST, unregistred user!
我用下列代码复制整个目录可以成功<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; OpStruc: TSHFileOpStruct;<br>&nbsp; frombuf, tobuf: Array [0..128] of Char;<br>Begin<br>&nbsp; FillChar( frombuf, Sizeof(frombuf), 0 );<br>&nbsp; FillChar( tobuf, Sizeof(tobuf), 0 );<br>&nbsp; StrPCopy( frombuf, '源目录' );<br>&nbsp; StrPCopy( tobuf, '目的目录' );<br>&nbsp; With OpStruc DO Begin<br>&nbsp; &nbsp; Wnd:= ;<br>&nbsp; &nbsp; wFunc:= FO_COPY;<br>&nbsp; &nbsp; pFrom:= @frombuf;<br>&nbsp; &nbsp; pTo:=@tobuf;<br>&nbsp; &nbsp; fFlags:= FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;<br>&nbsp; &nbsp; fAnyOperationsAborted:= False;<br>&nbsp; &nbsp; hNameMappings:= Nil;<br>&nbsp; &nbsp; lpszProgressTitle:= Nil;<br>&nbsp; end;<br>&nbsp; ShFileOperation( OpStruc );<br><br>可是我作成如下的过程:<br>procedure copy_ml(res_ml,des_ml:string);<br>var<br>&nbsp; OpStruc: TSHFileOpStruct;<br>&nbsp; frombuf, tobuf: Array [0..128] of Char;<br>Begin<br>&nbsp; FillChar( frombuf, Sizeof(frombuf), 0 );<br>&nbsp; FillChar( tobuf, Sizeof(tobuf), 0 );<br>&nbsp; StrPCopy( frombuf, res_ml );<br>&nbsp; StrPCopy( tobuf, des_ml );<br>&nbsp; With OpStruc do Begin<br>&nbsp; &nbsp; Wnd:=Handle;<br>&nbsp; &nbsp; wFunc:= FO_COPY;<br>&nbsp; &nbsp; pFrom:= @frombuf;<br>&nbsp; &nbsp; pTo:=@tobuf;<br>&nbsp; &nbsp; fFlags:= FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;<br>&nbsp; &nbsp; fAnyOperationsAborted:= False;<br>&nbsp; &nbsp; hNameMappings:= Nil;<br>&nbsp; &nbsp; lpszProgressTitle:= Nil;<br>&nbsp; end;<br>&nbsp; ShFileOperation( OpStruc );<br>end;<br>提示handle没有申明!这是为什么啊!
 
你的那个过程没问题我试过了<br>
 
你把那句<br>Wnd:=Handle;<br>屏敝掉,不要,可以通过<br>我试过,delphi+window2000测试通过没有问题
 
接受答案了.
 
后退
顶部