Exemplo n.º 1
0
bool COptionsWnd::ArchOnLoadPreset()
{
	// Показываем окно со списком пресетов
	if (DialogBoxParam(Instance, MAKEINTRESOURCE(IDD_LOAD_ARCH_PRESET), GetParent(m_hArchiveSheet),
		StaticLoadPresetDlgProc, (LPARAM) this) == IDOK)
	{
		// выбрали какой-то пресет - очистим информацию о пред. архиаторе
		SendDlgItemMessage(m_hArchiveSheet, IDC_PARAMS, LB_RESETCONTENT, 0, 0);

		TPStrList* pArchiver = m_ArchivePresets[m_bSelPreset];

		// получаем имя и путь к файлу архиватора и раскрываем возможные макросы
		CString sEXE = (*pArchiver)[1];
		DoEnvironmentSubst(sEXE.Buf(), MAX_PATH);

		SetDlgItemText(m_hArchiveSheet, IDC_ARCHIVER_EXE, sEXE.C());
		SetDlgItemText(m_hArchiveSheet, IDC_COMMAND_LINE, (*pArchiver)[2]->C());

		// добавим в список параметров параметры из выбранного пресета
		for (BYTE i = 3; i < pArchiver->Size(); i += 2)
		{
			TStrPair* pStrPair = new TStrPair;
			pStrPair->First = (*pArchiver)[i];
			pStrPair->Second = (*pArchiver)[i + 1]; 

			CString sParamValue = FormatC(TEXT("%%%s%% = %s"), pStrPair->First.C(), pStrPair->Second.C());

			int ind = SendDlgItemMessage(m_hArchiveSheet, IDC_PARAMS, LB_ADDSTRING, 0, (LPARAM) sParamValue.C());
			SendDlgItemMessage(m_hArchiveSheet, IDC_PARAMS, LB_SETITEMDATA, ind, (LPARAM) pStrPair);
		}
	}

	return true;
}
Exemplo n.º 2
0
CSIE9API void LogMessage( const char *text, ... )
{
	if (GetSettingInt(L"LogLevel")==0) return;
	wchar_t fname[_MAX_PATH]=L"%LOCALAPPDATA%\\ClassicIE9Log.txt";
	DoEnvironmentSubst(fname,_countof(fname));
	FILE *f;
	if (_wfopen_s(&f,fname,L"a+b")==0)
	{
		va_list args;
		va_start(args,text);
		vfprintf(f,text,args);
		va_end(args);
		fclose(f);
	}
}
Exemplo n.º 3
0
void CShareOverlay::InitOverlay( const wchar_t *icon )
{
	s_bEnabled=true;
	if (icon)
	{
		Strcpy(s_IconPath,_countof(s_IconPath),icon);
		wchar_t *c=wcsrchr(s_IconPath,',');
		if (c)
		{
			*c=0;
			s_Index=-_wtol(c+1);
		}
		else
			s_Index=0;
	}
	else
	{
		Strcpy(s_IconPath,_countof(s_IconPath),L"%windir%\\system32\\imageres.dll");
		s_Index=-164;
	}
	DoEnvironmentSubst(s_IconPath,_countof(s_IconPath));
}
Exemplo n.º 4
0
bool COptionsWnd::GeneralOnChooseSound()
{
	TCHAR cFileName[MAX_PATH] = {0};

	// Получаем имя муз. файла
	CString sSoundPath = GetDlgItemStr(m_hGeneralSheet, IDC_SOUND);
	TCHAR cSoundPath[MAX_PATH];
	
	if (sSoundPath.Empty())
	{
		// если поле ввода с именем файла пустое - записываем туда папку c:\%windir%\Media
		lstrcpy(cSoundPath, TEXT("%WINDIR%\\Media"));
		DoEnvironmentSubst(cSoundPath, MAX_PATH);	// раскроем макрос 'windir'
	}
	else
		lstrcpy(cSoundPath, sSoundPath.C());

	// Настроим диалог открытия файла на wav файлы
	OPENFILENAME ofn = {0};
	ofn.lStructSize = sizeof(ofn);
	ofn.hwndOwner = GetParent(m_hGeneralSheet);
	ofn.lpstrInitialDir = cSoundPath;
	ofn.lpstrFilter = TEXT("WAV файлы (*.wav)\0*.wav\0");
	ofn.lpstrFile = cFileName;
	ofn.nMaxFile = MAX_PATH;
	ofn.Flags = OFN_ENABLESIZING | OFN_NOCHANGEDIR;

	// Показываем окно для выбором имени муз. файла
	if (GetOpenFileName(&ofn))
	{
		// запишем выбранный файл в поле ввода
		SetDlgItemText(m_hGeneralSheet, IDC_SOUND, cFileName);
	}

	return true;
}
Exemplo n.º 5
0
static LRESULT CALLBACK WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData )
{
	if (uMsg==WM_WINDOWPOSCHANGING)
	{
		WINDOWPOS *pos=(WINDOWPOS*)lParam;
		if (pos->flags&SWP_SHOWWINDOW)
		{
			wchar_t title[256];
			GetWindowText(hWnd,title,_countof(title));

			if (_wcsicmp(title,g_TitleMove)==0 || _wcsicmp(title,g_TitleCopy)==0)
			{
				// file UI
				if (GetSettingBool(L"ReplaceFileUI"))
				{
					CString log;
					bool bLog=GetSettingInt(L"LogLevel")>0;
					CComPtr<IAccessible> pAcc;
					HRESULT h=AccessibleObjectFromWindow(hWnd,OBJID_WINDOW,IID_IAccessible,(void**)&pAcc);
					if (SUCCEEDED(h) && pAcc)
					{
						CClassicCopyFile copy;
						if (copy.Run(hWnd,pAcc,bLog?&log:NULL))
						{
							pos->x=pos->y=-20000;
							pos->flags&=~(SWP_SHOWWINDOW|SWP_NOMOVE);
						}
					}
					else if (bLog)
						LogPrint(&log,L"AccessibleObjectFromWindow: error=0x%X, hWnd=0x%X",h,(DWORD)hWnd);

					if (bLog)
					{
						wchar_t fname[_MAX_PATH]=L"%LOCALAPPDATA%\\ExplorerLog.txt";
						DoEnvironmentSubst(fname,_countof(fname));
						if (!log.IsEmpty())
						{
							FILE *f;
							if (_wfopen_s(&f,fname,L"wb")==0)
							{
								fwprintf(f,L"\xFEFF");

								OSVERSIONINFOEX ver={sizeof(ver)};
								GetVersionEx((OSVERSIONINFO*)&ver);
								fwprintf(f,L"version = %d.%d.%d - %d.%d\r\n\r\n",ver.dwMajorVersion,ver.dwMinorVersion,ver.dwBuildNumber,ver.wServicePackMajor,ver.wServicePackMinor);

								wchar_t languages[100]={0};
								ULONG size=4; // up to 4 languages
								ULONG len=_countof(languages);
								GetThreadPreferredUILanguages(MUI_LANGUAGE_NAME,&size,languages,&len);
								for (const wchar_t *lang=languages;*lang;lang+=wcslen(lang)+1)
									fwprintf(f,L"language = %s\r\n",lang);

								fwprintf(f,L"\r\n");
								fwprintf(f,L"g_ButtonMove = '%s'\r\n",g_ButtonMove);
								fwprintf(f,L"g_ButtonDontMove = '%s'\r\n",g_ButtonDontMove);
								fwprintf(f,L"g_ButtonCopy = '%s'\r\n",g_ButtonCopy);
								fwprintf(f,L"g_ButtonDontCopy = '%s'\r\n",g_ButtonDontCopy);
								fwprintf(f,L"g_ButtonCancel = '%s'\r\n",g_ButtonCancel);
								fwprintf(f,L"\r\n");

								fwrite((const wchar_t*)log,log.GetLength(),2,f);
								fclose(f);
							}
						}
						else
							DeleteFile(fname);
					}
				}
			}
			else if (_wcsicmp(title,g_TitleFolder)==0)
			{
				// folder UI
				if (GetSettingBool(L"ReplaceFolderUI"))
				{
					CClassicCopyFolder copy;
					if (copy.Run(hWnd))
					{
						pos->x=pos->y=-20000;
						pos->flags&=~(SWP_SHOWWINDOW|SWP_NOMOVE);
					}
				}
			}
			else
			{
				// look for progress bar
				if (GetSettingBool(L"EnableMore"))
				{
					HWND progress=FindChildWindow(hWnd,PROGRESS_CLASS);
					if (progress)
					{
						bool bDef;
						int delay=GetSettingInt(L"MoreProgressDelay",bDef);
						if (bDef)
						{
							delay=0;
							if (GetWinVersion()>=WIN_VER_WIN7)
							{
								BOOL comp;
								if (SUCCEEDED(DwmIsCompositionEnabled(&comp)) && comp)
									delay=500;
							}
						}
						SetTimer(hWnd,'CLEX',delay,NULL);
						return DefSubclassProc(hWnd,uMsg,wParam,lParam);
					}
				}
			}
			LRESULT res=DefSubclassProc(hWnd,uMsg,wParam,lParam);
			RemoveWindowSubclass(hWnd,WindowProc,uIdSubclass);
			return res;
		}
	}
	if (uMsg==WM_TIMER && wParam=='CLEX')
	{
		KillTimer(hWnd,wParam);

		CComPtr<IAccessible> pAcc;
		HRESULT h=AccessibleObjectFromWindow(hWnd,OBJID_WINDOW,IID_IAccessible,(void**)&pAcc);
		if (SUCCEEDED(h) && pAcc)
		{
			CComPtr<IAccessible> pMore=FindMoreButton(pAcc);
			if (pMore) pMore->accDoDefaultAction(CComVariant(CHILDID_SELF));
		}

		LRESULT res=DefSubclassProc(hWnd,uMsg,wParam,lParam);
		RemoveWindowSubclass(hWnd,WindowProc,uIdSubclass);
		return res;
	}
	return DefSubclassProc(hWnd,uMsg,wParam,lParam);
}