26#include <registry.hxx>
63 IUnknown* pUnk =
nullptr;
65 if (IID_IUnknown == riid || IID_IQueryInfo == riid)
67 pUnk =
static_cast<IQueryInfo*
>(
this);
72 else if (IID_IPersistFile == riid)
74 pUnk =
static_cast<IPersistFile*
>(
this);
86 return InterlockedIncrement(&
m_RefCnt);
108 ::std::wstring sDot(L
".");
120 HANDLE hFile = CreateFileW(FileName,
122 FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
125 FILE_ATTRIBUTE_NORMAL,
128 if (hFile != INVALID_HANDLE_VALUE)
130 DWORD dwSize = GetFileSize( hFile,
nullptr );
131 CloseHandle( hFile );
135 return INVALID_FILE_SIZE;
145 int dFileSize = dwSize;
147 _itoa( dFileSize, buffer, 10 );
151 char *buffer=
nullptr;
153 double dFileSize =
static_cast<double>(dwSize)/
KB;
155 buffer = _fcvt( dFileSize, 1, &decimal, &sign );
159 ::std::wstring wsBuffer = wsTemp.substr( 0,
pos);
162 for (;decimal -
pos > 2;
pos += 3)
166 wsBuffer.append( wsTemp.substr(
pos, 3) );
172 wsBuffer.append(wsTemp.substr( decimal, wsTemp.size()-decimal ));
184 if (dwSize != INVALID_FILE_SIZE)
197 const std::wstring CONST_SPACE(
SPACE);
263 catch (
const std::exception&)
279 HRESULT
hr = SHGetMalloc(&lpMalloc);
283 size_t len =
sizeof(wchar_t) * msg.length() +
sizeof(wchar_t);
284 wchar_t* pMem =
static_cast<wchar_t*
>(lpMalloc->Alloc(len));
286 ZeroMemory(pMem, len);
288 wcscpy_s(pMem, msg.length()+1, msg.c_str());
321 std::wstring fname = pszFileName;
325 std::wstring::iterator
begin = fname.begin() + fname.find_last_of(L
"\\") + 1;
326 std::wstring::iterator
end = fname.end();
virtual HRESULT STDMETHODCALLTYPE GetCurFile(LPOLESTR __RPC_FAR *ppszFileName) override
Filepath_char_t m_szFileName[MAX_PATH]
virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE GetInfoFlags(DWORD *pdwFlags) override
virtual HRESULT STDMETHODCALLTYPE SaveCompleted(LPCOLESTR pszFileName) override
virtual HRESULT STDMETHODCALLTYPE Save(LPCOLESTR pszFileName, BOOL fRemember) override
virtual ULONG STDMETHODCALLTYPE AddRef() override
std::wstring m_FileNameOnly
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
virtual ULONG STDMETHODCALLTYPE Release() override
virtual HRESULT STDMETHODCALLTYPE IsDirty() override
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID) override
virtual HRESULT STDMETHODCALLTYPE Load(LPCOLESTR pszFileName, DWORD dwMode) override
virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE GetInfoTip(DWORD dwFlags, PWSTR *ppwszTip) override
#define META_INFO_MODIFIED
#define META_INFO_SUBJECT
#define META_INFO_DESCRIPTION
Filepath_t get_file_name_extension(const Filepath_t &file_name)
Return the extension of a file name without the '.
const std::wstring WSPACE(SPACE)
static std::wstring formatSizeOfFile(DWORD dwSize)
format file size in to be more readable.
static std::wstring getFileSizeInfo(wchar_t const *FileName)
get file size information.
static std::wstring getFileTypeInfo(const std::wstring &file_extension)
get file type information from registry.
static DWORD getSizeOfFile(wchar_t const *FileName)
get file size.
std::wstring iso8601_date_to_local_date(const std::wstring &isoDate)
enumrange< T >::Iterator begin(enumrange< T >)
const wchar_t *typedef BOOL
bool QueryRegistryKey(HKEY RootKey, const Filepath_char_t *KeyName, const Filepath_char_t *ValueName, Filepath_char_t *pszData, DWORD dwBufLen)
Get the content of a specific key.
#define IDS_SUBJECT_COLON
#define IDS_COMMENTS_COLON
#define IDS_MODIFIED_COLON
const CLSID CLSID_INFOTIP_HANDLER
std::wstring GetResString(int ResId)
Retrieve a string from the resources of this module.
std::wstring getShortPathName(const std::wstring &aLongName)
helper function to convert windows paths to short form.
static std::wstring StringToWString(const std::string &String, int codepage)