C
CJ
Unregistered / Unconfirmed
GUEST, unregistred user!
MICROSOFT WIN2000下用的<br>//这个函数是抄来的,我看看应该没什么错吧?<br>procedure DelTree(Path:String);<br> Var<br> Found:Integer;<br> SearchRec:TSearchRec;<br> begin<br> Found := FindFirst(path+'*.*', $0000003F, SearchRec);<br> While Found = 0 Do<br> Begin<br> If ((SearchRec.Name<>'.') And (SearchRec.Name<>'..') )Then<br> Begin<br> If (SearchRec.Attr = $00000010) Then<br> DelTree(Path+SearchRec.Name+'/')<br> Else<br> DeleteFile(Path+SearchRec.Name);<br> End;<br> Found := FindNext(SearchRec);<br> End;<br> FindClose(SearchRec);<br> try<br> RmDir(Path); //到最上层的时候,主目录就是删不掉! IO ERROR<br> except<br> <br> end;<br> End;<br><br>然后我光火,这么来:<br> DelTree(dirname);<br> rmdir(dirname);<br>再次发生异常IO ERROR<br><br><br>还有妖怪问题<br>HKEY_CLASSES_ROOT/*/Shell/myproductname<br>HKEY_CLASSES_ROOT/*/Shell/myproductname/command<br>设置了相应值,右键菜单用的挺红火,可是,当这个文件没有默认打开方式时,双吉竟然用了我的程序,我不想这样。本来用SHELLAPI应该该可以搞定,可问题是我要在所有文件、目录都有那么个东西,没办法,直接搞注册表。