This commit is contained in:
Igor Pavlov
2015-10-05 00:00:00 +00:00
committed by Kornel Lesiński
parent f6444c3256
commit 6543c28020
113 changed files with 3101 additions and 382 deletions

View File

@@ -178,7 +178,7 @@ bool CWindow2::OnCommand(int /* code */, int /* itemID */, LPARAM /* lParam */,
/*
bool CDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(aButtonID)
switch (buttonID)
{
case IDOK:
OnOK();

View File

@@ -25,7 +25,7 @@ public:
bool GetExitCodeProcess(LPDWORD lpExitCode) { return BOOLToBool(::GetExitCodeProcess(_handle, lpExitCode)); }
bool Terminate(UINT exitCode) { return BOOLToBool(::TerminateProcess(_handle, exitCode)); }
#if(WINVER >= 0x0500)
#if (WINVER >= 0x0500)
DWORD GetGuiResources (DWORD uiFlags) { return ::GetGuiResources(_handle, uiFlags); }
#endif
bool SetPriorityClass(DWORD dwPriorityClass) { return BOOLToBool(::SetPriorityClass(_handle, dwPriorityClass)); }

View File

@@ -9,9 +9,23 @@
namespace NWindows {
namespace NCOM {
BSTR AllocBstrFromAscii(const char *s) throw()
{
if (!s)
return NULL;
UINT len = (UINT)strlen(s);
BSTR p = ::SysAllocStringLen(NULL, len);
if (p)
{
for (UINT i = 0; i <= len; i++)
p[i] = (Byte)s[i];
}
return p;
}
HRESULT PropVarEm_Alloc_Bstr(PROPVARIANT *p, unsigned numChars) throw()
{
p->bstrVal = ::SysAllocStringLen(0, numChars);
p->bstrVal = ::SysAllocStringLen(NULL, numChars);
if (!p->bstrVal)
{
p->vt = VT_ERROR;
@@ -24,19 +38,12 @@ HRESULT PropVarEm_Alloc_Bstr(PROPVARIANT *p, unsigned numChars) throw()
HRESULT PropVarEm_Set_Str(PROPVARIANT *p, const char *s) throw()
{
UINT len = (UINT)strlen(s);
p->bstrVal = ::SysAllocStringLen(0, len);
if (!p->bstrVal)
{
p->vt = VT_ERROR;
p->scode = E_OUTOFMEMORY;
return E_OUTOFMEMORY;
}
p->vt = VT_BSTR;
BSTR dest = p->bstrVal;
for (UINT i = 0; i <= len; i++)
dest[i] = (Byte)s[i];
return S_OK;
p->bstrVal = AllocBstrFromAscii(s);
if (p->bstrVal)
return S_OK;
p->vt = VT_ERROR;
p->scode = E_OUTOFMEMORY;
return E_OUTOFMEMORY;
}
CPropVariant::CPropVariant(const PROPVARIANT &varSrc)
@@ -68,6 +75,7 @@ CPropVariant& CPropVariant::operator=(const CPropVariant &varSrc)
InternalCopy(&varSrc);
return *this;
}
CPropVariant& CPropVariant::operator=(const PROPVARIANT &varSrc)
{
InternalCopy(&varSrc);
@@ -144,20 +152,13 @@ CPropVariant& CPropVariant::operator=(const char *s)
InternalClear();
vt = VT_BSTR;
wReserved1 = 0;
UINT len = (UINT)strlen(s);
bstrVal = ::SysAllocStringLen(0, len);
bstrVal = AllocBstrFromAscii(s);
if (!bstrVal)
{
throw kMemException;
// vt = VT_ERROR;
// scode = E_OUTOFMEMORY;
}
else
{
BSTR dest = bstrVal;
for (UINT i = 0; i <= len; i++)
dest[i] = (Byte)s[i];
}
return *this;
}
@@ -178,7 +179,7 @@ BSTR CPropVariant::AllocBstr(unsigned numChars)
InternalClear();
vt = VT_BSTR;
wReserved1 = 0;
bstrVal = ::SysAllocStringLen(0, numChars);
bstrVal = ::SysAllocStringLen(NULL, numChars);
if (!bstrVal)
{
throw kMemException;
@@ -244,7 +245,7 @@ HRESULT CPropVariant::Clear() throw()
HRESULT CPropVariant::Copy(const PROPVARIANT* pSrc) throw()
{
::VariantClear((tagVARIANT *)this);
switch(pSrc->vt)
switch (pSrc->vt)
{
case VT_UI1:
case VT_I1:

View File

@@ -10,6 +10,8 @@
namespace NWindows {
namespace NCOM {
BSTR AllocBstrFromAscii(const char *s) throw();
HRESULT PropVariant_Clear(PROPVARIANT *p) throw();
HRESULT PropVarEm_Alloc_Bstr(PROPVARIANT *p, unsigned numChars) throw();

View File

@@ -37,7 +37,17 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool
UINT_TO_STR_2(' ', st.wHour);
UINT_TO_STR_2(':', st.wMinute);
if (includeSeconds)
{
UINT_TO_STR_2(':', st.wSecond);
/*
*s++ = '.';
unsigned val = st.wMilliseconds;
s[2] = (char)('0' + val % 10); val /= 10;
s[1] = (char)('0' + val % 10);
s[0] = (char)('0' + val / 10);
s += 3;
*/
}
}
*s = 0;
return true;

View File

@@ -177,7 +177,7 @@ bool BrowseForFolder(LPBROWSEINFO browseInfo, CSysString &resultPath)
int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM /* lp */, LPARAM data)
{
#ifndef UNDER_CE
switch(uMsg)
switch (uMsg)
{
case BFFM_INITIALIZED:
{
@@ -275,7 +275,7 @@ bool BrowseForFolder(LPBROWSEINFOW browseInfo, UString &resultPath)
int CALLBACK BrowseCallbackProc2(HWND hwnd, UINT uMsg, LPARAM /* lp */, LPARAM data)
{
switch(uMsg)
switch (uMsg)
{
case BFFM_INITIALIZED:
{