This commit is contained in:
Igor Pavlov
2015-11-19 00:00:00 +00:00
committed by Kornel Lesiński
parent 7c8a265a15
commit e24f7fba53
70 changed files with 701 additions and 332 deletions

View File

@@ -32,6 +32,18 @@ public:
int InsertColumn(int columnIndex, const LVCOLUMN *columnInfo) { return ListView_InsertColumn(_window, columnIndex, columnInfo); }
int InsertColumn(int columnIndex, LPCTSTR text, int width);
bool SetColumnOrderArray(int count, const int *columns) { return BOOLToBool(ListView_SetColumnOrderArray(_window, count, columns)); }
/*
int GetNumColumns()
{
HWND header = ListView_GetHeader(_window);
if (!header)
return -1;
return Header_GetItemCount(header);
}
*/
int InsertItem(const LVITEM* item) { return ListView_InsertItem(_window, item); }
int InsertItem(int index, LPCTSTR text);
bool SetItem(const LVITEM* item) { return BOOLToBool(ListView_SetItem(_window, item)); }

View File

@@ -10,5 +10,3 @@ void ProcessMessages(HWND window);
}
#endif

View File

@@ -179,4 +179,3 @@ bool AddLockMemoryPrivilege()
}
}}

View File

@@ -11,6 +11,8 @@
namespace NWindows {
namespace NSystem {
#ifdef _WIN32
UInt32 GetNumberOfProcessors()
{
SYSTEM_INFO systemInfo;
@@ -18,6 +20,18 @@ UInt32 GetNumberOfProcessors()
return (UInt32)systemInfo.dwNumberOfProcessors;
}
#else
UInt32 GetNumberOfProcessors()
{
return 1;
}
#endif
#ifdef _WIN32
#ifndef UNDER_CE
#if !defined(_WIN64) && defined(__GNUC__)
@@ -45,29 +59,53 @@ typedef BOOL (WINAPI *GlobalMemoryStatusExP)(MY_LPMEMORYSTATUSEX lpBuffer);
#endif
UInt64 GetRamSize()
#endif
bool GetRamSize(UInt64 &size)
{
size = (UInt64)(sizeof(size_t)) << 29;
#ifdef _WIN32
#ifndef UNDER_CE
MY_MEMORYSTATUSEX stat;
stat.dwLength = sizeof(stat);
#endif
#ifdef _WIN64
if (!::GlobalMemoryStatusEx(&stat))
return 0;
return MyMin(stat.ullTotalVirtual, stat.ullTotalPhys);
#else
#ifndef UNDER_CE
GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")), "GlobalMemoryStatusEx");
if (globalMemoryStatusEx != 0 && globalMemoryStatusEx(&stat))
return MyMin(stat.ullTotalVirtual, stat.ullTotalPhys);
#endif
{
MEMORYSTATUS stat;
MY_MEMORYSTATUSEX stat;
stat.dwLength = sizeof(stat);
::GlobalMemoryStatus(&stat);
return MyMin(stat.dwTotalVirtual, stat.dwTotalPhys);
}
#endif
#ifdef _WIN64
if (!::GlobalMemoryStatusEx(&stat))
return false;
size = MyMin(stat.ullTotalVirtual, stat.ullTotalPhys);
return true;
#else
#ifndef UNDER_CE
GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")), "GlobalMemoryStatusEx");
if (globalMemoryStatusEx && globalMemoryStatusEx(&stat))
{
size = MyMin(stat.ullTotalVirtual, stat.ullTotalPhys);
return true;
}
#endif
{
MEMORYSTATUS stat2;
stat2.dwLength = sizeof(stat2);
::GlobalMemoryStatus(&stat2);
size = MyMin(stat2.dwTotalVirtual, stat2.dwTotalPhys);
return true;
}
#endif
#else
return false;
#endif
}

View File

@@ -9,7 +9,8 @@ namespace NWindows {
namespace NSystem {
UInt32 GetNumberOfProcessors();
UInt64 GetRamSize();
bool GetRamSize(UInt64 &size); // returns false, if unknown ram size
}}