Win32 project - VC++
How can I self-delete program I run?
Win32 project - VC++
How can I self-delete program I run?
Elysia, I just need.
Self-delete
Like an unistaller
So create setup project in the VS and it will know how to install/uninstall applicationLike an unistaller
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
On the catch22.net site there's an article about self deleting techniques and a sample c code for all windows selfdeleteing executables. On the codeproject.com site there's too an article with a sample. Maybe both will help you.
Niara
thanks Niara.
What about using MoveFileEx? (I can wait for reboot)
The problem with this is that I can't delete folder (where the program is located) because I have other files that need to be deleted as well,and MoveFileExcan't delete full folder.
Do I need to use MoveFileEx on every file in my folder?
For what purpose? What have you tried already that didn't work?
>> How does an uninstaller work?
by uninstalling *some other* program, of course.
>> Installers and uninstallers are so bloated these days you never know what's going on.
true, there are registry, service, even batch file entries (to name a few) to contend with these days. but the principal remains the same - remove a program and all (non-shared) registered components. moreover, I think that the OP may be talking about the questionable practice of having a program remove *itself* without any trace. there aren't a whole lot of legitimate reasons to do that, and I'm pretty sure that whoever ends up running the software won't appreciate knowing that such David Copperfield antics were amiss...
use an uninstaller. it'ts that simple.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }