斗----自尊、自强、自信

蜗牛慢慢爬,只要不停下来就好~~

博客园 首页 新随笔 联系 订阅 管理
Write a program delete itself after execution.
思路:调用cmd命令来删除,用ShellExecute来执行cmd命令
#include <ShlObj.h>
#include <shellapi.h>
#include <string.h>
int main(int argc, char* argv[])
{
 char str[100];
 GetModuleFileName(NULL,str,100);
 char str1[100]="/c del ";
 strcat(str1,str);
 ShellExecute(NULL, "open","cmd.exe", str1,NULL, SW_HIDE);
 return 0;
}

posted on 2007-12-22 15:44  a斗  阅读(244)  评论(0编辑  收藏  举报