VC program quickly delete themselves (may be useful when upgrading the program)

Source: Internet
Author: User

Project will usually have an uninstall program, if the program is to do it yourself, after the uninstall program to delete all of their files, in Google for a long time finally found some relevant information, generally can only delete a file, after their own processing, you can delete all the contents of the folder, you can also include sub-folders.

The main principle is that, when exiting the program, execute a DOS command to delete, as follows:

CString Strparam;

Strparam = "/C choice/c y/n/d y/t 3 & rd/s/q \" ";
Strparam + = "D:\\test";
Strparam + = "\" ";
ShellExecute (NULL, L "open", L "cmd.exe", strparam, NULL, sw_hide);

CHOICE/C y/n/d y/t 3 & rd/s/q \ This command, which represents 3 seconds after the RD command is executed to delete a folder, may be unsuccessful on different computers because it prompts for choice not an internal command on XP. (It can be on my computer.) ), for insurance purposes, using the following code is possible, as follows:

CString Strparam;

Strparam = "/C ping 1.1.1.1-n 1-w > Nul & rd/s/q \" ";
Strparam + = "D:\\test";
Strparam + = "\" ";
ShellExecute (NULL, L "open", L "cmd.exe", strparam, NULL, sw_hide);

http://blog.csdn.net/itjobtxq/article/details/8968745

VC program quickly delete themselves (may be useful when upgrading the program)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.