H
hxrhhy18
Unregistered / Unconfirmed
GUEST, unregistred user!
[red]在delphi中,我把一个new.exe文件作为资源文件释放出来了,如果我手动关闭了exe文件或exe文件自动运行完毕,让nwe.exe文件自动从磁盘删除,应如何写代码, <br>前面的代码如下: <br><br>program Project2; <br><br>uses <br>windows, shellapi, classes; //必须用到的单元 <br><br><br>{$R exe.res} //<br>function ExtractRes(ResType, ResName, ResNewName: string): boolean; //var <br>Res: TResourceStream; <br>begin <br>try <br>Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType)); <br>try <br>Res.SavetoFile(ResNewName); <br>Result := true; <br>finally <br>Res.Free; <br>end; <br>except <br>Result := false; <br>end; <br>end; <br><br><br>var <br>handle:Thandle; //<br>begin <br>ExtractRes('exefile','mask','c:/new.exe'); //<br>ShellExecute(handle, 'open', PChar('c:/new.exe'), nil, nil, SW_SHOW); //调用shellexecuteend. <br>到这里为止,调用new.exe成功,我想在关闭new.exe运行窗口,或让他运行完毕,关闭窗口时,自动删除c:/new.exe,如何写代码,100分,请留下QQ,