This commit is contained in:
Igor Pavlov
2005-12-09 00:00:00 +00:00
committed by Kornel Lesiński
parent acac987575
commit e8d0636d7a
13 changed files with 138 additions and 94 deletions

View File

@@ -211,6 +211,10 @@ static HANDLE StartEditApplication(const UString &path, HWND window)
return 0;
}
#ifndef _UNICODE
typedef BOOL (WINAPI * ShellExecuteExWP)(LPSHELLEXECUTEINFOW lpExecInfo);
#endif
static HANDLE StartApplication(const UString &path, HWND window)
{
UINT32 result;
@@ -228,7 +232,11 @@ static HANDLE StartApplication(const UString &path, HWND window)
execInfo.lpDirectory = NULL;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
::ShellExecuteExW(&execInfo);
ShellExecuteExWP shellExecuteExW = (ShellExecuteExWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "ShellExecuteExW");
if (shellExecuteExW == 0)
return 0;
shellExecuteExW(&execInfo);
result = (UINT32)execInfo.hInstApp;
hProcess = execInfo.hProcess;
}

View File

@@ -51,6 +51,10 @@ struct CThreadDelete
}
};
#ifndef _UNICODE
typedef int (WINAPI * SHFileOperationWP)(LPSHFILEOPSTRUCTW lpFileOp);
#endif
void CPanel::DeleteItems(bool toRecycleBin)
{
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
@@ -118,7 +122,16 @@ void CPanel::DeleteItems(bool toRecycleBin)
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = ::SHFileOperationW(&fo);
int res;
#ifdef _UNICODE
res = ::SHFileOperationW(&fo);
#else
SHFileOperationWP shFileOperationW = (SHFileOperationWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
if (shFileOperationW == 0)
return;
res = shFileOperationW(&fo);
#endif
}
/*
if (fo.fAnyOperationsAborted)

View File

@@ -27,10 +27,10 @@ BEGIN
LTEXT "Destination folder already contains processed file.", IDC_STATIC_OVERWRITE_HEADER, marg, 7, xSize2, 8
LTEXT "Would you like to replace the existing file", IDC_STATIC_OVERWRITE_QUESTION_BEGIN, marg, 28, xSize2, 8
ICON "", IDC_STATIC_OVERWRITE_OLD_FILE_ICON, marg, 44, iconSize, iconSize
LTEXT "", IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, fiXPos, 44, fiXSize, fiYSize
LTEXT "", IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, fiXPos, 44, fiXSize, fiYSize, SS_NOPREFIX
LTEXT "with this one?",IDC_STATIC_OVERWRITE_QUESTION_END, marg, 98, xSize2, 8
ICON "",IDC_STATIC_OVERWRITE_NEW_FILE_ICON, marg, 114, iconSize, iconSize
LTEXT "",IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, fiXPos, 114, fiXSize, fiYSize
LTEXT "",IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, fiXPos, 114, fiXSize, fiYSize, SS_NOPREFIX
PUSHBUTTON "&Yes", IDYES, 78, b2YPos, bXSize, bYSize
PUSHBUTTON "Yes to &All", IDC_BUTTON_OVERWRITE_YES_TO_ALL, 152, b2YPos, bXSize, bYSize
PUSHBUTTON "&No", IDNO, 226, b2YPos, bXSize, bYSize

View File

@@ -42,7 +42,7 @@ BEGIN
RTEXT "", IDC_PROGRESS_REMAINING_VALUE, valPos1, yPos, valSize, 8
RTEXT "", IDC_PROGRESS_SPEED_TOTAL_VALUE, valPos2, marg, valSize, 8
RTEXT "", IDC_PROGRESS_SPEED_VALUE, valPos2, yPos, valSize, 8
LTEXT "", IDC_PROGRESS_FILE_NAME, marg, yPos + 16, xSize2, 8
LTEXT "", IDC_PROGRESS_FILE_NAME, marg, yPos + 16, xSize2, 8, SS_NOPREFIX
CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER,
marg, bYPos - 20, xSize2, 13
END

View File

@@ -42,6 +42,33 @@ DWORD_PTR GetRealIconIndex(LPCTSTR path, UINT32 attributes, int &iconIndex)
return res;
}
#ifndef _UNICODE
typedef int (WINAPI * SHGetFileInfoWP)(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
struct CSHGetFileInfoInit
{
SHGetFileInfoWP shGetFileInfoW;
CSHGetFileInfoInit()
{
shGetFileInfoW = (SHGetFileInfoWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
}
} g_SHGetFileInfoInit;
#endif
DWORD_PTR MySHGetFileInfoW(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
{
#ifdef _UNICODE
return SHGetFileInfoW(
#else
if (g_SHGetFileInfoInit.shGetFileInfoW == 0)
return 0;
return g_SHGetFileInfoInit.shGetFileInfoW(
#endif
pszPath, dwFileAttributes, psfi, cbFileInfo, uFlags);
}
#ifndef _UNICODE
// static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex)
@@ -49,7 +76,7 @@ DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex)
if(g_IsNT)
{
SHFILEINFOW shellInfo;
DWORD_PTR res = ::SHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
DWORD_PTR res = ::MySHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
iconIndex = shellInfo.iIcon;
return res;
@@ -79,7 +106,7 @@ DWORD_PTR GetRealIconIndex(const UString &fileName, UINT32 attributes,
{
SHFILEINFOW shellInfo;
shellInfo.szTypeName[0] = 0;
DWORD_PTR res = ::SHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
DWORD_PTR res = ::MySHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
| SHGFI_TYPENAME);
typeName = shellInfo.szTypeName;