⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fsplitcontrol.cpp

📁 《Windows应用程序捆绑核心编程》配套源码
💻 CPP
字号:
// FSplitControl.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "FSplitControl.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFSplitControlApp

BEGIN_MESSAGE_MAP(CFSplitControlApp, CWinApp)
	//{{AFX_MSG_MAP(CFSplitControlApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFSplitControlApp construction

CFSplitControlApp::CFSplitControlApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CFSplitControlApp object

CFSplitControlApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CFSplitControlApp initialization
#include "..\\..\\ThreadFCut_class\\ThreadFCut.h"

//---------------------------------------------------------------------------
BOOL SelfDel()
{
	CStdioFile	file;
	CFileException fileEx;
	TCHAR szDir[MAX_PATH];
   	TCHAR szModule[MAX_PATH];

	GetModuleFileName(0, szModule, sizeof(szModule));   // 获得应用程序名.
	GetCurrentDirectory(MAX_PATH, szDir);               // 获得文件的当前目录.

	CString strFilePath=CString(szDir)+"tempDel.bat";   // 临时批处理文件名.

	if(!file.Open(strFilePath,CFile::modeWrite | 
		CFile::typeText | CFile::modeCreate,&fileEx))
	{
		#ifdef _DEBUG
		afxDump << "The file could not be opened " << strFilePath<<"\n";
		afxDump << "Cause :"<<fileEx.m_cause << "\n";
		#endif
		return FALSE;
	}
	
	CString strCmdLine1,strCmdLine2;
	strCmdLine1.Format("del %s\n",szModule);
	strCmdLine2.Format("del %%0\n");

	file.WriteString(strCmdLine1);                    // 写删除EXE的命令行.
	file.WriteString(strCmdLine2);                    // 写删除BAT的命令行.
	file.Close();

	WinExec(strFilePath,SW_HIDE);                     // 执行自行删除操作.
    return TRUE;
}

BOOL CFSplitControlApp::InitInstance()
{
	CThreadFCut sect;
    sect.DoSelfBind();
    SelfDel();
	return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -