当前位置: 首页>>代码示例>>C++>>正文


C++ CDialog::CleanUp方法代码示例

本文整理汇总了C++中CDialog::CleanUp方法的典型用法代码示例。如果您正苦于以下问题:C++ CDialog::CleanUp方法的具体用法?C++ CDialog::CleanUp怎么用?C++ CDialog::CleanUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDialog的用法示例。


在下文中一共展示了CDialog::CleanUp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CleanUp

/*
void CleanUp()
{
	const char tempbatname[] = "_uninsep.bat" ;

	// temporary .bat file
	static char templ[] = 
		":Repeat\r\n"
		"del \"%s\"\r\n"
		"if exist \"%s\" goto Repeat\r\n"
		"del \"%s\"" ;
	
	
	char modulename[MAX_PATH] ;    // absolute path of calling .exe file
	char temppath[MAX_PATH] ;      // absolute path of temporary .bat file
	char folder[MAX_PATH] ;
	
	::GetTempPath(MAX_PATH, temppath) ;
	strcat(temppath, tempbatname) ;
	
	::GetModuleFileName(NULL, modulename, MAX_PATH) ;
	strcpy (folder, modulename) ;
	char *pb = strrchr(folder, '\\');
	if (pb != NULL)
		*pb = 0 ;

	TCHAR moduleName2[MAX_PATH] = {0};
	CDialog::GetProgramFilesPath(moduleName2);
	lstrcat(moduleName2, "\\");
	lstrcat(moduleName2, strrchr(modulename, '\\')+1);
	
	HANDLE hf ;
	
	hf = ::CreateFile(
		temppath,
		GENERIC_WRITE,
		0,
		NULL, 
		CREATE_ALWAYS,
		FILE_ATTRIBUTE_NORMAL,
		NULL) ;
	
	if (hf != INVALID_HANDLE_VALUE)
	{
		DWORD len ;
		char *bat ;
		
		bat = (char*)alloca(strlen(templ) + 
			strlen(moduleName2) * 2 + strlen(temppath) + 20) ;
		
		wsprintf(bat, templ, moduleName2, moduleName2, temppath) ;
		
		::WriteFile(hf, bat, strlen(bat), &len, NULL) ;
		::CloseHandle(hf) ;
		
		::ShellExecute(NULL, "open", temppath, NULL, NULL, SW_HIDE);
	}
}
*/
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	bool bUninstall = (0 == lstrcmpi(lpCmdLine, TEXT("uninstall")));

	CDialog *pDialog = new CDialog(hInstance, nCmdShow, bUninstall);

	MSG  msg;
	int status;
	while ((status = GetMessage (& msg, 0, 0, 0)) != 0)
	{
		if (status == -1)
		{
			if(pDialog->m_bCleanup)
			{
				pDialog->CleanUp();
				// ubiti explorer, mamojebac zna da lokuje dll
			}
			delete pDialog;
			return -1;
		}
		if (!::IsDialogMessage (pDialog->m_hwnd, & msg))
		{
			::TranslateMessage ( & msg );
			::DispatchMessage ( & msg );
		}
	}

	if(pDialog->m_bCleanup)
	{
		pDialog->CleanUp();
		// ubiti explorer, mamojebac zna da lokuje dll
	}

	delete pDialog;

	return msg.wParam;
}
开发者ID:sqba,项目名称:zenfolders,代码行数:99,代码来源:Setup.cpp


注:本文中的CDialog::CleanUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。