Exemple #1
0
/*
	メインダイアログ用 WM_INITDIALOG 処理ルーチン
*/
BOOL TInstDlg::EvCreate(LPARAM lParam)
{
	GetWindowRect(&rect);
	int		cx = ::GetSystemMetrics(SM_CXFULLSCREEN), cy = ::GetSystemMetrics(SM_CYFULLSCREEN);
	int		xsize = rect.right - rect.left, ysize = rect.bottom - rect.top;

	::SetClassLong(hWnd, GCL_HICON,
					(LONG_PTR)::LoadIcon(TApp::GetInstance(), (LPCSTR)SETUP_ICON));
	MoveWindow((cx - xsize)/2, (cy - ysize)/2, xsize, ysize, TRUE);
	Show();

// プロパティシートの生成
	staticText.AttachWnd(GetDlgItem(INSTALL_STATIC));
	propertySheet = new TInstSheet(this, &cfg);

// 現在ディレクトリ設定
	char		buf[MAX_PATH], setupDir[MAX_PATH];
	TRegistry	reg(HKEY_LOCAL_MACHINE, BY_MBCS);

// タイトル設定
	if (IsWinVista() && ::IsUserAnAdmin()) {
		GetWindowText(buf, sizeof(buf));
		strcat(buf, " (Admin)");
		SetWindowText(buf);
	}

// Program Filesのパス取り出し
	if (reg.OpenKey(REGSTR_PATH_SETUP)) {
		if (reg.GetStr(REGSTR_PROGRAMFILES, buf, sizeof(buf)))
			MakePath(setupDir, buf, FASTCOPY);
		reg.CloseKey();
	}

// 既にセットアップされている場合は、セットアップディレクトリを読み出す
	if (reg.OpenKey(REGSTR_PATH_UNINSTALL)) {
		if (reg.OpenKey(FASTCOPY)) {
			if (reg.GetStr(REGSTR_VAL_UNINSTALLER_COMMANDLINE, setupDir, sizeof(setupDir))) {
				GetParentDir(setupDir, setupDir);
			}
			reg.CloseKey();
		}
		reg.CloseKey();
	}

	if (!cfg.startMenu || !cfg.deskTop) {
		GetShortcutPath(&cfg);
	}

	SetDlgItemText(FILE_EDIT, cfg.setupDir ? WtoAs(cfg.setupDir) : setupDir);

	CheckDlgButton(cfg.mode == SETUP_MODE ? SETUP_RADIO : UNINSTALL_RADIO, 1);
	ChangeMode();

	if (cfg.runImme) PostMessage(WM_COMMAND, MAKEWORD(IDOK, 0), 0);

	return	TRUE;
}
Exemple #2
0
void TMainDlg::WriteLogHeader(HANDLE hFile, BOOL add_filelog)
{
	static const char *head_start = "=================================================";
	static const char *head_end   = "-------------------------------------------------";

	char	buf[1024];

	::SetFilePointer(hFile, 0, 0, FILE_END);

	DWORD len = sprintf(buf, "%s\r\nFastCopy(%s%s) start at %d/%02d/%02d %02d:%02d:%02d\r\n\r\n",
		head_start, GetVersionStr(), GetVerAdminStr(),
		startTm.wYear, startTm.wMonth, startTm.wDay,
		startTm.wHour, startTm.wMinute, startTm.wSecond);

	::WriteFile(hFile, buf, len, &len, 0);
	if (pathLogBuf) {
		::WriteFile(hFile, pathLogBuf, (DWORD)strlen(pathLogBuf), &len, 0);
	}

	if (add_filelog && *fileLogPath) {
		len = sprintf(buf, "<FileLog> %s\r\n",
				cfg.isUtf8Log ? WtoU8s(fileLogPath) : WtoAs(fileLogPath));
		::WriteFile(hFile, buf, len, &len, 0);
	}

	if (finActIdx >= 1) {
		const WCHAR	*title = cfg.finActArray[finActIdx]->title;
		len = sprintf(buf, "<PostPrc> %s\r\n%s\r\n",
						cfg.isUtf8Log ? WtoU8s(title) : WtoAs(title), head_end);
		::WriteFile(hFile, buf, len, &len, 0);
	}
	else if (pathLogBuf || (add_filelog && *fileLogPath)) {
		len = sprintf(buf, "%s\r\n", head_end);
		::WriteFile(hFile, buf, len, &len, 0);
	}
}