How to delete a file ????

Got a problem you cannot solve? Try here.
MikeFieger
Posts: 52
Joined: Thu Jan 26, 2006 9:09 am

How to delete a file ????

Postby MikeFieger » Tue Mar 21, 2006 10:43 am

Hi

I know this really sounds like a stupid question, but I really can not delete a file upon uninstalling my program.

I am using the command 'Delete Files $TARGETDIR$\\Test.tmp (when uninstalling)' but it just doesn´t work...

I tried it before and after 'Apply Uninstall'

I wrote the filename to the screen using a messagebox to check if the path is right -> it is.

I tried it with a manually created textfile C:\\Test.txt...

The file is not write protectet or in use by any other program....

What else can there be wrong? Please help a desperate customer :x

jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Postby jimo » Tue Mar 21, 2006 3:01 pm

Mike,
I find it best to use the Call DLL script action and call "DeleteFileA" in kernel32.dll like

Code: Select all

~InstallAware Clipboard Data~
~Call DLL Function~
~{AC025F56-F43C-4F07-A566-B815B48F6AE4}~
~kernel32.dll,DeleteFileA,bool,LASTERROR,"pointer to string",$APPDIR$\\WebUpdate\\MDPM_WebUpdate.exe,$~
~mIDEFunc.dll\\mEXEFunc.dll~

Which is :
Call DLL Function kernel32.dll->DeleteFileA (get result into variable LASTERROR)

Paste the code block above into your script and edit the value of the string to the appropriate value.

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue Mar 21, 2006 3:23 pm

That's a great suggestion from Jim, thank you.

If you are also wondering why the native Delete File command did not work, this is slightly tricky so we have a FAQ about it in the help files -

"Setup Commands Preceding Apply Uninstall"

should answer your question (look it up in the help index or under the Getting Results book).
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

MikeFieger
Posts: 52
Joined: Thu Jan 26, 2006 9:09 am

Postby MikeFieger » Wed Mar 22, 2006 3:24 am

Thank you for your answers!

Moving the delete command from the uninstall- to the install-section solved the problem.
:)


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 123 guests