Change NULL to nullptr

This commit is contained in:
Birunthan Mohanathas 2013-05-31 17:28:39 +03:00
parent da9384cfad
commit 1934c5db72
92 changed files with 760 additions and 759 deletions

View File

@ -73,9 +73,9 @@ FARPROC WINAPI DelayLoadFailureHook(unsigned int dliNotify, DelayLoadInfo* dli)
#endif #endif
const WCHAR* format = L"%S (%i-bit) error %ld.\n\nDo you want to view help online?"; const WCHAR* format = L"%S (%i-bit) error %ld.\n\nDo you want to view help online?";
wsprintf(buffer, format, dli->szDll, arch, dli->dwLastError); wsprintf(buffer, format, dli->szDll, arch, dli->dwLastError);
if (MessageBox(NULL, buffer, L"Rainmeter", MB_YESNO | MB_ICONERROR) == IDYES) if (MessageBox(nullptr, buffer, L"Rainmeter", MB_YESNO | MB_ICONERROR) == IDYES)
{ {
ShellExecute(NULL, L"open", L"http://rainmeter.net/dllerror", NULL, NULL, SW_SHOWNORMAL); ShellExecute(nullptr, L"open", L"http://rainmeter.net/dllerror", nullptr, nullptr, SW_SHOWNORMAL);
} }
ExitProcess(0); ExitProcess(0);
@ -117,12 +117,12 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)
const DWORD size = MAX_PATH; const DWORD size = MAX_PATH;
WCHAR buffer[size]; WCHAR buffer[size];
DWORD type = 0; DWORD type = 0;
if (RegQueryValueEx(hKey, NULL , NULL, &type, (LPBYTE)buffer, (LPDWORD)&size) == ERROR_SUCCESS && if (RegQueryValueEx(hKey, nullptr , nullptr, &type, (LPBYTE)buffer, (LPDWORD)&size) == ERROR_SUCCESS &&
type == REG_SZ) type == REG_SZ)
{ {
SetCurrentDirectory(buffer); SetCurrentDirectory(buffer);
lstrcat(buffer, L"\\Rainmeter.exe"); lstrcat(buffer, L"\\Rainmeter.exe");
ShellExecute(NULL, L"open", buffer, args, NULL, SW_SHOWNORMAL); ShellExecute(nullptr, L"open", buffer, args, nullptr, SW_SHOWNORMAL);
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }
@ -136,7 +136,7 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)
#ifndef _DEBUG #ifndef _DEBUG
EXTERN_C int WINAPI Main() EXTERN_C int WINAPI Main()
{ {
int result = wWinMain(NULL, NULL, NULL, 0); int result = wWinMain(nullptr, nullptr, nullptr, 0);
ExitProcess(result); ExitProcess(result);
return 0; // Never reached. return 0; // Never reached.
} }

View File

@ -27,7 +27,7 @@ void CreateControls(const Control* cts, UINT ctCount, HWND parent, HFONT font, G
{ {
const Control& ct = cts[i]; const Control& ct = cts[i];
WCHAR* text = ct.textId ? getString(ct.textId) : NULL; WCHAR* text = ct.textId ? getString(ct.textId) : nullptr;
RECT r = { ct.x, ct.y, ct.w, ct.h }; RECT r = { ct.x, ct.y, ct.w, ct.h };
MapDialogRect(parent, &r); MapDialogRect(parent, &r);
@ -40,8 +40,8 @@ void CreateControls(const Control* cts, UINT ctCount, HWND parent, HFONT font, G
r.left, r.top, r.right, r.bottom, r.left, r.top, r.right, r.bottom,
parent, parent,
(HMENU)ct.id, (HMENU)ct.id,
NULL, nullptr,
NULL); nullptr);
SendMessage(wnd, WM_SETFONT, (WPARAM)font, FALSE); SendMessage(wnd, WM_SETFONT, (WPARAM)font, FALSE);
} }
} }

View File

@ -20,7 +20,7 @@
#include <Commctrl.h> #include <Commctrl.h>
#include <Uxtheme.h> #include <Uxtheme.h>
HWND Dialog::c_ActiveDialogWindow = NULL; HWND Dialog::c_ActiveDialogWindow = nullptr;
// //
// BaseDialog // BaseDialog
@ -88,11 +88,11 @@ void BaseDialog::Show(const WCHAR* title, short x, short y, short w, short h, DW
if (modeless) if (modeless)
{ {
CreateDialogIndirectParam(NULL, dt, parent, InitialDlgProc, (LPARAM)this); CreateDialogIndirectParam(nullptr, dt, parent, InitialDlgProc, (LPARAM)this);
} }
else else
{ {
DialogBoxIndirectParam(NULL, dt, parent, InitialDlgProc, (LPARAM)this); DialogBoxIndirectParam(nullptr, dt, parent, InitialDlgProc, (LPARAM)this);
} }
delete [] dt; delete [] dt;
@ -154,7 +154,7 @@ void Dialog::ShowDialogWindow(const WCHAR* title, short x, short y, short w, sho
INT_PTR Dialog::OnActivate(WPARAM wParam, LPARAM lParam) INT_PTR Dialog::OnActivate(WPARAM wParam, LPARAM lParam)
{ {
c_ActiveDialogWindow = wParam ? m_Window : NULL; c_ActiveDialogWindow = wParam ? m_Window : nullptr;
return FALSE; return FALSE;
} }
@ -177,7 +177,7 @@ bool Dialog::HandleMessage(MSG& msg)
*/ */
void Dialog::SetMenuButton(HWND button) void Dialog::SetMenuButton(HWND button)
{ {
SetWindowSubclass(button, MenuButtonProc, NULL, NULL); SetWindowSubclass(button, MenuButtonProc, 0, 0);
} }
LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)

View File

@ -50,7 +50,7 @@ HRESULT STDMETHODCALLTYPE DWriteFontCollectionLoader::QueryInterface(IID const&
return S_OK; return S_OK;
} }
*ppvObject = NULL; *ppvObject = nullptr;
return E_NOINTERFACE; return E_NOINTERFACE;
} }

View File

@ -55,7 +55,7 @@ HRESULT STDMETHODCALLTYPE DWriteFontFileEnumerator::QueryInterface(IID const& ri
return S_OK; return S_OK;
} }
*ppvObject = NULL; *ppvObject = nullptr;
return E_NOINTERFACE; return E_NOINTERFACE;
} }

View File

@ -35,7 +35,7 @@ HMENU MenuTemplate::CreateSubMenu(const MenuTemplate* items, UINT& itemIndex, UI
UINT itemFlags = MF_STRING; UINT itemFlags = MF_STRING;
UINT_PTR itemId = item.id; UINT_PTR itemId = item.id;
const WCHAR* itemText = item.idText ? getString(item.idText) : NULL; const WCHAR* itemText = item.idText ? getString(item.idText) : nullptr;
if (item.type == MenuItem_ItemGrayed) if (item.type == MenuItem_ItemGrayed)
{ {

View File

@ -31,11 +31,11 @@ std::string Narrow(const WCHAR* str, int strLen, int cp)
strLen = (int)wcslen(str); strLen = (int)wcslen(str);
} }
int bufLen = WideCharToMultiByte(cp, 0, str, strLen, NULL, 0, NULL, NULL); int bufLen = WideCharToMultiByte(cp, 0, str, strLen, nullptr, 0, nullptr, nullptr);
if (bufLen > 0) if (bufLen > 0)
{ {
narrowStr.resize(bufLen); narrowStr.resize(bufLen);
WideCharToMultiByte(cp, 0, str, strLen, &narrowStr[0], bufLen, NULL, NULL); WideCharToMultiByte(cp, 0, str, strLen, &narrowStr[0], bufLen, nullptr, nullptr);
} }
} }
return narrowStr; return narrowStr;
@ -52,7 +52,7 @@ std::wstring Widen(const char* str, int strLen, int cp)
strLen = strlen(str); strLen = strlen(str);
} }
int bufLen = MultiByteToWideChar(cp, 0, str, strLen, NULL, 0); int bufLen = MultiByteToWideChar(cp, 0, str, strLen, nullptr, 0);
if (bufLen > 0) if (bufLen > 0)
{ {
wideStr.resize(bufLen); wideStr.resize(bufLen);

View File

@ -56,13 +56,13 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)
if (!IsSupportedPlatform()) if (!IsSupportedPlatform())
{ {
MessageBox(NULL, L"Windows XP SP2 or higher is required to install Rainmeter.", NULL, MB_OK | MB_ICONERROR); MessageBox(nullptr, L"Windows XP SP2 or higher is required to install Rainmeter.", nullptr, MB_OK | MB_ICONERROR);
return (int)InstallStatus::UnsupportedPlatform; return (int)InstallStatus::UnsupportedPlatform;
} }
if (!IsSupportedCPU()) if (!IsSupportedCPU())
{ {
MessageBox(NULL, L"A Pentium III or later processor is required to install Rainmeter.", NULL, MB_OK | MB_ICONERROR); MessageBox(nullptr, L"A Pentium III or later processor is required to install Rainmeter.", nullptr, MB_OK | MB_ICONERROR);
return (int)InstallStatus::UnsupportedPlatform; return (int)InstallStatus::UnsupportedPlatform;
} }

View File

@ -37,7 +37,7 @@ CDialogInstall* CDialogInstall::Create()
0, 0, 350, 210, 0, 0, 350, 210,
DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
WS_EX_APPWINDOW | WS_EX_CONTROLPARENT, WS_EX_APPWINDOW | WS_EX_CONTROLPARENT,
NULL, nullptr,
false); false);
return dialog; return dialog;

View File

@ -53,7 +53,7 @@ bool IsProcessUserAdmin()
BOOL runningAsAdmin = FALSE; BOOL runningAsAdmin = FALSE;
// Allocate and initialize a SID of the administrators group. // Allocate and initialize a SID of the administrators group.
PSID adminGroupSid = NULL; PSID adminGroupSid = nullptr;
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
if (AllocateAndInitializeSid( if (AllocateAndInitializeSid(
&NtAuthority, &NtAuthority,
@ -64,13 +64,13 @@ bool IsProcessUserAdmin()
&adminGroupSid)) &adminGroupSid))
{ {
// Check if the primary access token of the process has the admin group SID. // Check if the primary access token of the process has the admin group SID.
if (!CheckTokenMembership(NULL, adminGroupSid, &runningAsAdmin)) if (!CheckTokenMembership(nullptr, adminGroupSid, &runningAsAdmin))
{ {
runningAsAdmin = TRUE; runningAsAdmin = TRUE;
} }
FreeSid(adminGroupSid); FreeSid(adminGroupSid);
adminGroupSid = NULL; adminGroupSid = nullptr;
} }
return runningAsAdmin; return runningAsAdmin;
@ -130,7 +130,7 @@ bool CopyDirectory(const WCHAR* fromPath, const WCHAR* toPath)
SHFILEOPSTRUCT fo = SHFILEOPSTRUCT fo =
{ {
NULL, nullptr,
FO_COPY, FO_COPY,
from, from,
to, to,
@ -148,7 +148,7 @@ bool CopyDirectory(const WCHAR* fromPath, const WCHAR* toPath)
bool CreateShortcutFile(const WCHAR* filePath, const WCHAR* targetPath) bool CreateShortcutFile(const WCHAR* filePath, const WCHAR* targetPath)
{ {
IShellLink* psl; IShellLink* psl;
HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl); HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
IPersistFile* ppf; IPersistFile* ppf;
@ -195,7 +195,7 @@ bool SetRegistryData(DWORD type, HKEY rootKey, const WCHAR* subKey, const WCHAR*
{ {
BOOL result = FALSE; BOOL result = FALSE;
HKEY regKey; HKEY regKey;
if (RegCreateKeyEx(rootKey, subKey, 0, 0, 0, KEY_SET_VALUE, NULL, &regKey, NULL) == ERROR_SUCCESS) if (RegCreateKeyEx(rootKey, subKey, 0, 0, 0, KEY_SET_VALUE, nullptr, &regKey, nullptr) == ERROR_SUCCESS)
{ {
if (RegSetValueEx(regKey, value, 0, type, data, dataSize) == ERROR_SUCCESS) if (RegSetValueEx(regKey, value, 0, type, data, dataSize) == ERROR_SUCCESS)
{ {
@ -226,13 +226,13 @@ bool SetRegistryString(HKEY rootKey, const WCHAR* subKey, const WCHAR* value, co
bool DownloadFile(const WCHAR* url, const WCHAR* file) bool DownloadFile(const WCHAR* url, const WCHAR* file)
{ {
bool result = false; bool result = false;
HINTERNET hNet = InternetOpen(L"Mozilla/5.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); HINTERNET hNet = InternetOpen(L"Mozilla/5.0", INTERNET_OPEN_TYPE_PRECONFIG, nullptr, nullptr, 0);
if (hNet) if (hNet)
{ {
HANDLE hFile = CreateFile(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE hFile = CreateFile(file, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile) if (hFile)
{ {
HINTERNET hUrl = InternetOpenUrl(hNet, url, NULL, 0, INTERNET_FLAG_RESYNCHRONIZE, 0); HINTERNET hUrl = InternetOpenUrl(hNet, url, nullptr, 0, INTERNET_FLAG_RESYNCHRONIZE, 0);
if (hUrl) if (hUrl)
{ {
const DWORD bufferSize = 8192; const DWORD bufferSize = 8192;
@ -250,7 +250,7 @@ bool DownloadFile(const WCHAR* url, const WCHAR* file)
} }
DWORD writeSize; DWORD writeSize;
if (!WriteFile(hFile, buffer, readSize, &writeSize, NULL) || if (!WriteFile(hFile, buffer, readSize, &writeSize, nullptr) ||
readSize != writeSize) readSize != writeSize)
{ {
break; break;

View File

@ -257,7 +257,7 @@ void CommandHandler::ExecuteCommand(const WCHAR* command, MeterWindow* skin, boo
if (pos) if (pos)
{ {
bang.assign(command, 0, pos - command); bang.assign(command, 0, pos - command);
args = ParseString(pos + 1, skin ? &skin->GetParser() : NULL); args = ParseString(pos + 1, skin ? &skin->GetParser() : nullptr);
} }
else else
{ {
@ -290,7 +290,7 @@ void CommandHandler::ExecuteCommand(const WCHAR* command, MeterWindow* skin, boo
if (count == 0 && start != std::wstring::npos) if (count == 0 && start != std::wstring::npos)
{ {
// Change ] to NULL // Change ] to nullptr
bangs[i] = L'\0'; bangs[i] = L'\0';
// Skip whitespace // Skip whitespace
@ -348,13 +348,13 @@ void CommandHandler::ExecuteCommand(const WCHAR* command, MeterWindow* skin, boo
skin->MakePathAbsolute(sound); skin->MakePathAbsolute(sound);
} }
PlaySound(sound.c_str(), NULL, flags); PlaySound(sound.c_str(), nullptr, flags);
} }
return; return;
} }
else if (_wcsnicmp(L"STOP", &command[4], 4) == 0) // PLAYSTOP else if (_wcsnicmp(L"STOP", &command[4], 4) == 0) // PLAYSTOP
{ {
PlaySound(NULL, NULL, SND_PURGE); PlaySound(nullptr, nullptr, SND_PURGE);
return; return;
} }
} }
@ -460,7 +460,7 @@ void CommandHandler::RunFile(const WCHAR* file, const WCHAR* args)
DWORD type = GetFileAttributes(si.lpFile); DWORD type = GetFileAttributes(si.lpFile);
if (type & FILE_ATTRIBUTE_DIRECTORY && type != 0xFFFFFFFF) if (type & FILE_ATTRIBUTE_DIRECTORY && type != 0xFFFFFFFF)
{ {
ShellExecute(si.hwnd, si.lpVerb, si.lpFile, NULL, NULL, si.nShow); ShellExecute(si.hwnd, si.lpVerb, si.lpFile, nullptr, nullptr, si.nShow);
} }
else else
{ {
@ -751,7 +751,7 @@ void CommandHandler::DoSkinMenuBang(std::vector<std::wstring>& args, MeterWindow
void CommandHandler::DoTrayMenuBang(std::vector<std::wstring>& args, MeterWindow* skin) void CommandHandler::DoTrayMenuBang(std::vector<std::wstring>& args, MeterWindow* skin)
{ {
POINT pos = System::GetCursorPosition(); POINT pos = System::GetCursorPosition();
g_Rainmeter->ShowContextMenu(pos, NULL); g_Rainmeter->ShowContextMenu(pos, nullptr);
} }
void CommandHandler::DoResetStatsBang(std::vector<std::wstring>& args, MeterWindow* meterWindow) void CommandHandler::DoResetStatsBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
@ -865,7 +865,7 @@ void CommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, MeterW
{ {
if (write != 0) if (write != 0)
{ {
WritePrivateProfileString(NULL, NULL, NULL, iniWrite); // FLUSH WritePrivateProfileString(nullptr, nullptr, nullptr, iniWrite); // FLUSH
// Copy the file back. // Copy the file back.
if (!System::CopyFiles(strIniWrite, strIniFile)) if (!System::CopyFiles(strIniWrite, strIniFile))
@ -924,13 +924,13 @@ void CommandHandler::DoLogBang(std::vector<std::wstring>& args, MeterWindow* ski
void CommandHandler::DoRefreshApp(std::vector<std::wstring>& args, MeterWindow* meterWindow) void CommandHandler::DoRefreshApp(std::vector<std::wstring>& args, MeterWindow* meterWindow)
{ {
// Refresh needs to be delayed since it crashes if done during Update(). // Refresh needs to be delayed since it crashes if done during Update().
PostMessage(g_Rainmeter->m_Window, WM_RAINMETER_DELAYED_REFRESH_ALL, NULL, NULL); PostMessage(g_Rainmeter->m_Window, WM_RAINMETER_DELAYED_REFRESH_ALL, 0, 0);
} }
void CommandHandler::DoQuitBang(std::vector<std::wstring>& args, MeterWindow* meterWindow) void CommandHandler::DoQuitBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
{ {
// Quit needs to be delayed since it crashes if done during Update(). // Quit needs to be delayed since it crashes if done during Update().
PostMessage(g_Rainmeter->GetTrayWindow()->GetWindow(), WM_COMMAND, MAKEWPARAM(IDM_QUIT, 0), NULL); PostMessage(g_Rainmeter->GetTrayWindow()->GetWindow(), WM_COMMAND, MAKEWPARAM(IDM_QUIT, 0), 0);
} }
void CommandHandler::DoLsBoxHookBang(std::vector<std::wstring>& args, MeterWindow* meterWindow) void CommandHandler::DoLsBoxHookBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)

View File

@ -115,9 +115,9 @@ public:
void ExecuteBang(const WCHAR* name, std::vector<std::wstring>& args, MeterWindow* skin); void ExecuteBang(const WCHAR* name, std::vector<std::wstring>& args, MeterWindow* skin);
static void RunCommand(std::wstring command); static void RunCommand(std::wstring command);
static void RunFile(const WCHAR* file, const WCHAR* args = NULL); static void RunFile(const WCHAR* file, const WCHAR* args = nullptr);
static std::vector<std::wstring> ParseString(const WCHAR* str, ConfigParser* parser = NULL); static std::vector<std::wstring> ParseString(const WCHAR* str, ConfigParser* parser = nullptr);
static void DoActivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin); static void DoActivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin);
static void DoDeactivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin); static void DoDeactivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin);

View File

@ -68,7 +68,7 @@ void ConfigParser::Initialize(const std::wstring& filename, MeterWindow* meterWi
m_LastDefaultUsed = false; m_LastDefaultUsed = false;
m_LastValueDefined = false; m_LastValueDefined = false;
m_CurrentSection = NULL; m_CurrentSection = nullptr;
m_SectionInsertPos = m_Sections.end(); m_SectionInsertPos = m_Sections.end();
// Set the built-in variables. Do this before the ini file is read so that the paths can be used with @include // Set the built-in variables. Do this before the ini file is read so that the paths can be used with @include
@ -143,7 +143,7 @@ void ConfigParser::SetBuiltInVariable(const std::wstring& strVariable, const std
} }
/* /*
** Gets a value for the variable. Returns NULL if not found. ** Gets a value for the variable. Returns nullptr if not found.
** **
*/ */
const std::wstring* ConfigParser::GetVariable(const std::wstring& strVariable) const std::wstring* ConfigParser::GetVariable(const std::wstring& strVariable)
@ -171,7 +171,7 @@ const std::wstring* ConfigParser::GetVariable(const std::wstring& strVariable)
return &(*iter).second; return &(*iter).second;
} }
return NULL; return nullptr;
} }
/* /*
@ -341,7 +341,7 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s
} }
else else
{ {
decimalsSz = NULL; decimalsSz = nullptr;
} }
} }
@ -805,7 +805,7 @@ Measure* ConfigParser::GetMeasure(const std::wstring& name)
return (*iter).second; return (*iter).second;
} }
return NULL; return nullptr;
} }
std::vector<Gdiplus::REAL> ConfigParser::ReadFloats(LPCTSTR section, LPCTSTR key) std::vector<Gdiplus::REAL> ConfigParser::ReadFloats(LPCTSTR section, LPCTSTR key)
@ -855,7 +855,7 @@ int ConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue)
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
int intValue = wcstol(string, NULL, 10); int intValue = wcstol(string, nullptr, 10);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return intValue; return intValue;
@ -887,7 +887,7 @@ uint32_t ConfigParser::ReadUInt(LPCTSTR section, LPCTSTR key, uint32_t defValue)
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
uint32_t uintValue = wcstoul(string, NULL, 10); uint32_t uintValue = wcstoul(string, nullptr, 10);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return uintValue; return uintValue;
@ -919,7 +919,7 @@ uint64_t ConfigParser::ReadUInt64(LPCTSTR section, LPCTSTR key, uint64_t defValu
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
uint64_t uint64Value = _wcstoui64(string, NULL, 10); uint64_t uint64Value = _wcstoui64(string, nullptr, 10);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return uint64Value; return uint64Value;
@ -951,7 +951,7 @@ double ConfigParser::ReadFloat(LPCTSTR section, LPCTSTR key, double defValue)
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
value = wcstod(string, NULL); value = wcstod(string, nullptr);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return value; return value;
@ -970,7 +970,7 @@ bool ConfigParser::ParseFormula(const std::wstring& formula, double* resultValue
{ {
const WCHAR* string = formula.c_str(); const WCHAR* string = formula.c_str();
const WCHAR* errMsg = MathParser::CheckedParse(string, resultValue); const WCHAR* errMsg = MathParser::CheckedParse(string, resultValue);
if (errMsg != NULL) if (errMsg != nullptr)
{ {
LogErrorF(L"Formula: %s: %s", errMsg, string); LogErrorF(L"Formula: %s: %s", errMsg, string);
return false; return false;
@ -1074,7 +1074,7 @@ double ConfigParser::ParseDouble(LPCTSTR string, double defValue)
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
double value = wcstod(string, NULL); double value = wcstod(string, nullptr);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return value; return value;
@ -1107,7 +1107,7 @@ int ConfigParser::ParseInt(LPCTSTR string, int defValue)
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
int intValue = wcstol(string, NULL, 10); int intValue = wcstol(string, nullptr, 10);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return intValue; return intValue;
@ -1140,7 +1140,7 @@ uint32_t ConfigParser::ParseUInt(LPCTSTR string, uint32_t defValue)
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
uint32_t uintValue = wcstoul(string, NULL, 10); uint32_t uintValue = wcstoul(string, nullptr, 10);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return uintValue; return uintValue;
@ -1173,7 +1173,7 @@ uint64_t ConfigParser::ParseUInt64(LPCTSTR string, uint64_t defValue)
else if (*string) else if (*string)
{ {
errno = 0; errno = 0;
uint64_t uint64Value = _wcstoui64(string, NULL, 10); uint64_t uint64Value = _wcstoui64(string, nullptr, 10);
if (errno != ERANGE) if (errno != ERANGE)
{ {
return uint64Value; return uint64Value;
@ -1200,17 +1200,17 @@ bool ParseInt4(LPCTSTR string, T& v1, T& v2, T& v3, T& v4)
{ {
v1 = ConfigParser::ParseInt(token, 0); v1 = ConfigParser::ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
v2 = ConfigParser::ParseInt(token, 0); v2 = ConfigParser::ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
v3 = ConfigParser::ParseInt(token, 0); v3 = ConfigParser::ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
v4 = ConfigParser::ParseInt(token, 0); v4 = ConfigParser::ParseInt(token, 0);
@ -1288,7 +1288,7 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection,
{ {
if (depth > 100) // Is 100 enough to assume the include loop never ends? if (depth > 100) // Is 100 enough to assume the include loop never ends?
{ {
g_Rainmeter->ShowMessage(NULL, GetString(ID_STR_INCLUDEINFINITELOOP), MB_OK | MB_ICONERROR); g_Rainmeter->ShowMessage(nullptr, GetString(ID_STR_INCLUDEINFINITELOOP), MB_OK | MB_ICONERROR);
return; return;
} }
@ -1320,10 +1320,10 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection,
DWORD itemsSize = MAX_LINE_LENGTH; DWORD itemsSize = MAX_LINE_LENGTH;
WCHAR* items = new WCHAR[itemsSize]; WCHAR* items = new WCHAR[itemsSize];
WCHAR* pos = NULL; WCHAR* pos = nullptr;
WCHAR* epos = NULL; WCHAR* epos = nullptr;
if (skinSection == NULL) if (skinSection == nullptr)
{ {
// Get all the sections // Get all the sections
do do
@ -1395,7 +1395,7 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection,
const WCHAR* sectionName = (*it).c_str(); const WCHAR* sectionName = (*it).c_str();
bool isVariables = (_wcsicmp(sectionName, L"Variables") == 0); bool isVariables = (_wcsicmp(sectionName, L"Variables") == 0);
bool isMetadata = (skinSection == NULL && !isVariables && _wcsicmp(sectionName, L"Metadata") == 0); bool isMetadata = (skinSection == nullptr && !isVariables && _wcsicmp(sectionName, L"Metadata") == 0);
bool resetInsertPos = true; bool resetInsertPos = true;
// Read all "key=value" from the section // Read all "key=value" from the section
@ -1422,7 +1422,7 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection,
{ {
size_t len = wcslen(pos); size_t len = wcslen(pos);
WCHAR* sep = wmemchr(pos, L'=', len); WCHAR* sep = wmemchr(pos, L'=', len);
if (sep != NULL && sep != pos) if (sep != nullptr && sep != pos)
{ {
size_t clen = sep - pos; // key's length size_t clen = sep - pos; // key's length

View File

@ -41,7 +41,7 @@ public:
ConfigParser(); ConfigParser();
~ConfigParser(); ~ConfigParser();
void Initialize(const std::wstring& filename, MeterWindow* meterWindow = NULL, LPCTSTR skinSection = NULL, const std::wstring* resourcePath = NULL); void Initialize(const std::wstring& filename, MeterWindow* meterWindow = nullptr, LPCTSTR skinSection = nullptr, const std::wstring* resourcePath = nullptr);
void AddMeasure(Measure* pMeasure); void AddMeasure(Measure* pMeasure);
Measure* GetMeasure(const std::wstring& name); Measure* GetMeasure(const std::wstring& name);
@ -64,7 +64,7 @@ public:
bool GetLastKeyDefined() { return !m_LastDefaultUsed; } bool GetLastKeyDefined() { return !m_LastDefaultUsed; }
bool GetLastValueDefined() { return m_LastValueDefined; } bool GetLastValueDefined() { return m_LastValueDefined; }
void ResetMonitorVariables(MeterWindow* meterWindow = NULL); void ResetMonitorVariables(MeterWindow* meterWindow = nullptr);
const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true); const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true);
bool IsKeyDefined(LPCTSTR section, LPCTSTR key); bool IsKeyDefined(LPCTSTR section, LPCTSTR key);
@ -102,7 +102,7 @@ private:
void ReadVariables(); void ReadVariables();
void ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection = NULL, int depth = 0); void ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection = nullptr, int depth = 0);
void SetAutoSelectedMonitorVariables(MeterWindow* meterWindow); void SetAutoSelectedMonitorVariables(MeterWindow* meterWindow);

View File

@ -19,8 +19,8 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "Dialog.h" #include "Dialog.h"
HWND Dialog::c_ActiveDialogWindow = NULL; HWND Dialog::c_ActiveDialogWindow = nullptr;
HWND Dialog::c_ActiveTabWindow = NULL; HWND Dialog::c_ActiveTabWindow = nullptr;
/* /*
** Constructor. ** Constructor.
@ -59,7 +59,7 @@ INT_PTR Dialog::OnActivate(WPARAM wParam, LPARAM lParam)
} }
else else
{ {
c_ActiveDialogWindow = c_ActiveTabWindow = NULL; c_ActiveDialogWindow = c_ActiveTabWindow = nullptr;
} }
return FALSE; return FALSE;
@ -86,7 +86,7 @@ BOOL CALLBACK Dialog::SetFontProc(HWND hWnd, LPARAM lParam)
*/ */
void Dialog::SetMenuButton(HWND button) void Dialog::SetMenuButton(HWND button)
{ {
SetWindowSubclass(button, MenuButtonProc, NULL, NULL); SetWindowSubclass(button, MenuButtonProc, 0, 0);
} }
LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)

View File

@ -29,7 +29,7 @@
extern Rainmeter* g_Rainmeter; extern Rainmeter* g_Rainmeter;
WINDOWPLACEMENT DialogAbout::c_WindowPlacement = {0}; WINDOWPLACEMENT DialogAbout::c_WindowPlacement = {0};
DialogAbout* DialogAbout::c_Dialog = NULL; DialogAbout* DialogAbout::c_Dialog = nullptr;
/* /*
** Constructor. ** Constructor.
@ -192,11 +192,11 @@ INT_PTR DialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
RECT r; RECT r;
HWND item = GetControl(Id_Tab); HWND item = GetControl(Id_Tab);
SetWindowPos(item, NULL, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(item, nullptr, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER);
item = GetControl(Id_CloseButton); item = GetControl(Id_CloseButton);
GetClientRect(item, &r); GetClientRect(item, &r);
SetWindowPos(item, NULL, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER); SetWindowPos(item, nullptr, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
w -= 48; w -= 48;
h -= 100; h -= 100;
@ -217,7 +217,7 @@ INT_PTR DialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
delete c_Dialog; delete c_Dialog;
c_Dialog = NULL; c_Dialog = nullptr;
} }
return TRUE; return TRUE;
} }
@ -265,9 +265,9 @@ INT_PTR DialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
if (Platform::IsAtLeastWinVista()) if (Platform::IsAtLeastWinVista())
{ {
item = m_TabLog.GetControl(TabLog::Id_ItemsListView); item = m_TabLog.GetControl(TabLog::Id_ItemsListView);
SetWindowTheme(item, L"explorer", NULL); SetWindowTheme(item, L"explorer", nullptr);
item = m_TabSkins.GetControl(TabSkins::Id_ItemsListView); item = m_TabSkins.GetControl(TabSkins::Id_ItemsListView);
SetWindowTheme(item, L"explorer", NULL); SetWindowTheme(item, L"explorer", nullptr);
} }
if (c_WindowPlacement.length == 0) if (c_WindowPlacement.length == 0)
@ -435,25 +435,25 @@ void DialogAbout::TabLog::Initialize()
*/ */
void DialogAbout::TabLog::Resize(int w, int h) void DialogAbout::TabLog::Resize(int w, int h)
{ {
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
RECT r; RECT r;
HWND item = GetControl(Id_ErrorCheckBox); HWND item = GetControl(Id_ErrorCheckBox);
GetClientRect(item, &r); GetClientRect(item, &r);
SetWindowPos(item, NULL, 0, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); SetWindowPos(item, nullptr, 0, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
item = GetControl(Id_WarningCheckBox); item = GetControl(Id_WarningCheckBox);
SetWindowPos(item, NULL, r.right, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); SetWindowPos(item, nullptr, r.right, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
item = GetControl(Id_NoticeCheckBox); item = GetControl(Id_NoticeCheckBox);
SetWindowPos(item, NULL, r.right * 2, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); SetWindowPos(item, nullptr, r.right * 2, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
item = GetControl(Id_DebugCheckBox); item = GetControl(Id_DebugCheckBox);
SetWindowPos(item, NULL, r.right * 3, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); SetWindowPos(item, nullptr, r.right * 3, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
item = GetControl(Id_ItemsListView); item = GetControl(Id_ItemsListView);
SetWindowPos(item, NULL, 0, 0, w, h - r.bottom - 7, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(item, nullptr, 0, 0, w, h - r.bottom - 7, SWP_NOMOVE | SWP_NOZORDER);
// Adjust third colum // Adjust third colum
LVCOLUMN lvc; LVCOLUMN lvc;
@ -674,14 +674,14 @@ void DialogAbout::TabSkins::Initialize()
*/ */
void DialogAbout::TabSkins::Resize(int w, int h) void DialogAbout::TabSkins::Resize(int w, int h)
{ {
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
HWND item = GetControl(Id_SkinsListBox); HWND item = GetControl(Id_SkinsListBox);
int wList = (w < 650) ? (w - 373) : 277; int wList = (w < 650) ? (w - 373) : 277;
SetWindowPos(item, NULL, 0, 0, wList, h, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(item, nullptr, 0, 0, wList, h, SWP_NOMOVE | SWP_NOZORDER);
item = GetControl(Id_ItemsListView); item = GetControl(Id_ItemsListView);
SetWindowPos(item, NULL, (w < 650) ? (w - 365) : 285, 0, w - wList - 10, h, SWP_NOZORDER); SetWindowPos(item, nullptr, (w < 650) ? (w - 365) : 285, 0, w - wList - 10, h, SWP_NOZORDER);
// Adjust third column // Adjust third column
LVCOLUMN lvc; LVCOLUMN lvc;
@ -730,7 +730,7 @@ void DialogAbout::TabSkins::UpdateSkinList()
{ {
if (windows.empty()) if (windows.empty())
{ {
m_SkinWindow = NULL; m_SkinWindow = nullptr;
item = GetControl(Id_ItemsListView); item = GetControl(Id_ItemsListView);
ListView_DeleteAllItems(item); ListView_DeleteAllItems(item);
} }
@ -754,7 +754,7 @@ void DialogAbout::TabSkins::UpdateMeasureList(MeterWindow* meterWindow)
{ {
// Find selected skin // Find selected skin
HWND item = GetControl(Id_SkinsListBox); HWND item = GetControl(Id_SkinsListBox);
int selected = (int)SendMessage(item, LB_GETCURSEL, NULL, NULL); int selected = (int)SendMessage(item, LB_GETCURSEL, 0, 0);
const std::map<std::wstring, MeterWindow*>& windows = g_Rainmeter->GetAllMeterWindows(); const std::map<std::wstring, MeterWindow*>& windows = g_Rainmeter->GetAllMeterWindows();
std::map<std::wstring, MeterWindow*>::const_iterator iter = windows.begin(); std::map<std::wstring, MeterWindow*>::const_iterator iter = windows.begin();
@ -894,7 +894,7 @@ INT_PTR DialogAbout::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
case Id_SkinsListBox: case Id_SkinsListBox:
if (HIWORD(wParam) == LBN_SELCHANGE) if (HIWORD(wParam) == LBN_SELCHANGE)
{ {
UpdateMeasureList(NULL); UpdateMeasureList(nullptr);
} }
break; break;
@ -1105,10 +1105,10 @@ void DialogAbout::TabPlugins::Initialize()
*/ */
void DialogAbout::TabPlugins::Resize(int w, int h) void DialogAbout::TabPlugins::Resize(int w, int h)
{ {
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
HWND item = GetControl(Id_ItemsListView); HWND item = GetControl(Id_ItemsListView);
SetWindowPos(item, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(item, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
// Adjust third colum // Adjust third colum
LVCOLUMN lvc; LVCOLUMN lvc;
@ -1201,7 +1201,7 @@ void DialogAbout::TabVersion::Initialize()
*/ */
void DialogAbout::TabVersion::Resize(int w, int h) void DialogAbout::TabVersion::Resize(int w, int h)
{ {
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
} }
INT_PTR DialogAbout::TabVersion::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) INT_PTR DialogAbout::TabVersion::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)

View File

@ -32,7 +32,7 @@
extern Rainmeter* g_Rainmeter; extern Rainmeter* g_Rainmeter;
WINDOWPLACEMENT DialogManage::c_WindowPlacement = {0}; WINDOWPLACEMENT DialogManage::c_WindowPlacement = {0};
DialogManage* DialogManage::c_Dialog = NULL; DialogManage* DialogManage::c_Dialog = nullptr;
/* /*
** Constructor. ** Constructor.
@ -173,7 +173,7 @@ INT_PTR DialogManage::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
delete c_Dialog; delete c_Dialog;
c_Dialog = NULL; c_Dialog = nullptr;
} }
return TRUE; return TRUE;
} }
@ -237,7 +237,7 @@ INT_PTR DialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
{ {
// Use arrows instead of plus/minus in the tree for Vista+ // Use arrows instead of plus/minus in the tree for Vista+
item = m_TabSkins.GetControl(TabSkins::Id_SkinsTreeView); item = m_TabSkins.GetControl(TabSkins::Id_SkinsTreeView);
SetWindowTheme(item, L"explorer", NULL); SetWindowTheme(item, L"explorer", nullptr);
} }
if (c_WindowPlacement.length == 0) if (c_WindowPlacement.length == 0)
@ -290,7 +290,7 @@ INT_PTR DialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
} }
url += L"Tab"; url += L"Tab";
ShellExecute(m_Window, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); ShellExecute(m_Window, L"open", url.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
} }
break; break;
@ -491,12 +491,12 @@ void DialogManage::TabSkins::Initialize()
// Apply icons and populate tree // Apply icons and populate tree
item = GetControl(Id_SkinsTreeView); item = GetControl(Id_SkinsTreeView);
TreeView_SetImageList(item, hImageList, TVSIL_NORMAL); TreeView_SetImageList(item, hImageList, TVSIL_NORMAL);
Update(NULL, false); Update(nullptr, false);
// Get rid of the EDITTEXT control border // Get rid of the EDITTEXT control border
item = GetControl(Id_DescriptionLabel); item = GetControl(Id_DescriptionLabel);
SetWindowLongPtr(item, GWL_EXSTYLE, GetWindowLongPtr(item, GWL_EXSTYLE) &~ WS_EX_CLIENTEDGE); SetWindowLongPtr(item, GWL_EXSTYLE, GetWindowLongPtr(item, GWL_EXSTYLE) &~ WS_EX_CLIENTEDGE);
SetWindowPos(item, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(item, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
item = GetControl(Id_TransparencyDropDownList); item = GetControl(Id_TransparencyDropDownList);
ComboBox_AddString(item, L"0%"); ComboBox_AddString(item, L"0%");
@ -547,7 +547,7 @@ void DialogManage::TabSkins::Update(MeterWindow* meterWindow, bool deleted)
if (deleted) if (deleted)
{ {
DisableControls(); DisableControls();
m_SkinWindow = NULL; m_SkinWindow = nullptr;
} }
else else
{ {
@ -778,10 +778,10 @@ void DialogManage::TabSkins::ReadSkin()
const WCHAR* fileSz = file.c_str(); const WCHAR* fileSz = file.c_str();
item = GetControl(Id_AuthorLabel); item = GetControl(Id_AuthorLabel);
if (GetPrivateProfileString(L"Metadata", L"Author", NULL, buffer, MAX_LINE_LENGTH, fileSz) == 0) if (GetPrivateProfileString(L"Metadata", L"Author", nullptr, buffer, MAX_LINE_LENGTH, fileSz) == 0)
{ {
// For backwards compatibility. // For backwards compatibility.
GetPrivateProfileString(L"Rainmeter", L"Author", NULL, buffer, MAX_LINE_LENGTH, fileSz); GetPrivateProfileString(L"Rainmeter", L"Author", nullptr, buffer, MAX_LINE_LENGTH, fileSz);
} }
SetWindowText(item, buffer); SetWindowText(item, buffer);
@ -792,26 +792,26 @@ void DialogManage::TabSkins::ReadSkin()
// Set metadata // Set metadata
item = GetControl(Id_VersionLabel); item = GetControl(Id_VersionLabel);
GetPrivateProfileString(L"Metadata", L"Version", NULL, buffer, MAX_LINE_LENGTH, fileSz); GetPrivateProfileString(L"Metadata", L"Version", nullptr, buffer, MAX_LINE_LENGTH, fileSz);
SetWindowText(item, buffer); SetWindowText(item, buffer);
item = GetControl(Id_LicenseLabel); item = GetControl(Id_LicenseLabel);
GetPrivateProfileString(L"Metadata", L"License", NULL, buffer, MAX_LINE_LENGTH, fileSz); GetPrivateProfileString(L"Metadata", L"License", nullptr, buffer, MAX_LINE_LENGTH, fileSz);
SetWindowText(item, buffer); SetWindowText(item, buffer);
item = GetControl(Id_DescriptionLabel); item = GetControl(Id_DescriptionLabel);
std::wstring text; std::wstring text;
if (GetPrivateProfileString(L"Metadata", L"Information", NULL, buffer, MAX_LINE_LENGTH, fileSz) > 0) if (GetPrivateProfileString(L"Metadata", L"Information", nullptr, buffer, MAX_LINE_LENGTH, fileSz) > 0)
{ {
text = buffer; text = buffer;
} }
else else
{ {
// For backwards compatibility // For backwards compatibility
GetPrivateProfileString(L"Metadata", L"Description", NULL, buffer, MAX_LINE_LENGTH, fileSz); GetPrivateProfileString(L"Metadata", L"Description", nullptr, buffer, MAX_LINE_LENGTH, fileSz);
text = buffer; text = buffer;
if (GetPrivateProfileString(L"Metadata", L"Instructions", NULL, buffer, MAX_LINE_LENGTH, fileSz) > 0) if (GetPrivateProfileString(L"Metadata", L"Instructions", nullptr, buffer, MAX_LINE_LENGTH, fileSz) > 0)
{ {
text += L"\r\n\r\n"; text += L"\r\n\r\n";
text += buffer; text += buffer;
@ -867,7 +867,7 @@ std::wstring DialogManage::TabSkins::GetTreeSelectionPath(HWND tree)
TreeView_GetItem(tree, &tvi); TreeView_GetItem(tree, &tvi);
std::wstring path = buffer; std::wstring path = buffer;
while ((tvi.hItem = TreeView_GetParent(tree, tvi.hItem)) != NULL) while ((tvi.hItem = TreeView_GetParent(tree, tvi.hItem)) != nullptr)
{ {
TreeView_GetItem(tree, &tvi); TreeView_GetItem(tree, &tvi);
path.insert(0, 1, L'\\'); path.insert(0, 1, L'\\');
@ -940,7 +940,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n
if (pos) if (pos)
{ {
const int folderLen = (int)(pos - name); const int folderLen = (int)(pos - name);
tvi.cchTextMax = folderLen + 1; // Length of folder name plus 1 for NULL tvi.cchTextMax = folderLen + 1; // Length of folder name plus 1 for nullptr
// Find and expand the folder // Find and expand the folder
do do
@ -948,7 +948,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n
TreeView_GetItem(tree, &tvi); TreeView_GetItem(tree, &tvi);
if (wcsncmp(buffer, name, folderLen) == 0) if (wcsncmp(buffer, name, folderLen) == 0)
{ {
if ((item = TreeView_GetChild(tree, tvi.hItem)) != NULL) if ((item = TreeView_GetChild(tree, tvi.hItem)) != nullptr)
{ {
TreeView_Expand(tree, tvi.hItem, TVE_EXPAND); TreeView_Expand(tree, tvi.hItem, TVE_EXPAND);
++pos; // Skip the slash ++pos; // Skip the slash
@ -958,7 +958,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n
break; break;
} }
} }
while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != NULL); while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != nullptr);
} }
else else
{ {
@ -974,7 +974,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n
break; break;
} }
} }
while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != NULL); while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != nullptr);
} }
} }
@ -1030,7 +1030,7 @@ INT_PTR DialogManage::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
--r.bottom, --r.bottom,
0, 0,
m_Window, m_Window,
NULL nullptr
); );
} }
@ -1198,7 +1198,7 @@ INT_PTR DialogManage::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
--r.bottom, --r.bottom,
0, 0,
m_Window, m_Window,
NULL nullptr
); );
DestroyMenu(menu); DestroyMenu(menu);
@ -1361,7 +1361,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
if (TreeView_GetItem(nm->hwndFrom, &tvi)) if (TreeView_GetItem(nm->hwndFrom, &tvi))
{ {
HMENU menu = NULL; HMENU menu = nullptr;
MENUITEMINFO mii = {0}; MENUITEMINFO mii = {0};
mii.cbSize = sizeof(MENUITEMINFO); mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STRING; mii.fMask = MIIM_STRING;
@ -1416,7 +1416,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
pt.y, pt.y,
0, 0,
m_Window, m_Window,
NULL nullptr
); );
DestroyMenu(menu); DestroyMenu(menu);
@ -1428,7 +1428,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
case TVN_SELCHANGED: case TVN_SELCHANGED:
if (nm->idFrom == Id_SkinsTreeView) if (nm->idFrom == Id_SkinsTreeView)
{ {
m_SkinWindow = NULL; m_SkinWindow = nullptr;
m_SkinFileName.clear(); m_SkinFileName.clear();
m_SkinFolderPath.clear(); m_SkinFolderPath.clear();
@ -1453,7 +1453,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
// Loop through parents to get skin folder // Loop through parents to get skin folder
m_SkinFolderPath.clear(); m_SkinFolderPath.clear();
while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != NULL) while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != nullptr)
{ {
TreeView_GetItem(nm->hwndFrom, &tvi); TreeView_GetItem(nm->hwndFrom, &tvi);
m_SkinFolderPath.insert(0, 1, L'\\'); m_SkinFolderPath.insert(0, 1, L'\\');
@ -1645,7 +1645,7 @@ INT_PTR DialogManage::TabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
else else
{ {
// Make sure path exists // Make sure path exists
CreateDirectory(path.c_str(), NULL); CreateDirectory(path.c_str(), nullptr);
} }
path += L"\\Rainmeter.ini"; path += L"\\Rainmeter.ini";
@ -1673,7 +1673,7 @@ INT_PTR DialogManage::TabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
{ {
if (parser.GetValue(*iter, L"Active", L"") == L"0") if (parser.GetValue(*iter, L"Active", L"") == L"0")
{ {
WritePrivateProfileString((*iter).c_str(), NULL, NULL, path.c_str()); WritePrivateProfileString((*iter).c_str(), nullptr, nullptr, path.c_str());
} }
} }
} }
@ -1694,7 +1694,7 @@ INT_PTR DialogManage::TabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
else else
{ {
// Create empty layout // Create empty layout
HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (file == INVALID_HANDLE_VALUE) if (file == INVALID_HANDLE_VALUE)
{ {
std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str()); std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str());
@ -1950,7 +1950,7 @@ INT_PTR DialogManage::TabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
resource += buffer; resource += buffer;
resource += L".dll"; resource += L".dll";
FreeLibrary(g_Rainmeter->m_ResourceInstance); FreeLibrary(g_Rainmeter->m_ResourceInstance);
g_Rainmeter->m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); g_Rainmeter->m_ResourceInstance = LoadLibraryEx(resource.c_str(), nullptr, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
g_Rainmeter->m_ResourceLCID = lcid; g_Rainmeter->m_ResourceLCID = lcid;
if (DialogAbout::GetDialog()) if (DialogAbout::GetDialog())

View File

@ -23,7 +23,7 @@
#include "Measure.h" #include "Measure.h"
#include "MeasurePlugin.h" #include "MeasurePlugin.h"
#define NULLCHECK(str) { if ((str) == NULL) { (str) = L""; } } #define NULLCHECK(str) { if ((str) == nullptr) { (str) = L""; } }
extern Rainmeter* g_Rainmeter; extern Rainmeter* g_Rainmeter;
@ -94,7 +94,7 @@ void* __stdcall RmGet(void* rm, int type)
} }
} }
return NULL; return nullptr;
} }
void __stdcall RmExecute(void* skin, LPCWSTR command) void __stdcall RmExecute(void* skin, LPCWSTR command)
@ -139,7 +139,7 @@ LPCWSTR ReadConfigString(LPCWSTR section, LPCWSTR option, LPCWSTR defValue)
// Deprecated! // Deprecated!
LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data) LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
{ {
if (command == NULL || *command == L'\0') if (command == nullptr || *command == L'\0')
{ {
return L"noop"; return L"noop";
} }

View File

@ -39,8 +39,8 @@ WCHAR* GetString(UINT id)
std::wstring GetFormattedString(UINT id, ...) std::wstring GetFormattedString(UINT id, ...)
{ {
LPWSTR pBuffer = NULL; LPWSTR pBuffer = nullptr;
va_list args = NULL; va_list args = nullptr;
va_start(args, id); va_start(args, id);
DWORD len = FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, DWORD len = FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER,
@ -62,7 +62,7 @@ HICON GetIcon(UINT id, bool large)
{ {
typedef HRESULT (WINAPI * FPLOADICONMETRIC)(HINSTANCE hinst, PCWSTR pszName, int lims, HICON* phico); typedef HRESULT (WINAPI * FPLOADICONMETRIC)(HINSTANCE hinst, PCWSTR pszName, int lims, HICON* phico);
HINSTANCE hExe = GetModuleHandle(NULL); HINSTANCE hExe = GetModuleHandle(nullptr);
HINSTANCE hComctl = GetModuleHandle(L"Comctl32"); HINSTANCE hComctl = GetModuleHandle(L"Comctl32");
if (hComctl) if (hComctl)
{ {

View File

@ -57,7 +57,7 @@ void Logger::StartLogFile()
if (_waccess(filePath, 0) == -1) if (_waccess(filePath, 0) == -1)
{ {
// Create empty log file. // Create empty log file.
HANDLE file = CreateFile(filePath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFile(filePath, GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
if (file != INVALID_HANDLE_VALUE) if (file != INVALID_HANDLE_VALUE)
{ {
CloseHandle(file); CloseHandle(file);
@ -65,7 +65,7 @@ void Logger::StartLogFile()
else else
{ {
const std::wstring text = GetFormattedString(ID_STR_LOGFILECREATEFAIL, filePath); const std::wstring text = GetFormattedString(ID_STR_LOGFILECREATEFAIL, filePath);
g_Rainmeter->ShowMessage(NULL, text.c_str(), MB_OK | MB_ICONERROR); g_Rainmeter->ShowMessage(nullptr, text.c_str(), MB_OK | MB_ICONERROR);
SetLogToFile(false); SetLogToFile(false);
return; return;
} }
@ -85,7 +85,7 @@ void Logger::DeleteLogFile()
if (_waccess(filePath, 0) != -1) if (_waccess(filePath, 0) != -1)
{ {
const std::wstring text = GetFormattedString(ID_STR_LOGFILEDELETE, filePath); const std::wstring text = GetFormattedString(ID_STR_LOGFILEDELETE, filePath);
const int res = g_Rainmeter->ShowMessage(NULL, text.c_str(), MB_YESNO | MB_ICONQUESTION); const int res = g_Rainmeter->ShowMessage(nullptr, text.c_str(), MB_YESNO | MB_ICONQUESTION);
if (res == IDYES) if (res == IDYES)
{ {
SetLogToFile(false); SetLogToFile(false);

View File

@ -124,8 +124,8 @@ static Function g_Functions[] =
{ L"rad", &rad, 3 }, { L"rad", &rad, 3 },
{ L"sgn", &sgn, 3 }, { L"sgn", &sgn, 3 },
{ L"neg", &neg, 3 }, { L"neg", &neg, 3 },
{ L"e", NULL, 1 }, { L"e", nullptr, 1 },
{ L"pi", NULL, 2 } { L"pi", nullptr, 2 }
}; };
static const int FUNC_MAX_LEN = 5; static const int FUNC_MAX_LEN = 5;
@ -234,7 +234,7 @@ const WCHAR* MathParser::Check(const WCHAR* formula)
++formula; ++formula;
} }
return (brackets != 0) ? eBrackets : NULL; return (brackets != 0) ? eBrackets : nullptr;
} }
const WCHAR* MathParser::CheckedParse(const WCHAR* formula, double* result) const WCHAR* MathParser::CheckedParse(const WCHAR* formula, double* result)
@ -242,7 +242,7 @@ const WCHAR* MathParser::CheckedParse(const WCHAR* formula, double* result)
const WCHAR* error = Check(formula); const WCHAR* error = Check(formula);
if (!error) if (!error)
{ {
error = Parse(formula, NULL, result); error = Parse(formula, nullptr, result);
} }
return error; return error;
} }
@ -254,7 +254,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double*
if (!*formula) if (!*formula)
{ {
*result = 0.0; *result = 0.0;
return NULL; return nullptr;
} }
Parser parser; Parser parser;
@ -277,7 +277,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double*
return eSyntax; return eSyntax;
case Token::Final: case Token::Final:
if ((error = CalcToObr(parser)) != NULL) if ((error = CalcToObr(parser)) != nullptr)
{ {
return error; return error;
} }
@ -289,7 +289,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double*
{ {
// Done! // Done!
*result = parser.numStack[0]; *result = parser.numStack[0];
return NULL; return nullptr;
} }
break; break;
@ -309,13 +309,13 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double*
case Operator::ClosingBracket: case Operator::ClosingBracket:
{ {
if ((error = CalcToObr(parser)) != NULL) return error; if ((error = CalcToObr(parser)) != nullptr) return error;
} }
break; break;
case Operator::Comma: case Operator::Comma:
{ {
if ((error = CalcToObr(parser)) != NULL) return error; if ((error = CalcToObr(parser)) != nullptr) return error;
if (parser.opStack[parser.opTop].type == Operator::MultiArgFunction) if (parser.opStack[parser.opTop].type == Operator::MultiArgFunction)
{ {
@ -361,7 +361,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double*
while (g_OpPriorities[(int)op.type] <= g_OpPriorities[(int)parser.opStack[parser.opTop].type]) while (g_OpPriorities[(int)op.type] <= g_OpPriorities[(int)parser.opStack[parser.opTop].type])
{ {
if ((error = Calc(parser)) != NULL) return error; if ((error = Calc(parser)) != nullptr) return error;
} }
parser.opStack[++parser.opTop] = op; parser.opStack[++parser.opTop] = op;
} }
@ -427,7 +427,7 @@ static const WCHAR* Calc(Parser& parser)
// Multi-argument function // Multi-argument function
if (op.type == Operator::Conditional) if (op.type == Operator::Conditional)
{ {
return NULL; return nullptr;
} }
else if (op.type == Operator::MultiArgFunction) else if (op.type == Operator::MultiArgFunction)
{ {
@ -438,7 +438,7 @@ static const WCHAR* Calc(Parser& parser)
if (error) return error; if (error) return error;
parser.numStack[++parser.valTop] = res; parser.numStack[++parser.valTop] = res;
return NULL; return nullptr;
} }
else if (parser.valTop < 0) else if (parser.valTop < 0)
{ {
@ -583,7 +583,7 @@ static const WCHAR* Calc(Parser& parser)
} }
parser.numStack[++parser.valTop] = res; parser.numStack[++parser.valTop] = res;
return NULL; return nullptr;
} }
static const WCHAR* CalcToObr(Parser& parser) static const WCHAR* CalcToObr(Parser& parser)
@ -594,7 +594,7 @@ static const WCHAR* CalcToObr(Parser& parser)
if (error) return error; if (error) return error;
} }
--parser.opTop; --parser.opTop;
return NULL; return nullptr;
} }
Token GetNextToken(Lexer& lexer) Token GetNextToken(Lexer& lexer)
@ -902,5 +902,5 @@ static const WCHAR* round(int paramcnt, double* args, double* result)
for (int i = 0; i < sharpness; i++) x /= coef; for (int i = 0; i < sharpness; i++) x /= coef;
*result = x; *result = x;
return NULL; return nullptr;
} }

View File

@ -255,9 +255,9 @@ const WCHAR* Measure::CheckSubstitute(const WCHAR* buffer)
flags, // default options flags, // default options
&error, // for error message &error, // for error message
&erroffset, // for error offset &erroffset, // for error offset
NULL); // use default character tables nullptr); // use default character tables
if (re == NULL) if (re == nullptr)
{ {
MakePlainSubstitute(str, i); MakePlainSubstitute(str, i);
LogNoticeF(L"Substitute: %S", error); LogNoticeF(L"Substitute: %S", error);
@ -268,7 +268,7 @@ const WCHAR* Measure::CheckSubstitute(const WCHAR* buffer)
{ {
rc = pcre_exec( rc = pcre_exec(
re, // the compiled pattern re, // the compiled pattern
NULL, // no extra data - we didn't study the pattern nullptr, // no extra data - we didn't study the pattern
utf8str.c_str(), // the subject string utf8str.c_str(), // the subject string
utf8str.length(), // the length of the subject utf8str.length(), // the length of the subject
offset, // start at offset 0 in the subject offset, // start at offset 0 in the subject
@ -624,7 +624,7 @@ double Measure::GetValueRange()
*/ */
const WCHAR* Measure::GetStringValue() const WCHAR* Measure::GetStringValue()
{ {
return NULL; return nullptr;
} }
/* /*
@ -849,7 +849,7 @@ Measure* Measure::Create(const WCHAR* measure, MeterWindow* meterWindow, const W
LogErrorF(L"Measure=%s is not valid in [%s]", measure, name); LogErrorF(L"Measure=%s is not valid in [%s]", measure, name);
return NULL; return nullptr;
} }
/* /*

View File

@ -38,7 +38,7 @@ typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
#define Li2Double(x) ((double)((x).QuadPart)) #define Li2Double(x) ((double)((x).QuadPart))
#define Ft2Double(x) ((double)((x).dwHighDateTime) * 4.294967296E9 + (double)((x).dwLowDateTime)) #define Ft2Double(x) ((double)((x).dwHighDateTime) * 4.294967296E9 + (double)((x).dwLowDateTime))
FPNTQSI MeasureCPU::c_NtQuerySystemInformation = NULL; FPNTQSI MeasureCPU::c_NtQuerySystemInformation = nullptr;
int MeasureCPU::c_NumOfProcessors = 0; int MeasureCPU::c_NumOfProcessors = 0;
ULONG MeasureCPU::c_BufferSize = 0; ULONG MeasureCPU::c_BufferSize = 0;
@ -124,7 +124,7 @@ void MeasureCPU::UpdateValue()
{ {
LONG status; LONG status;
ULONG bufSize = c_BufferSize; ULONG bufSize = c_BufferSize;
BYTE* buf = (bufSize > 0) ? new BYTE[bufSize] : NULL; BYTE* buf = (bufSize > 0) ? new BYTE[bufSize] : nullptr;
int loop = 0; int loop = 0;

View File

@ -57,7 +57,7 @@ MeasureCalc::~MeasureCalc()
void MeasureCalc::UpdateValue() void MeasureCalc::UpdateValue()
{ {
const WCHAR* errMsg = MathParser::Parse(m_Formula.c_str(), this, &m_Value); const WCHAR* errMsg = MathParser::Parse(m_Formula.c_str(), this, &m_Value);
if (errMsg != NULL) if (errMsg != nullptr)
{ {
if (!m_ParseError) if (!m_ParseError)
{ {
@ -103,7 +103,7 @@ void MeasureCalc::ReadOptions(ConfigParser& parser, const WCHAR* section)
} }
const WCHAR* errMsg = MathParser::Check(m_Formula.c_str()); const WCHAR* errMsg = MathParser::Check(m_Formula.c_str());
if (errMsg != NULL) if (errMsg != nullptr)
{ {
LogErrorF(L"Calc: %s in [%s]", errMsg, m_Name.c_str()); LogErrorF(L"Calc: %s in [%s]", errMsg, m_Name.c_str());
m_Formula.clear(); m_Formula.clear();

View File

@ -113,11 +113,11 @@ void MeasureDiskSpace::UpdateValue()
{ {
if (!m_DiskQuota) if (!m_DiskQuota)
{ {
sizeResult = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes); sizeResult = GetDiskFreeSpaceEx(drive, nullptr, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
} }
else else
{ {
sizeResult = GetDiskFreeSpaceEx(drive, (PULARGE_INTEGER)&i64FreeBytes, (PULARGE_INTEGER)&i64TotalBytes, NULL); sizeResult = GetDiskFreeSpaceEx(drive, (PULARGE_INTEGER)&i64FreeBytes, (PULARGE_INTEGER)&i64TotalBytes, nullptr);
} }
} }
@ -147,7 +147,7 @@ void MeasureDiskSpace::UpdateValue()
if (type != DRIVE_NO_ROOT_DIR && if (type != DRIVE_NO_ROOT_DIR &&
(!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore removable drives (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore removable drives
{ {
labelResult = GetVolumeInformation(drive, volumeName, MAX_PATH + 1, NULL, NULL, NULL, NULL, 0); labelResult = GetVolumeInformation(drive, volumeName, MAX_PATH + 1, nullptr, nullptr, nullptr, nullptr, 0);
} }
m_StringValue = (labelResult) ? volumeName : L""; m_StringValue = (labelResult) ? volumeName : L"";
@ -166,7 +166,7 @@ void MeasureDiskSpace::UpdateValue()
*/ */
const WCHAR* MeasureDiskSpace::GetStringValue() const WCHAR* MeasureDiskSpace::GetStringValue()
{ {
return (m_Type || m_Label) ? CheckSubstitute(m_StringValue.c_str()) : NULL; return (m_Type || m_Label) ? CheckSubstitute(m_StringValue.c_str()) : nullptr;
} }
/* /*
@ -213,7 +213,7 @@ void MeasureDiskSpace::ReadOptions(ConfigParser& parser, const WCHAR* section)
type != DRIVE_CDROM && type != DRIVE_CDROM &&
(!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore CD-ROMS and removable drives (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore CD-ROMS and removable drives
{ {
result = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, NULL); result = GetDiskFreeSpaceEx(drive, nullptr, (PULARGE_INTEGER)&i64TotalBytes, nullptr);
} }
} }

View File

@ -21,13 +21,13 @@
#include "Rainmeter.h" #include "Rainmeter.h"
#include "System.h" #include "System.h"
BYTE* MeasureNet::c_Table = NULL; BYTE* MeasureNet::c_Table = nullptr;
UINT MeasureNet::c_NumOfTables = 0; UINT MeasureNet::c_NumOfTables = 0;
std::vector<ULONG64> MeasureNet::c_StatValues; std::vector<ULONG64> MeasureNet::c_StatValues;
std::vector<ULONG64> MeasureNet::c_OldStatValues; std::vector<ULONG64> MeasureNet::c_OldStatValues;
FPGETIFTABLE2 MeasureNet::c_GetIfTable2 = NULL; FPGETIFTABLE2 MeasureNet::c_GetIfTable2 = nullptr;
FPFREEMIBTABLE MeasureNet::c_FreeMibTable = NULL; FPFREEMIBTABLE MeasureNet::c_FreeMibTable = nullptr;
extern Rainmeter* g_Rainmeter; extern Rainmeter* g_Rainmeter;
@ -65,7 +65,7 @@ void MeasureNet::UpdateIFTable()
if (c_Table) if (c_Table)
{ {
c_FreeMibTable(c_Table); c_FreeMibTable(c_Table);
c_Table = NULL; c_Table = nullptr;
} }
if (c_GetIfTable2((MIB_IF_TABLE2**)&c_Table) == NO_ERROR) if (c_GetIfTable2((MIB_IF_TABLE2**)&c_Table) == NO_ERROR)
@ -121,13 +121,13 @@ void MeasureNet::UpdateIFTable()
else else
{ {
// Something's wrong. Unable to get the table. // Something's wrong. Unable to get the table.
c_Table = NULL; c_Table = nullptr;
c_NumOfTables = 0; c_NumOfTables = 0;
} }
} }
else else
{ {
if (c_Table == NULL) if (c_Table == nullptr)
{ {
// Gotta reserve few bytes for the tables // Gotta reserve few bytes for the tables
DWORD value = 0; DWORD value = 0;
@ -214,7 +214,7 @@ void MeasureNet::UpdateIFTable()
{ {
// Something's wrong. Unable to get the table. // Something's wrong. Unable to get the table.
delete [] c_Table; delete [] c_Table;
c_Table = NULL; c_Table = nullptr;
c_NumOfTables = 0; c_NumOfTables = 0;
} }
} }
@ -416,7 +416,7 @@ ULONG64 MeasureNet::GetNetStatsValue(NET net)
*/ */
void MeasureNet::UpdateValue() void MeasureNet::UpdateValue()
{ {
if (c_Table == NULL) return; if (c_Table == nullptr) return;
if (m_Cumulative) if (m_Cumulative)
{ {
@ -460,7 +460,7 @@ void MeasureNet::ReadOptions(ConfigParser& parser, const WCHAR* section)
Measure::ReadOptions(parser, section); Measure::ReadOptions(parser, section);
double value; double value;
const WCHAR* netName = NULL; const WCHAR* netName = nullptr;
if (m_Net == NET_IN) if (m_Net == NET_IN)
{ {
@ -588,7 +588,7 @@ void MeasureNet::ReadStats(const std::wstring& iniFile, std::wstring& statsDate)
WCHAR buffer[48]; WCHAR buffer[48];
ConfigParser parser; ConfigParser parser;
parser.Initialize(iniFile, NULL, L"Statistics"); parser.Initialize(iniFile, nullptr, L"Statistics");
const std::wstring& date = parser.ReadString(L"Statistics", L"Since", L"", false); const std::wstring& date = parser.ReadString(L"Statistics", L"Since", L"", false);
if (!date.empty()) if (!date.empty())
@ -702,8 +702,8 @@ void MeasureNet::InitializeStatic()
if (!c_GetIfTable2 || !c_FreeMibTable) if (!c_GetIfTable2 || !c_FreeMibTable)
{ {
c_GetIfTable2 = NULL; c_GetIfTable2 = nullptr;
c_FreeMibTable = NULL; c_FreeMibTable = nullptr;
} }
} }
@ -726,13 +726,13 @@ void MeasureNet::FinalizeStatic()
c_FreeMibTable(c_Table); c_FreeMibTable(c_Table);
} }
c_GetIfTable2 = NULL; c_GetIfTable2 = nullptr;
c_FreeMibTable = NULL; c_FreeMibTable = nullptr;
} }
else else
{ {
delete [] c_Table; delete [] c_Table;
} }
c_Table = NULL; c_Table = nullptr;
c_NumOfTables = 0; c_NumOfTables = 0;
} }

View File

@ -230,7 +230,7 @@ const WCHAR* MeasurePlugin::GetStringValue()
if (ret) return CheckSubstitute(ret); if (ret) return CheckSubstitute(ret);
} }
return NULL; return nullptr;
} }
/* /*

View File

@ -52,7 +52,7 @@ protected:
virtual void UpdateValue(); virtual void UpdateValue();
private: private:
bool IsNewApi() { return m_ReloadFunc != NULL; } bool IsNewApi() { return m_ReloadFunc != nullptr; }
HMODULE m_Plugin; HMODULE m_Plugin;

View File

@ -47,7 +47,7 @@ MeasureRegistry::~MeasureRegistry()
*/ */
void MeasureRegistry::UpdateValue() void MeasureRegistry::UpdateValue()
{ {
if (m_RegKey != NULL) if (m_RegKey != nullptr)
{ {
DWORD size = 4096; DWORD size = 4096;
WCHAR* data = new WCHAR[size]; WCHAR* data = new WCHAR[size];
@ -56,7 +56,7 @@ void MeasureRegistry::UpdateValue()
if (RegQueryValueEx( if (RegQueryValueEx(
m_RegKey, m_RegKey,
m_RegValueName.c_str(), m_RegValueName.c_str(),
NULL, nullptr,
(LPDWORD)&type, (LPDWORD)&type,
(LPBYTE)data, (LPBYTE)data,
(LPDWORD)&size) == ERROR_SUCCESS) (LPDWORD)&size) == ERROR_SUCCESS)
@ -71,7 +71,7 @@ void MeasureRegistry::UpdateValue()
case REG_SZ: case REG_SZ:
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
case REG_MULTI_SZ: case REG_MULTI_SZ:
m_Value = wcstod(data, NULL); m_Value = wcstod(data, nullptr);
m_StringValue = data; m_StringValue = data;
break; break;
@ -159,6 +159,6 @@ void MeasureRegistry::ReadOptions(ConfigParser& parser, const WCHAR* section)
*/ */
const WCHAR* MeasureRegistry::GetStringValue() const WCHAR* MeasureRegistry::GetStringValue()
{ {
return !m_StringValue.empty() ? CheckSubstitute(m_StringValue.c_str()) : NULL; return !m_StringValue.empty() ? CheckSubstitute(m_StringValue.c_str()) : nullptr;
} }

View File

@ -78,7 +78,7 @@ void MeasureScript::UpdateValue()
*/ */
const WCHAR* MeasureScript::GetStringValue() const WCHAR* MeasureScript::GetStringValue()
{ {
return (m_ValueType == LUA_TSTRING) ? CheckSubstitute(m_StringValue.c_str()) : NULL; return (m_ValueType == LUA_TSTRING) ? CheckSubstitute(m_StringValue.c_str()) : nullptr;
} }
/* /*

View File

@ -126,11 +126,11 @@ void MeasureTime::UpdateValue()
const WCHAR* format = m_Format.c_str(); const WCHAR* format = m_Format.c_str();
if (_wcsicmp(L"locale-time", format) == 0) if (_wcsicmp(L"locale-time", format) == 0)
{ {
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH);
} }
else if (_wcsicmp(L"locale-date", format) == 0) else if (_wcsicmp(L"locale-date", format) == 0)
{ {
GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH);
} }
else else
{ {
@ -148,7 +148,7 @@ void MeasureTime::UpdateValue()
TimeToString(tmpSz, MAX_LINE_LENGTH, format, &today); TimeToString(tmpSz, MAX_LINE_LENGTH, format, &today);
} }
m_Value = wcstod(tmpSz, NULL); m_Value = wcstod(tmpSz, nullptr);
delete [] tmpSz; delete [] tmpSz;
} }
@ -193,11 +193,11 @@ const WCHAR* MeasureTime::GetStringValue()
const WCHAR* format = m_Format.c_str(); const WCHAR* format = m_Format.c_str();
if (_wcsicmp(L"locale-time", format) == 0) if (_wcsicmp(L"locale-time", format) == 0)
{ {
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH);
} }
else if (_wcsicmp(L"locale-date", format) == 0) else if (_wcsicmp(L"locale-date", format) == 0)
{ {
GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH);
} }
else else
{ {

View File

@ -74,7 +74,7 @@ Meter::~Meter()
{ {
delete m_Transformation; delete m_Transformation;
if (m_ToolTipHandle != NULL) if (m_ToolTipHandle != nullptr)
{ {
DestroyWindow(m_ToolTipHandle); DestroyWindow(m_ToolTipHandle);
} }
@ -190,11 +190,11 @@ void Meter::Show()
// Change the option as well to avoid reset in ReadOptions(). // Change the option as well to avoid reset in ReadOptions().
m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"0"); m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"0");
if (m_ToolTipHandle != NULL) if (m_ToolTipHandle != nullptr)
{ {
if (!m_ToolTipHidden) if (!m_ToolTipHidden)
{ {
SendMessage(m_ToolTipHandle, TTM_ACTIVATE, TRUE, NULL); SendMessage(m_ToolTipHandle, TTM_ACTIVATE, TRUE, 0);
} }
} }
} }
@ -210,9 +210,9 @@ void Meter::Hide()
// Change the option as well to avoid reset in ReadOptions(). // Change the option as well to avoid reset in ReadOptions().
m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"1"); m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"1");
if (m_ToolTipHandle != NULL) if (m_ToolTipHandle != nullptr)
{ {
SendMessage(m_ToolTipHandle, TTM_ACTIVATE, FALSE, NULL); SendMessage(m_ToolTipHandle, TTM_ACTIVATE, FALSE, 0);
} }
} }
@ -349,7 +349,7 @@ void Meter::ReadOptions(ConfigParser& parser, const WCHAR* section)
else if (!matrix.empty()) else if (!matrix.empty())
{ {
delete m_Transformation; delete m_Transformation;
m_Transformation = NULL; m_Transformation = nullptr;
LogErrorF(L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str()); LogErrorF(L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
} }
@ -411,7 +411,7 @@ Meter* Meter::Create(const WCHAR* meter, MeterWindow* meterWindow, const WCHAR*
LogErrorF(L"Meter=%s is not valid in [%s]", meter, name); LogErrorF(L"Meter=%s is not valid in [%s]", meter, name);
return NULL; return nullptr;
} }
/* /*
@ -538,16 +538,16 @@ void Meter::CreateToolTip(MeterWindow* meterWindow)
HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS, TOOLTIPS_CLASS,
NULL, nullptr,
style, style,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hMeterWindow, hMeterWindow,
NULL, nullptr,
hInstance, hInstance,
NULL); nullptr);
if (hwndTT) if (hwndTT)
{ {
@ -555,7 +555,7 @@ void Meter::CreateToolTip(MeterWindow* meterWindow)
TOOLINFO ti = {sizeof(TOOLINFO), TTF_SUBCLASS, hMeterWindow, 0, GetMeterRect(), hInstance}; TOOLINFO ti = {sizeof(TOOLINFO), TTF_SUBCLASS, hMeterWindow, 0, GetMeterRect(), hInstance};
SendMessage(hwndTT, TTM_ADDTOOL, NULL, (LPARAM) (LPTOOLINFO) &ti); SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)&ti);
m_ToolTipHandle = hwndTT; m_ToolTipHandle = hwndTT;
UpdateToolTip(); UpdateToolTip();
@ -572,19 +572,19 @@ void Meter::UpdateToolTip()
TOOLINFO ti = {sizeof(TOOLINFO)}; TOOLINFO ti = {sizeof(TOOLINFO)};
ti.hwnd = m_MeterWindow->GetWindow(); ti.hwnd = m_MeterWindow->GetWindow();
SendMessage(hwndTT, TTM_GETTOOLINFO, NULL, (LPARAM)&ti); SendMessage(hwndTT, TTM_GETTOOLINFO, 0, (LPARAM)&ti);
std::wstring text = m_ToolTipText; std::wstring text = m_ToolTipText;
ReplaceMeasures(text); ReplaceMeasures(text);
ti.lpszText = (LPTSTR)text.c_str(); ti.lpszText = (LPTSTR)text.c_str();
ti.rect = GetMeterRect(); ti.rect = GetMeterRect();
SendMessage(hwndTT, TTM_SETTOOLINFO, NULL, (LPARAM)&ti); SendMessage(hwndTT, TTM_SETTOOLINFO, 0, (LPARAM)&ti);
SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, NULL, m_ToolTipWidth); SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, m_ToolTipWidth);
if (!m_ToolTipTitle.empty()) if (!m_ToolTipTitle.empty())
{ {
HICON hIcon = NULL; HICON hIcon = nullptr;
bool destroy = false; bool destroy = false;
if (!m_ToolTipIcon.empty()) if (!m_ToolTipIcon.empty())
@ -604,15 +604,15 @@ void Meter::UpdateToolTip()
} }
else if (_wcsicmp(tipIcon, L"QUESTION") == 0) else if (_wcsicmp(tipIcon, L"QUESTION") == 0)
{ {
hIcon = LoadIcon(NULL, IDI_QUESTION); hIcon = LoadIcon(nullptr, IDI_QUESTION);
} }
else if (_wcsicmp(tipIcon, L"SHIELD") == 0) else if (_wcsicmp(tipIcon, L"SHIELD") == 0)
{ {
hIcon = LoadIcon(NULL, IDI_SHIELD); hIcon = LoadIcon(nullptr, IDI_SHIELD);
} }
else else
{ {
hIcon = (HICON)LoadImage(NULL, tipIcon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); hIcon = (HICON)LoadImage(nullptr, tipIcon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
destroy = true; destroy = true;
} }
} }
@ -629,11 +629,11 @@ void Meter::UpdateToolTip()
if (m_ToolTipHidden) if (m_ToolTipHidden)
{ {
SendMessage(hwndTT, TTM_ACTIVATE, FALSE, NULL); SendMessage(hwndTT, TTM_ACTIVATE, FALSE, 0);
} }
else else
{ {
SendMessage(hwndTT, TTM_ACTIVATE, !IsHidden(), NULL); SendMessage(hwndTT, TTM_ACTIVATE, !IsHidden(), 0);
} }
} }

View File

@ -60,7 +60,7 @@ public:
bool HasMouseAction() { return m_HasMouseAction; } bool HasMouseAction() { return m_HasMouseAction; }
const std::wstring& GetToolTipText() { return m_ToolTipText; } const std::wstring& GetToolTipText() { return m_ToolTipText; }
bool HasToolTip() { return m_ToolTipHandle != NULL; } bool HasToolTip() { return m_ToolTipHandle != nullptr; }
void CreateToolTip(MeterWindow* meterWindow); void CreateToolTip(MeterWindow* meterWindow);
void UpdateToolTip(); void UpdateToolTip();

View File

@ -33,7 +33,7 @@ extern Rainmeter* g_Rainmeter;
** **
*/ */
MeterBitmap::MeterBitmap(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name), MeterBitmap::MeterBitmap(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
m_Image(L"BitmapImage", NULL, true), m_Image(L"BitmapImage", nullptr, true),
m_NeedsReload(false), m_NeedsReload(false),
m_ZeroFrame(false), m_ZeroFrame(false),
m_FrameCount(1), m_FrameCount(1),

View File

@ -39,7 +39,7 @@ enum BUTTON_STATE
** **
*/ */
MeterButton::MeterButton(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name), MeterButton::MeterButton(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
m_Image(L"ButtonImage", NULL, true), m_Image(L"ButtonImage", nullptr, true),
m_NeedsReload(false), m_NeedsReload(false),
m_Bitmaps(), m_Bitmaps(),
m_State(BUTTON_STATE_NORMAL), m_State(BUTTON_STATE_NORMAL),
@ -71,7 +71,7 @@ void MeterButton::Initialize()
for (int i = 0; i < BUTTON_FRAMES; ++i) for (int i = 0; i < BUTTON_FRAMES; ++i)
{ {
delete m_Bitmaps[i]; delete m_Bitmaps[i];
m_Bitmaps[i] = NULL; m_Bitmaps[i] = nullptr;
} }
// Load the bitmaps if defined // Load the bitmaps if defined
@ -186,7 +186,7 @@ bool MeterButton::Draw(Gfx::Canvas& canvas)
{ {
if (!Meter::Draw(canvas)) return false; if (!Meter::Draw(canvas)) return false;
if (m_Bitmaps[m_State] == NULL) return false; // Unable to continue if (m_Bitmaps[m_State] == nullptr) return false; // Unable to continue
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext(); Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();

View File

@ -80,10 +80,10 @@ void MeterHistogram::DisposeBuffer()
// Delete buffers // Delete buffers
delete [] m_PrimaryValues; delete [] m_PrimaryValues;
m_PrimaryValues = NULL; m_PrimaryValues = nullptr;
delete [] m_SecondaryValues; delete [] m_SecondaryValues;
m_SecondaryValues = NULL; m_SecondaryValues = nullptr;
} }
/* /*
@ -115,7 +115,7 @@ void MeterHistogram::Initialize()
{ {
Meter::Initialize(); Meter::Initialize();
Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL; Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : nullptr;
// A sanity check // A sanity check
if (secondaryMeasure && !m_PrimaryImageName.empty() && (m_OverlapImageName.empty() || m_SecondaryImageName.empty())) if (secondaryMeasure && !m_PrimaryImageName.empty() && (m_OverlapImageName.empty() || m_SecondaryImageName.empty()))
@ -329,10 +329,10 @@ bool MeterHistogram::Update()
{ {
int maxSize = m_GraphHorizontalOrientation ? m_H : m_W; int maxSize = m_GraphHorizontalOrientation ? m_H : m_W;
if (maxSize > 0) // m_PrimaryValues is not NULL if (maxSize > 0) // m_PrimaryValues is not nullptr
{ {
Measure* measure = m_Measures[0]; Measure* measure = m_Measures[0];
Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL; Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : nullptr;
// Gather values // Gather values
m_PrimaryValues[m_MeterPos] = measure->GetValue(); m_PrimaryValues[m_MeterPos] = measure->GetValue();
@ -419,7 +419,7 @@ bool MeterHistogram::Draw(Gfx::Canvas& canvas)
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext(); Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL; Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : nullptr;
GraphicsPath primaryPath; GraphicsPath primaryPath;
GraphicsPath secondaryPath; GraphicsPath secondaryPath;

View File

@ -91,7 +91,7 @@ MeterString::MeterString(MeterWindow* meterWindow, const WCHAR* name) : Meter(me
MeterString::~MeterString() MeterString::~MeterString()
{ {
delete m_TextFormat; delete m_TextFormat;
m_TextFormat = NULL; m_TextFormat = nullptr;
} }
/* /*
@ -243,7 +243,7 @@ void MeterString::ReadOptions(ConfigParser& parser, const WCHAR* section)
m_Scale = parser.ParseDouble(scale.c_str(), 1); m_Scale = parser.ParseDouble(scale.c_str(), 1);
const WCHAR* hAlign = parser.ReadString(section, L"StringAlign", L"LEFT").c_str(); const WCHAR* hAlign = parser.ReadString(section, L"StringAlign", L"LEFT").c_str();
const WCHAR* vAlign = NULL; const WCHAR* vAlign = nullptr;
if (_wcsnicmp(hAlign, L"LEFT", 4) == 0) if (_wcsnicmp(hAlign, L"LEFT", 4) == 0)
{ {
m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Left); m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Left);
@ -418,7 +418,7 @@ bool MeterString::Draw(Gfx::Canvas& canvas)
{ {
if (!Meter::Draw(canvas)) return false; if (!Meter::Draw(canvas)) return false;
return DrawString(canvas, NULL); return DrawString(canvas, nullptr);
} }
/* /*

View File

@ -63,11 +63,11 @@ enum INTERVAL
int MeterWindow::c_InstanceCount = 0; int MeterWindow::c_InstanceCount = 0;
HINSTANCE MeterWindow::c_DwmInstance = NULL; HINSTANCE MeterWindow::c_DwmInstance = nullptr;
FPDWMENABLEBLURBEHINDWINDOW MeterWindow::c_DwmEnableBlurBehindWindow = NULL; FPDWMENABLEBLURBEHINDWINDOW MeterWindow::c_DwmEnableBlurBehindWindow = nullptr;
FPDWMGETCOLORIZATIONCOLOR MeterWindow::c_DwmGetColorizationColor = NULL; FPDWMGETCOLORIZATIONCOLOR MeterWindow::c_DwmGetColorizationColor = nullptr;
FPDWMSETWINDOWATTRIBUTE MeterWindow::c_DwmSetWindowAttribute = NULL; FPDWMSETWINDOWATTRIBUTE MeterWindow::c_DwmSetWindowAttribute = nullptr;
FPDWMISCOMPOSITIONENABLED MeterWindow::c_DwmIsCompositionEnabled = NULL; FPDWMISCOMPOSITIONENABLED MeterWindow::c_DwmIsCompositionEnabled = nullptr;
extern Rainmeter* g_Rainmeter; extern Rainmeter* g_Rainmeter;
@ -164,7 +164,7 @@ MeterWindow::MeterWindow(const std::wstring& folderPath, const std::wstring& fil
wc.style = CS_NOCLOSE | CS_DBLCLKS; wc.style = CS_NOCLOSE | CS_DBLCLKS;
wc.lpfnWndProc = InitialWndProc; wc.lpfnWndProc = InitialWndProc;
wc.hInstance = g_Rainmeter->GetInstance(); wc.hInstance = g_Rainmeter->GetInstance();
wc.hCursor = NULL; // The cursor should be controlled by using SetCursor() when needed. wc.hCursor = nullptr; // The cursor should be controlled by using SetCursor() when needed.
wc.lpszClassName = METERWINDOW_CLASS_NAME; wc.lpszClassName = METERWINDOW_CLASS_NAME;
RegisterClassEx(&wc); RegisterClassEx(&wc);
} }
@ -194,17 +194,17 @@ MeterWindow::~MeterWindow()
if (c_DwmInstance) if (c_DwmInstance)
{ {
FreeLibrary(c_DwmInstance); FreeLibrary(c_DwmInstance);
c_DwmInstance = NULL; c_DwmInstance = nullptr;
c_DwmEnableBlurBehindWindow = NULL; c_DwmEnableBlurBehindWindow = nullptr;
c_DwmGetColorizationColor = NULL; c_DwmGetColorizationColor = nullptr;
c_DwmSetWindowAttribute = NULL; c_DwmSetWindowAttribute = nullptr;
c_DwmIsCompositionEnabled = NULL; c_DwmIsCompositionEnabled = nullptr;
} }
} }
delete m_Canvas; delete m_Canvas;
m_Canvas = NULL; m_Canvas = nullptr;
} }
/* /*
@ -244,7 +244,7 @@ void MeterWindow::Dispose(bool refresh)
m_Measures.clear(); m_Measures.clear();
delete m_Background; delete m_Background;
m_Background = NULL; m_Background = nullptr;
m_BackgroundSize.cx = m_BackgroundSize.cy = 0; m_BackgroundSize.cx = m_BackgroundSize.cy = 0;
m_BackgroundName.clear(); m_BackgroundName.clear();
@ -252,13 +252,13 @@ void MeterWindow::Dispose(bool refresh)
if (m_BlurRegion) if (m_BlurRegion)
{ {
DeleteObject(m_BlurRegion); DeleteObject(m_BlurRegion);
m_BlurRegion = NULL; m_BlurRegion = nullptr;
} }
if (m_FontCollection) if (m_FontCollection)
{ {
delete m_FontCollection; delete m_FontCollection;
m_FontCollection = NULL; m_FontCollection = nullptr;
} }
if (!refresh) if (!refresh)
@ -266,7 +266,7 @@ void MeterWindow::Dispose(bool refresh)
if (m_Window) if (m_Window)
{ {
DestroyWindow(m_Window); DestroyWindow(m_Window);
m_Window = NULL; m_Window = nullptr;
} }
} }
} }
@ -280,14 +280,14 @@ void MeterWindow::Initialize()
m_Window = CreateWindowEx( m_Window = CreateWindowEx(
WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW,
METERWINDOW_CLASS_NAME, METERWINDOW_CLASS_NAME,
NULL, nullptr,
WS_POPUP, WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, nullptr,
NULL, nullptr,
g_Rainmeter->GetInstance(), g_Rainmeter->GetInstance(),
this); this);
@ -390,7 +390,7 @@ void MeterWindow::Deactivate()
g_Rainmeter->AddUnmanagedMeterWindow(this); g_Rainmeter->AddUnmanagedMeterWindow(this);
HideFade(); HideFade();
SetTimer(m_Window, TIMER_DEACTIVATE, m_FadeDuration + 50, NULL); SetTimer(m_Window, TIMER_DEACTIVATE, m_FadeDuration + 50, nullptr);
} }
/* /*
@ -448,7 +448,7 @@ void MeterWindow::Refresh(bool init, bool all)
MapCoordsToScreen(m_ScreenX, m_ScreenY, m_WindowW, m_WindowH); MapCoordsToScreen(m_ScreenX, m_ScreenY, m_WindowW, m_WindowH);
} }
SetWindowPos(m_Window, NULL, m_ScreenX, m_ScreenY, m_WindowW, m_WindowH, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); SetWindowPos(m_Window, nullptr, m_ScreenX, m_ScreenY, m_WindowW, m_WindowH, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
ScreenToWindow(); ScreenToWindow();
@ -464,12 +464,12 @@ void MeterWindow::Refresh(bool init, bool all)
// Start the timers // Start the timers
if (m_WindowUpdate >= 0) if (m_WindowUpdate >= 0)
{ {
SetTimer(m_Window, TIMER_METER, m_WindowUpdate, NULL); SetTimer(m_Window, TIMER_METER, m_WindowUpdate, nullptr);
} }
SetTimer(m_Window, TIMER_MOUSE, INTERVAL_MOUSE, NULL); SetTimer(m_Window, TIMER_MOUSE, INTERVAL_MOUSE, nullptr);
g_Rainmeter->SetCurrentParser(NULL); g_Rainmeter->SetCurrentParser(nullptr);
m_State = STATE_RUNNING; m_State = STATE_RUNNING;
@ -591,7 +591,7 @@ void MeterWindow::MapCoordsToScreen(int& x, int& y, int w, int h)
*/ */
void MeterWindow::MoveWindow(int x, int y) void MeterWindow::MoveWindow(int x, int y)
{ {
SetWindowPos(m_Window, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); SetWindowPos(m_Window, nullptr, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
SavePositionIfAppropriate(); SavePositionIfAppropriate();
} }
@ -710,7 +710,7 @@ void MeterWindow::DoBang(Bang bang, const std::vector<std::wstring>& args)
{ {
case Bang::Refresh: case Bang::Refresh:
// Refresh needs to be delayed since it crashes if done during Update() // Refresh needs to be delayed since it crashes if done during Update()
PostMessage(m_Window, WM_METERWINDOW_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL); PostMessage(m_Window, WM_METERWINDOW_DELAYED_REFRESH, (WPARAM)nullptr, (LPARAM)nullptr);
break; break;
case Bang::Redraw: case Bang::Redraw:
@ -722,7 +722,7 @@ void MeterWindow::DoBang(Bang bang, const std::vector<std::wstring>& args)
Update(false); Update(false);
if (m_WindowUpdate >= 0) if (m_WindowUpdate >= 0)
{ {
SetTimer(m_Window, TIMER_METER, m_WindowUpdate, NULL); SetTimer(m_Window, TIMER_METER, m_WindowUpdate, nullptr);
} }
break; break;
@ -1032,25 +1032,25 @@ void MeterWindow::ResizeBlur(const std::wstring& arg, int mode)
while (token[0] == L' ') ++token; while (token[0] == L' ') ++token;
type = m_Parser.ParseInt(token, 0); type = m_Parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
while (token[0] == L' ') ++token; while (token[0] == L' ') ++token;
x = m_Parser.ParseInt(token, 0); x = m_Parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
while (token[0] == L' ') ++token; while (token[0] == L' ') ++token;
y = m_Parser.ParseInt(token, 0); y = m_Parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
while (token[0] == L' ') ++token; while (token[0] == L' ') ++token;
w = m_Parser.ParseInt(token, 0); w = m_Parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
while (token[0] == L' ') ++token; while (token[0] == L' ') ++token;
@ -1072,7 +1072,7 @@ void MeterWindow::ResizeBlur(const std::wstring& arg, int mode)
break; break;
case 2: case 2:
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
while (token[0] == L' ') ++token; while (token[0] == L' ') ++token;
@ -1677,7 +1677,7 @@ void MeterWindow::ScreenToWindow()
RECT rect = {m_ScreenX, m_ScreenY, m_ScreenX + m_WindowW, m_ScreenY + m_WindowH}; RECT rect = {m_ScreenX, m_ScreenY, m_ScreenX + m_WindowW, m_ScreenY + m_WindowH};
HMONITOR hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST); HMONITOR hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
if (hMonitor != NULL) if (hMonitor != nullptr)
{ {
int screenIndex = 1; int screenIndex = 1;
for (auto iter = monitors.cbegin(); iter != monitors.cend(); ++iter, ++screenIndex) for (auto iter = monitors.cbegin(); iter != monitors.cend(); ++iter, ++screenIndex)
@ -1793,7 +1793,7 @@ void MeterWindow::ReadOptions()
const WCHAR* section = m_FolderPath.c_str(); const WCHAR* section = m_FolderPath.c_str();
ConfigParser parser; ConfigParser parser;
parser.Initialize(g_Rainmeter->GetIniFile(), NULL, section); parser.Initialize(g_Rainmeter->GetIniFile(), nullptr, section);
INT writeFlags = 0; INT writeFlags = 0;
auto addWriteFlag = [&](INT flag) auto addWriteFlag = [&](INT flag)
@ -1980,7 +1980,7 @@ bool MeterWindow::ReadSkin()
std::wstring resourcePath = GetResourcesPath(); std::wstring resourcePath = GetResourcesPath();
bool hasResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0); bool hasResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0);
m_Parser.Initialize(iniFile, this, NULL, &resourcePath); m_Parser.Initialize(iniFile, this, nullptr, &resourcePath);
// Read options from Rainmeter.ini. // Read options from Rainmeter.ini.
ReadOptions(); ReadOptions();
@ -2090,7 +2090,7 @@ bool MeterWindow::ReadSkin()
(Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard, (Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard,
&fd, &fd,
FindExSearchNameMatch, FindExSearchNameMatch,
NULL, nullptr,
0); 0);
if (find != INVALID_HANDLE_VALUE) if (find != INVALID_HANDLE_VALUE)
@ -2155,7 +2155,7 @@ bool MeterWindow::ReadSkin()
// to avoid errors caused by referencing nonexistent [sections] in the options. // to avoid errors caused by referencing nonexistent [sections] in the options.
m_HasNetMeasures = false; m_HasNetMeasures = false;
m_HasButtons = false; m_HasButtons = false;
Meter* prevMeter = NULL; Meter* prevMeter = nullptr;
for (auto iter = m_Parser.GetSections().cbegin(); iter != m_Parser.GetSections().cend(); ++iter) for (auto iter = m_Parser.GetSections().cbegin(); iter != m_Parser.GetSections().cend(); ++iter)
{ {
const WCHAR* section = (*iter).c_str(); const WCHAR* section = (*iter).c_str();
@ -2285,7 +2285,7 @@ bool MeterWindow::ResizeWindow(bool reset)
// Reset size (this is calculated below) // Reset size (this is calculated below)
delete m_Background; delete m_Background;
m_Background = NULL; m_Background = nullptr;
if ((m_BackgroundMode == BGMODE_IMAGE || m_BackgroundMode == BGMODE_SCALED_IMAGE || m_BackgroundMode == BGMODE_TILED_IMAGE) && !m_BackgroundName.empty()) if ((m_BackgroundMode == BGMODE_IMAGE || m_BackgroundMode == BGMODE_SCALED_IMAGE || m_BackgroundMode == BGMODE_TILED_IMAGE) && !m_BackgroundName.empty())
{ {
@ -2555,7 +2555,7 @@ void MeterWindow::PostUpdate(bool bActiveTransition)
// Start/stop the transition timer if necessary // Start/stop the transition timer if necessary
if (bActiveTransition && !m_ActiveTransition) if (bActiveTransition && !m_ActiveTransition)
{ {
SetTimer(m_Window, TIMER_TRANSITION, m_TransitionUpdate, NULL); SetTimer(m_Window, TIMER_TRANSITION, m_TransitionUpdate, nullptr);
m_ActiveTransition = true; m_ActiveTransition = true;
} }
else if (m_ActiveTransition && !bActiveTransition) else if (m_ActiveTransition && !bActiveTransition)
@ -2729,12 +2729,12 @@ void MeterWindow::UpdateWindow(int alpha, bool reset, bool canvasBeginDrawCalled
if (!canvasBeginDrawCalled) m_Canvas->BeginDraw(); if (!canvasBeginDrawCalled) m_Canvas->BeginDraw();
HDC dcMemory = m_Canvas->GetDC(); HDC dcMemory = m_Canvas->GetDC();
if (!UpdateLayeredWindow(m_Window, NULL, NULL, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA)) if (!UpdateLayeredWindow(m_Window, nullptr, nullptr, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA))
{ {
// Retry after resetting WS_EX_LAYERED flag. // Retry after resetting WS_EX_LAYERED flag.
RemoveWindowExStyle(WS_EX_LAYERED); RemoveWindowExStyle(WS_EX_LAYERED);
AddWindowExStyle(WS_EX_LAYERED); AddWindowExStyle(WS_EX_LAYERED);
UpdateLayeredWindow(m_Window, NULL, NULL, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA); UpdateLayeredWindow(m_Window, nullptr, nullptr, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA);
} }
m_Canvas->ReleaseDC(dcMemory); m_Canvas->ReleaseDC(dcMemory);
@ -2750,7 +2750,7 @@ void MeterWindow::UpdateWindow(int alpha, bool reset, bool canvasBeginDrawCalled
void MeterWindow::UpdateWindowTransparency(int alpha) void MeterWindow::UpdateWindowTransparency(int alpha)
{ {
BLENDFUNCTION blendPixelFunction = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; BLENDFUNCTION blendPixelFunction = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA};
UpdateLayeredWindow(m_Window, NULL, NULL, NULL, NULL, NULL, 0, &blendPixelFunction, ULW_ALPHA); UpdateLayeredWindow(m_Window, nullptr, nullptr, nullptr, nullptr, nullptr, 0, &blendPixelFunction, ULW_ALPHA);
m_TransparencyValue = alpha; m_TransparencyValue = alpha;
} }
@ -2918,7 +2918,7 @@ void MeterWindow::FadeWindow(int from, int to)
} }
} }
SetTimer(m_Window, TIMER_FADE, INTERVAL_FADE, NULL); SetTimer(m_Window, TIMER_FADE, INTERVAL_FADE, nullptr);
} }
} }
@ -2951,7 +2951,7 @@ void MeterWindow::ShowWindowIfAppropriate()
POINT pos = System::GetCursorPosition(); POINT pos = System::GetCursorPosition();
POINT posScr = pos; POINT posScr = pos;
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
bool inside = HitTest(pos.x, pos.y); bool inside = HitTest(pos.x, pos.y);
if (inside) if (inside)
@ -3024,14 +3024,14 @@ HWND MeterWindow::GetWindowFromPoint(POINT pos)
return hwndPos; return hwndPos;
} }
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
if (HitTest(pos.x, pos.y)) if (HitTest(pos.x, pos.y))
{ {
if (hwndPos) if (hwndPos)
{ {
HWND hWnd = GetAncestor(hwndPos, GA_ROOT); HWND hWnd = GetAncestor(hwndPos, GA_ROOT);
while (hWnd = FindWindowEx(NULL, hWnd, METERWINDOW_CLASS_NAME, NULL)) while (hWnd = FindWindowEx(nullptr, hWnd, METERWINDOW_CLASS_NAME, nullptr))
{ {
if (hWnd == m_Window) if (hWnd == m_Window)
{ {
@ -3061,7 +3061,7 @@ bool MeterWindow::HitTest(int x, int y)
void MeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute) void MeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute)
{ {
bool redraw = false; bool redraw = false;
HCURSOR cursor = NULL; HCURSOR cursor = nullptr;
std::vector<Meter*>::const_reverse_iterator j = m_Meters.rbegin(); std::vector<Meter*>::const_reverse_iterator j = m_Meters.rbegin();
for ( ; j != m_Meters.rend(); ++j) for ( ; j != m_Meters.rend(); ++j)
@ -3069,7 +3069,7 @@ void MeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute)
// Hidden meters are ignored // Hidden meters are ignored
if ((*j)->IsHidden()) continue; if ((*j)->IsHidden()) continue;
MeterButton* button = NULL; MeterButton* button = nullptr;
if (m_HasButtons && (*j)->GetTypeID() == TypeID<MeterButton>()) if (m_HasButtons && (*j)->GetTypeID() == TypeID<MeterButton>())
{ {
button = (MeterButton*)(*j); button = (MeterButton*)(*j);
@ -3109,7 +3109,7 @@ void MeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute)
if (!cursor) if (!cursor)
{ {
cursor = LoadCursor(NULL, IDC_ARROW); cursor = LoadCursor(nullptr, IDC_ARROW);
} }
SetCursor(cursor); SetCursor(cursor);
@ -3131,7 +3131,7 @@ LRESULT MeterWindow::OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT MeterWindow::OnEnterMenuLoop(UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT MeterWindow::OnEnterMenuLoop(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
// Set cursor to default // Set cursor to default
SetCursor(LoadCursor(NULL, IDC_ARROW)); SetCursor(LoadCursor(nullptr, IDC_ARROW));
return 0; return 0;
} }
@ -3189,7 +3189,7 @@ LRESULT MeterWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCMOUSEMOVE) if (uMsg == WM_NCMOUSEMOVE)
{ {
// Map to local window // Map to local window
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
++m_MouseMoveCounter; ++m_MouseMoveCounter;
@ -3245,7 +3245,7 @@ LRESULT MeterWindow::OnMouseScrollMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
pos.x = GET_X_LPARAM(lParam); pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam); pos.y = GET_Y_LPARAM(lParam);
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
// Handle buttons // Handle buttons
HandleButtons(pos, BUTTONPROC_MOVE); HandleButtons(pos, BUTTONPROC_MOVE);
@ -3266,7 +3266,7 @@ LRESULT MeterWindow::OnMouseHScrollMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
pos.x = GET_X_LPARAM(lParam); pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam); pos.y = GET_Y_LPARAM(lParam);
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
// Handle buttons // Handle buttons
HandleButtons(pos, BUTTONPROC_MOVE); HandleButtons(pos, BUTTONPROC_MOVE);
@ -3606,7 +3606,7 @@ LRESULT MeterWindow::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
SavePositionIfAppropriate(); SavePositionIfAppropriate();
POINT pos = System::GetCursorPosition(); POINT pos = System::GetCursorPosition();
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
// Handle buttons // Handle buttons
HandleButtons(pos, BUTTONPROC_UP, false); // redraw only HandleButtons(pos, BUTTONPROC_UP, false); // redraw only
@ -3638,7 +3638,7 @@ LRESULT MeterWindow::OnEnterSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
m_Dragged = true; // Don't post the WM_NCLBUTTONUP message! m_Dragged = true; // Don't post the WM_NCLBUTTONUP message!
// Set cursor to default // Set cursor to default
SetCursor(LoadCursor(NULL, IDC_ARROW)); SetCursor(LoadCursor(nullptr, IDC_ARROW));
} }
return 0; return 0;
@ -3664,7 +3664,7 @@ LRESULT MeterWindow::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam)
POINT pos; POINT pos;
pos.x = GET_X_LPARAM(lParam); pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam); pos.y = GET_Y_LPARAM(lParam);
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
int x1 = m_DragMargins.left; int x1 = m_DragMargins.left;
if (x1 < 0) x1 += m_WindowW; if (x1 < 0) x1 += m_WindowW;
@ -3726,7 +3726,7 @@ LRESULT MeterWindow::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam
const std::vector<MonitorInfo>& monitors = System::GetMultiMonitorInfo().monitors; const std::vector<MonitorInfo>& monitors = System::GetMultiMonitorInfo().monitors;
const RECT windowRect = {wp->x, wp->y, wp->x + (m_WindowW ? m_WindowW : 1), wp->y + (m_WindowH ? m_WindowH : 1)}; const RECT windowRect = {wp->x, wp->y, wp->x + (m_WindowW ? m_WindowW : 1), wp->y + (m_WindowH ? m_WindowH : 1)};
const RECT* workArea = NULL; const RECT* workArea = nullptr;
size_t maxSize = 0; size_t maxSize = 0;
for (auto iter = monitors.cbegin(); iter != monitors.cend(); ++iter) for (auto iter = monitors.cbegin(); iter != monitors.cend(); ++iter)
@ -3902,7 +3902,7 @@ LRESULT MeterWindow::OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCLBUTTONDOWN) if (uMsg == WM_NCLBUTTONDOWN)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -3934,7 +3934,7 @@ LRESULT MeterWindow::OnLeftButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCLBUTTONUP) if (uMsg == WM_NCLBUTTONUP)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -3958,7 +3958,7 @@ LRESULT MeterWindow::OnLeftButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lP
if (uMsg == WM_NCLBUTTONDBLCLK) if (uMsg == WM_NCLBUTTONDBLCLK)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -3985,7 +3985,7 @@ LRESULT MeterWindow::OnRightButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCRBUTTONDOWN) if (uMsg == WM_NCRBUTTONDOWN)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4032,7 +4032,7 @@ LRESULT MeterWindow::OnRightButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM l
if (uMsg == WM_NCRBUTTONDBLCLK) if (uMsg == WM_NCRBUTTONDBLCLK)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4059,7 +4059,7 @@ LRESULT MeterWindow::OnMiddleButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCMBUTTONDOWN) if (uMsg == WM_NCMBUTTONDOWN)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4083,7 +4083,7 @@ LRESULT MeterWindow::OnMiddleButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCMBUTTONUP) if (uMsg == WM_NCMBUTTONUP)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4107,7 +4107,7 @@ LRESULT MeterWindow::OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM
if (uMsg == WM_NCMBUTTONDBLCLK) if (uMsg == WM_NCMBUTTONDBLCLK)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4134,7 +4134,7 @@ LRESULT MeterWindow::OnXButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCXBUTTONDOWN) if (uMsg == WM_NCXBUTTONDOWN)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4165,7 +4165,7 @@ LRESULT MeterWindow::OnXButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_NCXBUTTONUP) if (uMsg == WM_NCXBUTTONUP)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4196,7 +4196,7 @@ LRESULT MeterWindow::OnXButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lPara
if (uMsg == WM_NCXBUTTONDBLCLK) if (uMsg == WM_NCXBUTTONDBLCLK)
{ {
// Transform the point to client rect // Transform the point to client rect
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(nullptr, m_Window, &pos, 1);
} }
// Handle buttons // Handle buttons
@ -4360,7 +4360,7 @@ bool MeterWindow::DoMoveAction(int x, int y, MOUSEACTION action)
} }
// Handle button // Handle button
MeterButton* button = NULL; MeterButton* button = nullptr;
if (m_HasButtons && (*j)->GetTypeID() == TypeID<MeterButton>()) if (m_HasButtons && (*j)->GetTypeID() == TypeID<MeterButton>())
{ {
button = (MeterButton*)(*j); button = (MeterButton*)(*j);
@ -4645,7 +4645,7 @@ LRESULT MeterWindow::OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
// Move the window temporarily // Move the window temporarily
ResizeWindow(false); ResizeWindow(false);
SetWindowPos(m_Window, NULL, m_ScreenX, m_ScreenY, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); SetWindowPos(m_Window, nullptr, m_ScreenX, m_ScreenY, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
return 0; return 0;
} }
@ -4771,5 +4771,5 @@ Meter* MeterWindow::GetMeter(const std::wstring& meterName)
return (*j); return (*j);
} }
} }
return NULL; return nullptr;
} }

View File

@ -174,7 +174,7 @@ HCURSOR Mouse::GetCursor() const
break; break;
} }
return LoadCursor(NULL, name); return LoadCursor(nullptr, name);
} }
std::wstring Mouse::GetActionCommand(MOUSEACTION action) const std::wstring Mouse::GetActionCommand(MOUSEACTION action) const
@ -189,7 +189,7 @@ void Mouse::DestroyCustomCursor()
if (m_CustomCursor) if (m_CustomCursor)
{ {
DestroyCursor(m_CustomCursor); DestroyCursor(m_CustomCursor);
m_CustomCursor = NULL; m_CustomCursor = nullptr;
} }
} }

View File

@ -63,7 +63,7 @@ enum MOUSECURSOR
class Mouse class Mouse
{ {
public: public:
Mouse(MeterWindow* meterWindow, Meter* meter = NULL); Mouse(MeterWindow* meterWindow, Meter* meter = nullptr);
~Mouse(); ~Mouse();
void ReadOptions(ConfigParser& parser, const WCHAR* section); void ReadOptions(ConfigParser& parser, const WCHAR* section);

View File

@ -55,7 +55,7 @@ int RainmeterMain(LPWSTR cmdLine)
// Avoid loading a dll from current directory // Avoid loading a dll from current directory
SetDllDirectory(L""); SetDllDirectory(L"");
const WCHAR* layout = NULL; const WCHAR* layout = nullptr;
if (cmdLine[0] == L'!' || cmdLine[0] == L'[') if (cmdLine[0] == L'!' || cmdLine[0] == L'[')
{ {
@ -67,7 +67,7 @@ int RainmeterMain(LPWSTR cmdLine)
cds.dwData = 1; cds.dwData = 1;
cds.cbData = (DWORD)((wcslen(cmdLine) + 1) * sizeof(WCHAR)); cds.cbData = (DWORD)((wcslen(cmdLine) + 1) * sizeof(WCHAR));
cds.lpData = (PVOID)cmdLine; cds.lpData = (PVOID)cmdLine;
SendMessage(wnd, WM_COPYDATA, NULL, (LPARAM)&cds); SendMessage(wnd, WM_COPYDATA, 0, (LPARAM)&cds);
return 0; return 0;
} }
@ -92,7 +92,7 @@ int RainmeterMain(LPWSTR cmdLine)
} }
} }
const WCHAR* iniFile = (*cmdLine && !layout) ? cmdLine : NULL; const WCHAR* iniFile = (*cmdLine && !layout) ? cmdLine : nullptr;
g_Rainmeter = new Rainmeter; g_Rainmeter = new Rainmeter;
int ret = g_Rainmeter->Initialize(iniFile, layout); int ret = g_Rainmeter->Initialize(iniFile, layout);
@ -102,7 +102,7 @@ int RainmeterMain(LPWSTR cmdLine)
} }
delete g_Rainmeter; delete g_Rainmeter;
g_Rainmeter = NULL; g_Rainmeter = nullptr;
return ret; return ret;
} }
@ -132,13 +132,13 @@ Rainmeter::Rainmeter() :
m_GDIplusToken(), m_GDIplusToken(),
m_GlobalOptions() m_GlobalOptions()
{ {
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
InitCommonControls(); InitCommonControls();
// Initialize GDI+. // Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput; GdiplusStartupInput gdiplusStartupInput;
GdiplusStartup(&m_GDIplusToken, &gdiplusStartupInput, NULL); GdiplusStartup(&m_GDIplusToken, &gdiplusStartupInput, nullptr);
} }
/* /*
@ -253,10 +253,10 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout)
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, nullptr,
NULL, nullptr,
m_Instance, m_Instance,
NULL); nullptr);
if (!m_Window) return 1; if (!m_Window) return 1;
@ -317,7 +317,7 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Rainmeter", 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &hKey) == ERROR_SUCCESS) if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Rainmeter", 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &hKey) == ERROR_SUCCESS)
{ {
DWORD type = 0; DWORD type = 0;
if (RegQueryValueEx(hKey, L"Language", NULL, &type, (LPBYTE)buffer, (LPDWORD)&size) != ERROR_SUCCESS || if (RegQueryValueEx(hKey, L"Language", nullptr, &type, (LPBYTE)buffer, (LPDWORD)&size) != ERROR_SUCCESS ||
type != REG_SZ) type != REG_SZ)
{ {
buffer[0] = L'\0'; buffer[0] = L'\0';
@ -328,22 +328,22 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout)
if (buffer[0] != L'\0') if (buffer[0] != L'\0')
{ {
// Try selected language // Try selected language
m_ResourceLCID = wcstoul(buffer, NULL, 10); m_ResourceLCID = wcstoul(buffer, nullptr, 10);
resource += buffer; resource += buffer;
resource += L".dll"; resource += L".dll";
m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); m_ResourceInstance = LoadLibraryEx(resource.c_str(), nullptr, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
} }
if (!m_ResourceInstance) if (!m_ResourceInstance)
{ {
// Try English // Try English
resource = m_Path; resource = m_Path;
resource += L"Languages\\1033.dll"; resource += L"Languages\\1033.dll";
m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); m_ResourceInstance = LoadLibraryEx(resource.c_str(), nullptr, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
m_ResourceLCID = 1033; m_ResourceLCID = 1033;
if (!m_ResourceInstance) if (!m_ResourceInstance)
{ {
MessageBox(NULL, L"Unable to load language library", APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR); MessageBox(nullptr, L"Unable to load language library", APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
return 1; return 1;
} }
} }
@ -363,12 +363,12 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout)
} }
} }
else if (bDefaultIniLocation && else if (bDefaultIniLocation &&
SUCCEEDED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, buffer))) SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, buffer)))
{ {
// Use My Documents/Rainmeter/Skins // Use My Documents/Rainmeter/Skins
m_SkinPath = buffer; m_SkinPath = buffer;
m_SkinPath += L"\\Rainmeter\\"; m_SkinPath += L"\\Rainmeter\\";
CreateDirectory(m_SkinPath.c_str(), NULL); CreateDirectory(m_SkinPath.c_str(), nullptr);
m_SkinPath += L"Skins\\"; m_SkinPath += L"Skins\\";
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), iniFile); WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), iniFile);
@ -382,7 +382,7 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout)
CreateComponentFolders(bDefaultIniLocation); CreateComponentFolders(bDefaultIniLocation);
delete [] buffer; delete [] buffer;
buffer = NULL; buffer = nullptr;
LogNoticeF(L"Path: %s", m_Path.c_str()); LogNoticeF(L"Path: %s", m_Path.c_str());
LogNoticeF(L"IniFile: %s", iniFile); LogNoticeF(L"IniFile: %s", iniFile);
@ -429,7 +429,7 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout)
if (m_SkinFolders.empty()) if (m_SkinFolders.empty())
{ {
std::wstring error = GetFormattedString(ID_STR_NOAVAILABLESKINS, m_SkinPath.c_str()); std::wstring error = GetFormattedString(ID_STR_NOAVAILABLESKINS, m_SkinPath.c_str());
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONERROR); ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONERROR);
} }
ResetStats(); ResetStats();
@ -510,11 +510,11 @@ bool Rainmeter::IsAlreadyRunning()
} }
*pos = L'\0'; *pos = L'\0';
m_Mutex = CreateMutex(NULL, FALSE, mutexName); m_Mutex = CreateMutex(nullptr, FALSE, mutexName);
if (GetLastError() == ERROR_ALREADY_EXISTS) if (GetLastError() == ERROR_ALREADY_EXISTS)
{ {
alreadyRunning = true; alreadyRunning = true;
m_Mutex = NULL; m_Mutex = nullptr;
} }
} }
@ -530,7 +530,7 @@ int Rainmeter::MessagePump()
BOOL ret; BOOL ret;
// Run the standard window message loop // Run the standard window message loop
while ((ret = GetMessage(&msg, NULL, 0, 0)) != 0) while ((ret = GetMessage(&msg, nullptr, 0, 0)) != 0)
{ {
if (ret == -1) if (ret == -1)
{ {
@ -587,7 +587,7 @@ LRESULT CALLBACK Rainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
{ {
// Execute bang // Execute bang
WCHAR* bang = (WCHAR*)lParam; WCHAR* bang = (WCHAR*)lParam;
g_Rainmeter->ExecuteCommand(bang, NULL); g_Rainmeter->ExecuteCommand(bang, nullptr);
free(bang); // _wcsdup() free(bang); // _wcsdup()
} }
break; break;
@ -608,12 +608,12 @@ LRESULT CALLBACK Rainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
void Rainmeter::SetNetworkStatisticsTimer() void Rainmeter::SetNetworkStatisticsTimer()
{ {
static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL); static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, nullptr);
} }
void Rainmeter::CreateOptionsFile() void Rainmeter::CreateOptionsFile()
{ {
CreateDirectory(m_SettingsPath.c_str(), NULL); CreateDirectory(m_SettingsPath.c_str(), nullptr);
std::wstring defaultIni = GetDefaultLayoutPath(); std::wstring defaultIni = GetDefaultLayoutPath();
defaultIni += L"illustro default\\Rainmeter.ini"; defaultIni += L"illustro default\\Rainmeter.ini";
@ -634,7 +634,7 @@ void Rainmeter::CreateDataFile()
else else
{ {
// Create empty file // Create empty file
HANDLE file = CreateFile(dataFile, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFile(dataFile, GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
if (file != INVALID_HANDLE_VALUE) if (file != INVALID_HANDLE_VALUE)
{ {
CloseHandle(file); CloseHandle(file);
@ -646,7 +646,7 @@ void Rainmeter::CreateComponentFolders(bool defaultIniLocation)
{ {
std::wstring path; std::wstring path;
if (CreateDirectory(m_SkinPath.c_str(), NULL)) if (CreateDirectory(m_SkinPath.c_str(), nullptr))
{ {
// Folder just created, so copy default skins there // Folder just created, so copy default skins there
std::wstring from = GetDefaultSkinPath(); std::wstring from = GetDefaultSkinPath();
@ -860,7 +860,7 @@ void Rainmeter::ActivateSkin(int folderIndex, int fileIndex)
if (_waccess(skinIniPath.c_str(), 0) == -1) if (_waccess(skinIniPath.c_str(), 0) == -1)
{ {
std::wstring message = GetFormattedString(ID_STR_UNABLETOACTIVATESKIN, folderPath.c_str(), fileSz); std::wstring message = GetFormattedString(ID_STR_UNABLETOACTIVATESKIN, folderPath.c_str(), fileSz);
ShowMessage(NULL, message.c_str(), MB_OK | MB_ICONEXCLAMATION); ShowMessage(nullptr, message.c_str(), MB_OK | MB_ICONEXCLAMATION);
return; return;
} }
@ -1047,7 +1047,7 @@ MeterWindow* Rainmeter::GetMeterWindow(const std::wstring& folderPath)
} }
} }
return NULL; return nullptr;
} }
MeterWindow* Rainmeter::GetMeterWindowByINI(const std::wstring& ini_searching) MeterWindow* Rainmeter::GetMeterWindowByINI(const std::wstring& ini_searching)
@ -1069,7 +1069,7 @@ MeterWindow* Rainmeter::GetMeterWindowByINI(const std::wstring& ini_searching)
} }
} }
return NULL; return nullptr;
} }
std::pair<int, int> Rainmeter::GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file) std::pair<int, int> Rainmeter::GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file)
@ -1122,7 +1122,7 @@ MeterWindow* Rainmeter::GetMeterWindow(HWND hwnd)
} }
} }
return NULL; return nullptr;
} }
void Rainmeter::GetMeterWindowsByLoadOrder(std::multimap<int, MeterWindow*>& windows, const std::wstring& group) void Rainmeter::GetMeterWindowsByLoadOrder(std::multimap<int, MeterWindow*>& windows, const std::wstring& group)
@ -1268,7 +1268,7 @@ int Rainmeter::ScanForSkinsRecursive(const std::wstring& path, std::wstring base
(Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard, (Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard,
&fileData, &fileData,
FindExSearchNameMatch, FindExSearchNameMatch,
NULL, nullptr,
0); 0);
bool foundFiles = false; bool foundFiles = false;
@ -1375,7 +1375,7 @@ void Rainmeter::ScanForLayouts()
(Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard, (Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard,
&fileData, &fileData,
FindExSearchNameMatch, FindExSearchNameMatch,
NULL, nullptr,
0); 0);
if (hSearch != INVALID_HANDLE_VALUE) if (hSearch != INVALID_HANDLE_VALUE)
@ -1416,7 +1416,7 @@ void Rainmeter::ExecuteCommand(const WCHAR* command, MeterWindow* meterWindow, b
void Rainmeter::DelayedExecuteCommand(const WCHAR* command) void Rainmeter::DelayedExecuteCommand(const WCHAR* command)
{ {
WCHAR* bang = _wcsdup(command); WCHAR* bang = _wcsdup(command);
PostMessage(m_Window, WM_RAINMETER_DELAYED_EXECUTE, (WPARAM)NULL, (LPARAM)bang); PostMessage(m_Window, WM_RAINMETER_DELAYED_EXECUTE, (WPARAM)nullptr, (LPARAM)bang);
} }
/* /*
@ -1431,7 +1431,7 @@ void Rainmeter::ReadGeneralSettings(const std::wstring& iniFile)
m_DesktopWorkAreas.clear(); m_DesktopWorkAreas.clear();
ConfigParser parser; ConfigParser parser;
parser.Initialize(iniFile, NULL, NULL); parser.Initialize(iniFile, nullptr, nullptr);
m_UseD2D = 0!=parser.ReadInt(L"Rainmeter", L"UseD2D", 0); m_UseD2D = 0!=parser.ReadInt(L"Rainmeter", L"UseD2D", 0);
@ -1591,7 +1591,7 @@ void Rainmeter::RefreshAll()
DeactivateSkin(mw, index); DeactivateSkin(mw, index);
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONEXCLAMATION);
continue; continue;
} }
} }
@ -1602,7 +1602,7 @@ void Rainmeter::RefreshAll()
DeactivateSkin(mw, -2); // -2 = Force deactivate DeactivateSkin(mw, -2); // -2 = Force deactivate
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONEXCLAMATION);
continue; continue;
} }
@ -1611,7 +1611,7 @@ void Rainmeter::RefreshAll()
} }
DialogAbout::UpdateSkins(); DialogAbout::UpdateSkins();
DialogManage::UpdateSkins(NULL); DialogManage::UpdateSkins(nullptr);
} }
bool Rainmeter::LoadLayout(const std::wstring& name) bool Rainmeter::LoadLayout(const std::wstring& name)
@ -1632,7 +1632,7 @@ bool Rainmeter::LoadLayout(const std::wstring& name)
std::wstring backup = GetLayoutPath(); std::wstring backup = GetLayoutPath();
backup += L"@Backup"; backup += L"@Backup";
CreateDirectory(backup.c_str(), NULL); CreateDirectory(backup.c_str(), nullptr);
backup += L"\\Rainmeter.ini"; backup += L"\\Rainmeter.ini";
bool backupLayout = (_wcsicmp(name.c_str(), L"@Backup") == 0); bool backupLayout = (_wcsicmp(name.c_str(), L"@Backup") == 0);
@ -1797,7 +1797,7 @@ void Rainmeter::UpdateDesktopWorkArea(bool reset)
if (changed && System::GetWindow()) if (changed && System::GetWindow())
{ {
// Update System::MultiMonitorInfo for for work area variables // Update System::MultiMonitorInfo for for work area variables
SendMessageTimeout(System::GetWindow(), WM_SETTINGCHANGE, SPI_SETWORKAREA, 0, SMTO_ABORTIFHUNG, 1000, NULL); SendMessageTimeout(System::GetWindow(), WM_SETTINGCHANGE, SPI_SETWORKAREA, 0, SMTO_ABORTIFHUNG, 1000, nullptr);
} }
} }
@ -1817,7 +1817,7 @@ void Rainmeter::ReadStats()
if (GetPrivateProfileSection(L"Statistics", tmpSz, SHRT_MAX, iniFile) > 0) if (GetPrivateProfileSection(L"Statistics", tmpSz, SHRT_MAX, iniFile) > 0)
{ {
WritePrivateProfileString(L"Statistics", NULL, NULL, iniFile); WritePrivateProfileString(L"Statistics", nullptr, nullptr, iniFile);
} }
else else
{ {
@ -1850,7 +1850,7 @@ void Rainmeter::WriteStats(bool bForce)
const WCHAR* statsFile = m_StatsFile.c_str(); const WCHAR* statsFile = m_StatsFile.c_str();
MeasureNet::WriteStats(statsFile, m_StatsDate); MeasureNet::WriteStats(statsFile, m_StatsDate);
WritePrivateProfileString(NULL, NULL, NULL, statsFile); WritePrivateProfileString(nullptr, nullptr, nullptr, statsFile);
} }
} }
@ -1983,11 +1983,11 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow)
menu = CreateSkinMenu(meterWindow, 0, allSkinsMenu); menu = CreateSkinMenu(meterWindow, 0, allSkinsMenu);
InsertMenu(menu, IDM_CLOSESKIN, MF_BYCOMMAND | MF_POPUP, (UINT_PTR)rainmeterMenu, L"Rainmeter"); InsertMenu(menu, IDM_CLOSESKIN, MF_BYCOMMAND | MF_POPUP, (UINT_PTR)rainmeterMenu, L"Rainmeter");
InsertMenu(menu, IDM_CLOSESKIN, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL); InsertMenu(menu, IDM_CLOSESKIN, MF_BYCOMMAND | MF_SEPARATOR, 0, nullptr);
} }
else else
{ {
InsertMenu(menu, 12, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); InsertMenu(menu, 12, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
// Create a menu for all active skins // Create a menu for all active skins
int index = 0; int index = 0;
@ -2005,12 +2005,12 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow)
{ {
InsertMenu(menu, 0, MF_BYPOSITION, IDM_NEW_VERSION, GetString(ID_STR_UPDATEAVAILABLE)); InsertMenu(menu, 0, MF_BYPOSITION, IDM_NEW_VERSION, GetString(ID_STR_UPDATEAVAILABLE));
HiliteMenuItem(GetTrayWindow()->GetWindow(), menu, 0, MF_BYPOSITION | MF_HILITE); HiliteMenuItem(GetTrayWindow()->GetWindow(), menu, 0, MF_BYPOSITION | MF_HILITE);
InsertMenu(menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); InsertMenu(menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
} }
} }
HWND hWnd = WindowFromPoint(pos); HWND hWnd = WindowFromPoint(pos);
if (hWnd != NULL) if (hWnd != nullptr)
{ {
MeterWindow* mw = GetMeterWindow(hWnd); MeterWindow* mw = GetMeterWindow(hWnd);
if (mw) if (mw)
@ -2025,7 +2025,7 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow)
HWND hWndForeground = GetForegroundWindow(); HWND hWndForeground = GetForegroundWindow();
if (hWndForeground != hWnd) if (hWndForeground != hWnd)
{ {
DWORD foregroundThreadID = GetWindowThreadProcessId(hWndForeground, NULL); DWORD foregroundThreadID = GetWindowThreadProcessId(hWndForeground, nullptr);
DWORD currentThreadID = GetCurrentThreadId(); DWORD currentThreadID = GetCurrentThreadId();
AttachThreadInput(currentThreadID, foregroundThreadID, TRUE); AttachThreadInput(currentThreadID, foregroundThreadID, TRUE);
SetForegroundWindow(hWnd); SetForegroundWindow(hWnd);
@ -2040,7 +2040,7 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow)
pos.y, pos.y,
0, 0,
hWnd, hWnd,
NULL); nullptr);
if (meterWindow) if (meterWindow)
{ {
@ -2097,7 +2097,7 @@ int Rainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index)
if (hasSubfolder && fileIndex != 0) if (hasSubfolder && fileIndex != 0)
{ {
InsertMenu(subMenu, fileIndex, MF_SEPARATOR | MF_BYPOSITION, 0, NULL); InsertMenu(subMenu, fileIndex, MF_SEPARATOR | MF_BYPOSITION, 0, nullptr);
} }
} }
@ -2380,8 +2380,8 @@ HMENU Rainmeter::CreateSkinMenu(MeterWindow* meterWindow, int index, HMENU menu)
if (position != 0) if (position != 0)
{ {
InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_STRING | MF_GRAYED, NULL, L"Custom skin actions"); InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_STRING | MF_GRAYED, 0, L"Custom skin actions");
InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
} }
} }
else else
@ -2393,7 +2393,7 @@ HMENU Rainmeter::CreateSkinMenu(MeterWindow* meterWindow, int index, HMENU menu)
{ {
if (isTitleSeparator(cTitles[i])) if (isTitleSeparator(cTitles[i]))
{ {
AppendMenu(customMenu, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); AppendMenu(customMenu, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
} }
else else
{ {
@ -2401,7 +2401,7 @@ HMENU Rainmeter::CreateSkinMenu(MeterWindow* meterWindow, int index, HMENU menu)
} }
} }
InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
} }
} }
} }
@ -2542,7 +2542,7 @@ void Rainmeter::TestSettingsFile(bool bDefaultIniLocation)
error += GetFormattedString(ID_STR_SETTINGSREADONLY, iniFile); error += GetFormattedString(ID_STR_SETTINGSREADONLY, iniFile);
} }
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONERROR); ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONERROR);
} }
} }
@ -2570,7 +2570,7 @@ void Rainmeter::ExpandEnvironmentVariables(std::wstring& strPath)
pos = strPath.find(L"%APPDATA%", pos); pos = strPath.find(L"%APPDATA%", pos);
if (pos != std::wstring::npos) if (pos != std::wstring::npos)
{ {
HRESULT hr = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, buffer); HRESULT hr = SHGetFolderPath(nullptr, CSIDL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, buffer);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
size_t len = wcslen(buffer); size_t len = wcslen(buffer);

View File

@ -77,7 +77,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
#include <tchar.h> #include <tchar.h>
#define RAINMETER_QUERY_CLASS_NAME TEXT("RainmeterTrayClass") #define RAINMETER_QUERY_CLASS_NAME TEXT("RainmeterTrayClass")
#define RAINMETER_QUERY_WINDOW_NAME NULL #define RAINMETER_QUERY_WINDOW_NAME nullptr
#define WM_QUERY_RAINMETER WM_APP + 1000 #define WM_QUERY_RAINMETER WM_APP + 1000
#define WM_QUERY_RAINMETER_RETURN WM_APP + 1001 #define WM_QUERY_RAINMETER_RETURN WM_APP + 1001
@ -109,7 +109,7 @@ of the COPYDATASTRUCT.
/* /*
This Retuns the Window Handle of the active skin requested by config name in cds.lpData, This Retuns the Window Handle of the active skin requested by config name in cds.lpData,
or NULL if the config is not loaded. Currently, the config name is Case-Sensitive. or nullptr if the config is not loaded. Currently, the config name is Case-Sensitive.
To requst the data, send a message to Rainmeter in a way similar to this example. To requst the data, send a message to Rainmeter in a way similar to this example.
COPYDATASTRUCT cds; COPYDATASTRUCT cds;

View File

@ -76,14 +76,14 @@ public:
if (m_String) if (m_String)
{ {
free(m_String); free(m_String);
m_String = NULL; m_String = nullptr;
} }
} }
private: private:
WCHAR* str_alloc(const WCHAR* str) WCHAR* str_alloc(const WCHAR* str)
{ {
return str ? _wcsdup(str) : NULL; return str ? _wcsdup(str) : nullptr;
} }
WCHAR* m_String; WCHAR* m_String;

View File

@ -44,10 +44,10 @@ enum INTERVAL
MultiMonitorInfo System::c_Monitors = { 0 }; MultiMonitorInfo System::c_Monitors = { 0 };
HWND System::c_Window = NULL; HWND System::c_Window = nullptr;
HWND System::c_HelperWindow = NULL; HWND System::c_HelperWindow = nullptr;
HWINEVENTHOOK System::c_WinEventHook = NULL; HWINEVENTHOOK System::c_WinEventHook = nullptr;
bool System::c_ShowDesktop = false; bool System::c_ShowDesktop = false;
@ -78,10 +78,10 @@ void System::Initialize(HINSTANCE instance)
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, nullptr,
NULL, nullptr,
instance, instance,
NULL); nullptr);
c_HelperWindow = CreateWindowEx( c_HelperWindow = CreateWindowEx(
WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW,
@ -92,10 +92,10 @@ void System::Initialize(HINSTANCE instance)
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, nullptr,
NULL, nullptr,
instance, instance,
NULL); nullptr);
SetWindowPos(c_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS); SetWindowPos(c_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS);
SetWindowPos(c_HelperWindow, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS); SetWindowPos(c_HelperWindow, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS);
@ -110,13 +110,13 @@ void System::Initialize(HINSTANCE instance)
c_WinEventHook = SetWinEventHook( c_WinEventHook = SetWinEventHook(
EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND,
EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND,
NULL, nullptr,
MyWinEventProc, MyWinEventProc,
0, 0,
0, 0,
WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL); SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, nullptr);
} }
/* /*
@ -131,19 +131,19 @@ void System::Finalize()
if (c_WinEventHook) if (c_WinEventHook)
{ {
UnhookWinEvent(c_WinEventHook); UnhookWinEvent(c_WinEventHook);
c_WinEventHook = NULL; c_WinEventHook = nullptr;
} }
if (c_HelperWindow) if (c_HelperWindow)
{ {
DestroyWindow(c_HelperWindow); DestroyWindow(c_HelperWindow);
c_HelperWindow = NULL; c_HelperWindow = nullptr;
} }
if (c_Window) if (c_Window)
{ {
DestroyWindow(c_Window); DestroyWindow(c_Window);
c_Window = NULL; c_Window = nullptr;
} }
} }
@ -171,13 +171,13 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom, info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom,
info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top); info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top);
} }
if (m == NULL) return TRUE; if (m == nullptr) return TRUE;
if (m->useEnumDisplayDevices) if (m->useEnumDisplayDevices)
{ {
for (auto iter = m->monitors.begin(); iter != m->monitors.end(); ++iter) for (auto iter = m->monitors.begin(); iter != m->monitors.end(); ++iter)
{ {
if ((*iter).handle == NULL && _wcsicmp(info.szDevice, (*iter).deviceName.c_str()) == 0) if ((*iter).handle == nullptr && _wcsicmp(info.szDevice, (*iter).deviceName.c_str()) == 0)
{ {
(*iter).handle = hMonitor; (*iter).handle = hMonitor;
(*iter).screen = *lprcMonitor; (*iter).screen = *lprcMonitor;
@ -261,7 +261,7 @@ void System::SetMultiMonitorInfo()
DISPLAY_DEVICE dd = {sizeof(DISPLAY_DEVICE)}; DISPLAY_DEVICE dd = {sizeof(DISPLAY_DEVICE)};
if (EnumDisplayDevices(NULL, 0, &dd, 0)) if (EnumDisplayDevices(nullptr, 0, &dd, 0))
{ {
DWORD dwDevice = 0; DWORD dwDevice = 0;
@ -320,7 +320,7 @@ void System::SetMultiMonitorInfo()
{ {
MonitorInfo monitor = {0}; MonitorInfo monitor = {0};
monitor.handle = NULL; monitor.handle = nullptr;
monitor.deviceName = deviceName; // E.g. "\\.\DISPLAY1" monitor.deviceName = deviceName; // E.g. "\\.\DISPLAY1"
// Get the monitor name (E.g. "Generic Non-PnP Monitor") // Get the monitor name (E.g. "Generic Non-PnP Monitor")
@ -364,7 +364,7 @@ void System::SetMultiMonitorInfo()
} }
} }
if (monitor.handle != NULL) if (monitor.handle != nullptr)
{ {
MONITORINFO info = {sizeof(MONITORINFO)}; MONITORINFO info = {sizeof(MONITORINFO)};
GetMonitorInfo(monitor.handle, &info); GetMonitorInfo(monitor.handle, &info);
@ -410,7 +410,7 @@ void System::SetMultiMonitorInfo()
} }
++dwDevice; ++dwDevice;
} }
while (EnumDisplayDevices(NULL, dwDevice, &dd, 0)); while (EnumDisplayDevices(nullptr, dwDevice, &dd, 0));
} }
if (monitors.empty()) // Failed to enumerate the non-mirroring monitors if (monitors.empty()) // Failed to enumerate the non-mirroring monitors
@ -428,7 +428,7 @@ void System::SetMultiMonitorInfo()
if (c_Monitors.useEnumDisplayMonitors) if (c_Monitors.useEnumDisplayMonitors)
{ {
EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, (LPARAM)(&c_Monitors)); EnumDisplayMonitors(nullptr, nullptr, MyInfoEnumProc, (LPARAM)(&c_Monitors));
if (monitors.empty()) // Failed to enumerate the monitors if (monitors.empty()) // Failed to enumerate the monitors
{ {
@ -460,7 +460,7 @@ void System::SetMultiMonitorInfo()
{ {
if (logging) if (logging)
{ {
EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, (LPARAM)NULL); // Only logging EnumDisplayMonitors(nullptr, nullptr, MyInfoEnumProc, (LPARAM)nullptr); // Only logging
} }
} }
@ -522,7 +522,7 @@ void System::UpdateWorkareaInfo()
int i = 1; int i = 1;
for (auto iter = monitors.begin(); iter != monitors.end(); ++iter, ++i) for (auto iter = monitors.begin(); iter != monitors.end(); ++iter, ++i)
{ {
if ((*iter).active && (*iter).handle != NULL) if ((*iter).active && (*iter).handle != nullptr)
{ {
MONITORINFO info = {sizeof(MONITORINFO)}; MONITORINFO info = {sizeof(MONITORINFO)};
GetMonitorInfo((*iter).handle, &info); GetMonitorInfo((*iter).handle, &info);
@ -546,7 +546,7 @@ void System::UpdateWorkareaInfo()
*/ */
HWND System::GetDefaultShellWindow() HWND System::GetDefaultShellWindow()
{ {
static HWND c_ShellW = NULL; // cache static HWND c_ShellW = nullptr; // cache
HWND ShellW = GetShellWindow(); HWND ShellW = GetShellWindow();
if (ShellW) if (ShellW)
@ -562,7 +562,7 @@ HWND System::GetDefaultShellWindow()
if (!(GetClassName(ShellW, className, classLen) > 0 && if (!(GetClassName(ShellW, className, classLen) > 0 &&
wcscmp(className, L"Progman") == 0)) wcscmp(className, L"Progman") == 0))
{ {
ShellW = NULL; ShellW = nullptr;
} }
} }
} }
@ -573,14 +573,14 @@ HWND System::GetDefaultShellWindow()
/* /*
** Finds the WorkerW window. ** Finds the WorkerW window.
** If the WorkerW window is not active, returns NULL. ** If the WorkerW window is not active, returns nullptr.
** **
*/ */
HWND System::GetWorkerW() HWND System::GetWorkerW()
{ {
static HWND c_DefView = NULL; // cache static HWND c_DefView = nullptr; // cache
HWND ShellW = GetDefaultShellWindow(); HWND ShellW = GetDefaultShellWindow();
if (!ShellW) return NULL; // Default Shell (Explorer) not running if (!ShellW) return nullptr; // Default Shell (Explorer) not running
if (c_DefView && IsWindow(c_DefView)) if (c_DefView && IsWindow(c_DefView))
{ {
@ -589,7 +589,7 @@ HWND System::GetWorkerW()
{ {
if (parent == ShellW) if (parent == ShellW)
{ {
return NULL; return nullptr;
} }
else else
{ {
@ -604,14 +604,14 @@ HWND System::GetWorkerW()
} }
} }
HWND WorkerW = NULL, DefView = FindWindowEx(ShellW, NULL, L"SHELLDLL_DefView", L""); HWND WorkerW = nullptr, DefView = FindWindowEx(ShellW, nullptr, L"SHELLDLL_DefView", L"");
if (DefView == NULL) if (DefView == nullptr)
{ {
while (WorkerW = FindWindowEx(NULL, WorkerW, L"WorkerW", L"")) while (WorkerW = FindWindowEx(nullptr, WorkerW, L"WorkerW", L""))
{ {
if (IsWindowVisible(WorkerW) && if (IsWindowVisible(WorkerW) &&
BelongToSameProcess(ShellW, WorkerW) && BelongToSameProcess(ShellW, WorkerW) &&
(DefView = FindWindowEx(WorkerW, NULL, L"SHELLDLL_DefView", L""))) (DefView = FindWindowEx(WorkerW, nullptr, L"SHELLDLL_DefView", L"")))
{ {
break; break;
} }
@ -756,7 +756,7 @@ void System::ChangeZPosInOrder()
LogDebug(L"2: ----- AFTER -----"); LogDebug(L"2: ----- AFTER -----");
// Log all windows in Z-order // Log all windows in Z-order
EnumWindows(MyEnumWindowsProc, (LPARAM)NULL); EnumWindows(MyEnumWindowsProc, (LPARAM)nullptr);
} }
} }
@ -836,11 +836,11 @@ void System::PrepareHelperWindow(HWND WorkerW)
*/ */
bool System::CheckDesktopState(HWND WorkerW) bool System::CheckDesktopState(HWND WorkerW)
{ {
HWND hwnd = NULL; HWND hwnd = nullptr;
if (WorkerW && IsWindowVisible(WorkerW)) if (WorkerW && IsWindowVisible(WorkerW))
{ {
hwnd = FindWindowEx(NULL, WorkerW, L"RainmeterSystem", L"System"); hwnd = FindWindowEx(nullptr, WorkerW, L"RainmeterSystem", L"System");
} }
bool stateChanged = (hwnd && !c_ShowDesktop) || (!hwnd && c_ShowDesktop); bool stateChanged = (hwnd && !c_ShowDesktop) || (!hwnd && c_ShowDesktop);
@ -861,11 +861,11 @@ bool System::CheckDesktopState(HWND WorkerW)
if (c_ShowDesktop) if (c_ShowDesktop)
{ {
SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_RESTOREWINDOWS, NULL); SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_RESTOREWINDOWS, nullptr);
} }
else else
{ {
SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL); SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, nullptr);
} }
} }
@ -890,7 +890,7 @@ void CALLBACK System::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, H
{ {
const int max = 5; const int max = 5;
int loop = 0; int loop = 0;
while (loop < max && FindWindowEx(hwnd, NULL, L"SHELLDLL_DefView", L"") == NULL) while (loop < max && FindWindowEx(hwnd, nullptr, L"SHELLDLL_DefView", L"") == nullptr)
{ {
Sleep(2); // Wait for 2-16 ms before retrying Sleep(2); // Wait for 2-16 ms before retrying
++loop; ++loop;
@ -983,7 +983,7 @@ LRESULT CALLBACK System::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (wParam == PBT_APMRESUMESUSPEND) if (wParam == PBT_APMRESUMESUSPEND)
{ {
// Deliver PBT_APMRESUMESUSPEND event to all meter windows // Deliver PBT_APMRESUMESUSPEND event to all meter windows
SetTimer(hWnd, TIMER_RESUME, INTERVAL_RESUME, NULL); SetTimer(hWnd, TIMER_RESUME, INTERVAL_RESUME, nullptr);
} }
return TRUE; return TRUE;
@ -1035,7 +1035,7 @@ POINT System::GetCursorPosition()
*/ */
bool System::IsFileWritable(LPCWSTR file) bool System::IsFileWritable(LPCWSTR file)
{ {
HANDLE hFile = CreateFile(file, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); HANDLE hFile = CreateFile(file, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
return false; return false;
@ -1111,7 +1111,7 @@ void System::InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
*/ */
void System::SetClipboardText(const std::wstring& text) void System::SetClipboardText(const std::wstring& text)
{ {
if (OpenClipboard(NULL)) if (OpenClipboard(nullptr))
{ {
// Include terminating null char // Include terminating null char
size_t len = text.length() + 1; size_t len = text.length() + 1;
@ -1161,7 +1161,7 @@ void System::SetWallpaper(const std::wstring& wallpaper, const std::wstring& sty
HKEY hKey; HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Control Panel\\Desktop", 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS) if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Control Panel\\Desktop", 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
{ {
const WCHAR* wallStyle = NULL; const WCHAR* wallStyle = nullptr;
const WCHAR* wallTile = L"0"; const WCHAR* wallTile = L"0";
const WCHAR* option = style.c_str(); const WCHAR* option = style.c_str();
@ -1229,7 +1229,7 @@ bool System::CopyFiles(std::wstring from, std::wstring to, bool bMove)
SHFILEOPSTRUCT fo = SHFILEOPSTRUCT fo =
{ {
NULL, nullptr,
bMove ? FO_MOVE : FO_COPY, bMove ? FO_MOVE : FO_COPY,
from.c_str(), from.c_str(),
to.c_str(), to.c_str(),
@ -1272,10 +1272,10 @@ bool System::RemoveFolder(std::wstring folder)
SHFILEOPSTRUCT fo = SHFILEOPSTRUCT fo =
{ {
NULL, nullptr,
FO_DELETE, FO_DELETE,
folder.c_str(), folder.c_str(),
NULL, nullptr,
FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO
}; };
@ -1304,7 +1304,7 @@ void System::UpdateIniFileMappingList()
ULONGLONG ftLastWriteTime; ULONGLONG ftLastWriteTime;
bool changed = false; bool changed = false;
ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, &numSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, (LPFILETIME)&ftLastWriteTime); ret = RegQueryInfoKey(hKey, nullptr, nullptr, nullptr, &numSubKeys, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, (LPFILETIME)&ftLastWriteTime);
if (ret == ERROR_SUCCESS) if (ret == ERROR_SUCCESS)
{ {
//LogDebugF(L"IniFileMapping: numSubKeys=%u, ftLastWriteTime=%llu", numSubKeys, ftLastWriteTime); //LogDebugF(L"IniFileMapping: numSubKeys=%u, ftLastWriteTime=%llu", numSubKeys, ftLastWriteTime);
@ -1336,7 +1336,7 @@ void System::UpdateIniFileMappingList()
WCHAR* buffer = new WCHAR[MAX_PATH]; WCHAR* buffer = new WCHAR[MAX_PATH];
DWORD index = 0, cch = MAX_PATH; DWORD index = 0, cch = MAX_PATH;
while ((ret = RegEnumKeyEx(hKey, index++, buffer, &cch, NULL, NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS) while ((ret = RegEnumKeyEx(hKey, index++, buffer, &cch, nullptr, nullptr, nullptr, nullptr)) != ERROR_NO_MORE_ITEMS)
{ {
if (ret == ERROR_SUCCESS) if (ret == ERROR_SUCCESS)
{ {

View File

@ -69,7 +69,7 @@ public:
static bool IsFileWritable(LPCWSTR file); static bool IsFileWritable(LPCWSTR file);
static HMODULE RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError = NULL); static HMODULE RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError = nullptr);
static void ResetWorkingDirectory(); static void ResetWorkingDirectory();
static void InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection); static void InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection);

View File

@ -57,7 +57,7 @@ public:
{ {
return (*iter).second->GetCache(); return (*iter).second->GetCache();
} }
return NULL; return nullptr;
} }
static void AddCache(const std::wstring& key, Bitmap* bitmap, HGLOBAL hBuffer) static void AddCache(const std::wstring& key, Bitmap* bitmap, HGLOBAL hBuffer)
@ -111,7 +111,7 @@ private:
ImageCache() {} ImageCache() {}
ImageCache(const ImageCache& cache) {} ImageCache(const ImageCache& cache) {}
void Dispose() { delete m_Bitmap; m_Bitmap = NULL; if (m_hBuffer) { ::GlobalFree(m_hBuffer); m_hBuffer = NULL; } } void Dispose() { delete m_Bitmap; m_Bitmap = nullptr; if (m_hBuffer) { ::GlobalFree(m_hBuffer); m_hBuffer = nullptr; } }
Bitmap* m_Bitmap; Bitmap* m_Bitmap;
HGLOBAL m_hBuffer; HGLOBAL m_hBuffer;
@ -187,9 +187,9 @@ TintedImage::~TintedImage()
void TintedImage::DisposeImage() void TintedImage::DisposeImage()
{ {
delete m_BitmapTint; delete m_BitmapTint;
m_BitmapTint = NULL; m_BitmapTint = nullptr;
m_Bitmap = NULL; m_Bitmap = nullptr;
if (!m_CacheKey.empty()) if (!m_CacheKey.empty())
{ {
@ -211,10 +211,10 @@ Bitmap* TintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize,
if (pBuffer) if (pBuffer)
{ {
DWORD readBytes; DWORD readBytes;
ReadFile(fileHandle, pBuffer, fileSize, &readBytes, NULL); ReadFile(fileHandle, pBuffer, fileSize, &readBytes, nullptr);
::GlobalUnlock(hBuffer); ::GlobalUnlock(hBuffer);
IStream* pStream = NULL; IStream* pStream = nullptr;
if (::CreateStreamOnHGlobal(hBuffer, FALSE, &pStream) == S_OK) if (::CreateStreamOnHGlobal(hBuffer, FALSE, &pStream) == S_OK)
{ {
Bitmap* bitmap = Bitmap::FromStream(pStream); Bitmap* bitmap = Bitmap::FromStream(pStream);
@ -288,7 +288,7 @@ Bitmap* TintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize,
bitmap = clone; bitmap = clone;
::GlobalFree(hBuffer); ::GlobalFree(hBuffer);
hBuffer = NULL; hBuffer = nullptr;
//////////////////////////////////////////// ////////////////////////////////////////////
} }
*phBuffer = hBuffer; *phBuffer = hBuffer;
@ -302,8 +302,8 @@ Bitmap* TintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize,
::GlobalFree(hBuffer); ::GlobalFree(hBuffer);
} }
*phBuffer = NULL; *phBuffer = nullptr;
return NULL; return nullptr;
} }
/* /*
@ -326,12 +326,12 @@ void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
// Read the bitmap to memory so that it's not locked by GDI+ // Read the bitmap to memory so that it's not locked by GDI+
DWORD fileSize; DWORD fileSize;
HANDLE fileHandle = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); HANDLE fileHandle = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
if (fileHandle != INVALID_HANDLE_VALUE && (fileSize = GetFileSize(fileHandle, NULL)) != INVALID_FILE_SIZE) if (fileHandle != INVALID_HANDLE_VALUE && (fileSize = GetFileSize(fileHandle, nullptr)) != INVALID_FILE_SIZE)
{ {
// Compare the filename/timestamp/filesize to check if the file has been changed (don't load if it's not) // Compare the filename/timestamp/filesize to check if the file has been changed (don't load if it's not)
ULONGLONG fileTime; ULONGLONG fileTime;
GetFileTime(fileHandle, NULL, NULL, (LPFILETIME)&fileTime); GetFileTime(fileHandle, nullptr, nullptr, (LPFILETIME)&fileTime);
std::wstring key = ImageCachePool::CreateKey(filename, fileTime, fileSize, m_UseExifOrientation ? L"EXIF" : L"NONE"); std::wstring key = ImageCachePool::CreateKey(filename, fileTime, fileSize, m_UseExifOrientation ? L"EXIF" : L"NONE");
if (bLoadAlways || wcscmp(key.c_str(), m_CacheKey.c_str()) != 0) if (bLoadAlways || wcscmp(key.c_str(), m_CacheKey.c_str()) != 0)
@ -339,7 +339,7 @@ void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
DisposeImage(); DisposeImage();
Bitmap* bitmap = ImageCachePool::GetCache(key); Bitmap* bitmap = ImageCachePool::GetCache(key);
HGLOBAL hBuffer = NULL; HGLOBAL hBuffer = nullptr;
m_Bitmap = (bitmap) ? m_Bitmap = (bitmap) ?
bitmap : bitmap :
@ -386,7 +386,7 @@ void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
if (m_NeedsCrop || m_NeedsTinting || m_NeedsTransform) if (m_NeedsCrop || m_NeedsTinting || m_NeedsTransform)
{ {
delete m_BitmapTint; delete m_BitmapTint;
m_BitmapTint = NULL; m_BitmapTint = nullptr;
if (m_Bitmap->GetWidth() > 0 && m_Bitmap->GetHeight() > 0) if (m_Bitmap->GetWidth() > 0 && m_Bitmap->GetHeight() > 0)
{ {
@ -643,22 +643,22 @@ void TintedImage::ReadOptions(ConfigParser& parser, const WCHAR* section)
{ {
m_Crop.X = parser.ParseInt(token, 0); m_Crop.X = parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
m_Crop.Y = parser.ParseInt(token, 0); m_Crop.Y = parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
m_Crop.Width = parser.ParseInt(token, 0); m_Crop.Width = parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
m_Crop.Height = parser.ParseInt(token, 0); m_Crop.Height = parser.ParseInt(token, 0);
token = wcstok(NULL, L","); token = wcstok(nullptr, L",");
if (token) if (token)
{ {
m_CropMode = (CROPMODE)parser.ParseInt(token, 0); m_CropMode = (CROPMODE)parser.ParseInt(token, 0);

View File

@ -71,8 +71,8 @@ public:
void ReadOptions(ConfigParser& parser, const WCHAR* section); void ReadOptions(ConfigParser& parser, const WCHAR* section);
bool IsLoaded() { return (m_Bitmap != NULL); } bool IsLoaded() { return (m_Bitmap != nullptr); }
bool IsTinted() { return (m_BitmapTint != NULL); } bool IsTinted() { return (m_BitmapTint != nullptr); }
bool IsOptionsChanged() { return m_NeedsCrop || m_NeedsTinting || m_NeedsTransform; } bool IsOptionsChanged() { return m_NeedsCrop || m_NeedsTinting || m_NeedsTransform; }
void ClearOptionFlags() { m_NeedsCrop = m_NeedsTinting = m_NeedsTransform = false; } void ClearOptionFlags() { m_NeedsCrop = m_NeedsTinting = m_NeedsTransform = false; }

View File

@ -98,14 +98,14 @@ void TrayWindow::Initialize()
m_Window = CreateWindowEx( m_Window = CreateWindowEx(
WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW,
L"RainmeterTrayClass", L"RainmeterTrayClass",
NULL, nullptr,
WS_POPUP | WS_DISABLED, WS_POPUP | WS_DISABLED,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, nullptr,
NULL, nullptr,
wc.hInstance, wc.hInstance,
this); this);
@ -145,14 +145,14 @@ void TrayWindow::TryAddTrayIcon()
if (m_Icon) if (m_Icon)
{ {
DestroyIcon(m_Icon); DestroyIcon(m_Icon);
m_Icon = NULL; m_Icon = nullptr;
} }
m_Icon = CreateTrayIcon(0); m_Icon = CreateTrayIcon(0);
if (!AddTrayIcon()) if (!AddTrayIcon())
{ {
SetTimer(m_Window, TIMER_ADDTRAYICON, INTERVAL_ADDTRAYICON, NULL); SetTimer(m_Window, TIMER_ADDTRAYICON, INTERVAL_ADDTRAYICON, nullptr);
} }
} }
@ -176,7 +176,7 @@ void TrayWindow::RemoveTrayIcon()
if (m_Icon) if (m_Icon)
{ {
DestroyIcon(m_Icon); DestroyIcon(m_Icon);
m_Icon = NULL; m_Icon = nullptr;
} }
} }
@ -185,7 +185,7 @@ void TrayWindow::ModifyTrayIcon(double value)
if (m_Icon) if (m_Icon)
{ {
DestroyIcon(m_Icon); DestroyIcon(m_Icon);
m_Icon = NULL; m_Icon = nullptr;
} }
m_Icon = CreateTrayIcon(value); m_Icon = CreateTrayIcon(value);
@ -201,7 +201,7 @@ void TrayWindow::ModifyTrayIcon(double value)
HICON TrayWindow::CreateTrayIcon(double value) HICON TrayWindow::CreateTrayIcon(double value)
{ {
if (m_Measure != NULL) if (m_Measure != nullptr)
{ {
if (m_MeterType == TRAY_METER_TYPE_HISTOGRAM) if (m_MeterType == TRAY_METER_TYPE_HISTOGRAM)
{ {
@ -230,7 +230,7 @@ HICON TrayWindow::CreateTrayIcon(double value)
SolidBrush brush2(m_Color2); SolidBrush brush2(m_Color2);
graphics.FillPolygon(&brush2, points, TRAYICON_SIZE + 2); graphics.FillPolygon(&brush2, points, TRAYICON_SIZE + 2);
HICON icon = NULL; HICON icon = nullptr;
trayBitmap.GetHICON(&icon); trayBitmap.GetHICON(&icon);
return icon; return icon;
} }
@ -285,7 +285,7 @@ HICON TrayWindow::CreateTrayIcon(double value)
Rect r(0, 0, TRAYICON_SIZE, TRAYICON_SIZE); Rect r(0, 0, TRAYICON_SIZE, TRAYICON_SIZE);
graphics.DrawImage(m_Bitmap, r, newX, newY, TRAYICON_SIZE, TRAYICON_SIZE, UnitPixel); graphics.DrawImage(m_Bitmap, r, newX, newY, TRAYICON_SIZE, TRAYICON_SIZE, UnitPixel);
HICON icon = NULL; HICON icon = nullptr;
trayBitmap.GetHICON(&icon); trayBitmap.GetHICON(&icon);
return icon; return icon;
} }
@ -340,7 +340,7 @@ void TrayWindow::SetTrayIcon(bool enabled)
// Save to Rainmeter.ini. // Save to Rainmeter.ini.
const std::wstring& iniFile = g_Rainmeter->GetIniFile(); const std::wstring& iniFile = g_Rainmeter->GetIniFile();
WritePrivateProfileString(L"Rainmeter", L"TrayIcon", enabled ? NULL : L"0", iniFile.c_str()); WritePrivateProfileString(L"Rainmeter", L"TrayIcon", enabled ? nullptr : L"0", iniFile.c_str());
} }
void TrayWindow::ReadOptions(ConfigParser& parser) void TrayWindow::ReadOptions(ConfigParser& parser)
@ -350,10 +350,10 @@ void TrayWindow::ReadOptions(ConfigParser& parser)
KillTimer(m_Window, TIMER_TRAYMEASURE); KillTimer(m_Window, TIMER_TRAYMEASURE);
delete m_Measure; delete m_Measure;
m_Measure = NULL; m_Measure = nullptr;
delete m_Bitmap; delete m_Bitmap;
m_Bitmap = NULL; m_Bitmap = nullptr;
std::vector<HICON>::const_iterator iter = m_Icons.begin(); std::vector<HICON>::const_iterator iter = m_Icons.begin();
for ( ; iter != m_Icons.end(); ++iter) for ( ; iter != m_Icons.end(); ++iter)
@ -375,7 +375,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser)
ConfigParser* oldParser = g_Rainmeter->GetCurrentParser(); ConfigParser* oldParser = g_Rainmeter->GetCurrentParser();
g_Rainmeter->SetCurrentParser(&parser); g_Rainmeter->SetCurrentParser(&parser);
m_Measure = Measure::Create(measureName.c_str(), NULL, L"TrayMeasure"); m_Measure = Measure::Create(measureName.c_str(), nullptr, L"TrayMeasure");
if (m_Measure) if (m_Measure)
{ {
m_Measure->ReadOptions(parser); m_Measure->ReadOptions(parser);
@ -409,7 +409,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser)
if (_wcsicmp(imagePath + (imageName.size() - 4), L".ico") == 0) if (_wcsicmp(imagePath + (imageName.size() - 4), L".ico") == 0)
{ {
int count = 1; int count = 1;
HICON hIcon = NULL; HICON hIcon = nullptr;
// Load the icons // Load the icons
do do
@ -417,11 +417,11 @@ void TrayWindow::ReadOptions(ConfigParser& parser)
WCHAR buffer[MAX_PATH]; WCHAR buffer[MAX_PATH];
_snwprintf_s(buffer, _TRUNCATE, imagePath, count++); _snwprintf_s(buffer, _TRUNCATE, imagePath, count++);
hIcon = (HICON)LoadImage(NULL, buffer, IMAGE_ICON, TRAYICON_SIZE, TRAYICON_SIZE, LR_LOADFROMFILE); hIcon = (HICON)LoadImage(nullptr, buffer, IMAGE_ICON, TRAYICON_SIZE, TRAYICON_SIZE, LR_LOADFROMFILE);
if (hIcon) m_Icons.push_back(hIcon); if (hIcon) m_Icons.push_back(hIcon);
if (wcscmp(imagePath, buffer) == 0) break; if (wcscmp(imagePath, buffer) == 0) break;
} }
while(hIcon != NULL); while(hIcon != nullptr);
} }
if (m_Icons.empty()) if (m_Icons.empty())
@ -433,7 +433,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser)
if (Ok != status) if (Ok != status)
{ {
delete m_Bitmap; delete m_Bitmap;
m_Bitmap = NULL; m_Bitmap = nullptr;
LogWarningF(L"Bitmap image not found: %s", imagePath); LogWarningF(L"Bitmap image not found: %s", imagePath);
} }
} }
@ -448,7 +448,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser)
if (m_Measure) if (m_Measure)
{ {
SetTimer(m_Window, TIMER_TRAYMEASURE, INTERVAL_TRAYMEASURE, NULL); // Update the tray once per sec SetTimer(m_Window, TIMER_TRAYMEASURE, INTERVAL_TRAYMEASURE, nullptr); // Update the tray once per sec
} }
} }
else else
@ -483,7 +483,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
break; break;
case IDM_REFRESH: case IDM_REFRESH:
PostMessage(g_Rainmeter->GetWindow(), WM_RAINMETER_DELAYED_REFRESH_ALL, (WPARAM)NULL, (LPARAM)NULL); PostMessage(g_Rainmeter->GetWindow(), WM_RAINMETER_DELAYED_REFRESH_ALL, (WPARAM)nullptr, (LPARAM)nullptr);
break; break;
case IDM_SHOWLOGFILE: case IDM_SHOWLOGFILE:
@ -559,7 +559,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
if (index < 0) if (index < 0)
{ {
MeterWindow* meterWindow = (*iter).second; MeterWindow* meterWindow = (*iter).second;
SendMessage(meterWindow->GetWindow(), WM_COMMAND, mID, NULL); SendMessage(meterWindow->GetWindow(), WM_COMMAND, mID, 0);
break; break;
} }
} }
@ -602,7 +602,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
if (*bang && if (*bang &&
!IsCtrlKeyDown()) // Ctrl is pressed, so only run default action !IsCtrlKeyDown()) // Ctrl is pressed, so only run default action
{ {
g_Rainmeter->ExecuteCommand(bang, NULL); g_Rainmeter->ExecuteCommand(bang, nullptr);
tray->m_TrayContextMenuEnabled = (uMouseMsg != WM_RBUTTONDOWN); tray->m_TrayContextMenuEnabled = (uMouseMsg != WM_RBUTTONDOWN);
break; break;
} }
@ -618,7 +618,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
if (tray->m_TrayContextMenuEnabled) if (tray->m_TrayContextMenuEnabled)
{ {
POINT pos = System::GetCursorPosition(); POINT pos = System::GetCursorPosition();
g_Rainmeter->ShowContextMenu(pos, NULL); g_Rainmeter->ShowContextMenu(pos, nullptr);
} }
break; break;
@ -702,7 +702,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
{ {
LPCWSTR folderPath = (LPCWSTR)cds->lpData; LPCWSTR folderPath = (LPCWSTR)cds->lpData;
MeterWindow* mw = g_Rainmeter->GetMeterWindow(folderPath); MeterWindow* mw = g_Rainmeter->GetMeterWindow(folderPath);
return (mw) ? (LRESULT)mw->GetWindow() : NULL; return (mw) ? (LRESULT)mw->GetWindow() : 0;
} }
} }
return 1; return 1;

View File

@ -29,16 +29,17 @@ void CheckVersion(void* dummy)
HINTERNET hRootHandle = InternetOpen( HINTERNET hRootHandle = InternetOpen(
L"Rainmeter", L"Rainmeter",
INTERNET_OPEN_TYPE_PRECONFIG, INTERNET_OPEN_TYPE_PRECONFIG,
NULL, nullptr,
NULL, nullptr,
0); 0);
if (hRootHandle == NULL) if (hRootHandle == nullptr)
{ {
return; return;
} }
HINTERNET hUrlDump = InternetOpenUrl(hRootHandle, L"http://rainmeter.github.io/rainmeter/release", NULL, NULL, INTERNET_FLAG_RESYNCHRONIZE, 0); HINTERNET hUrlDump = InternetOpenUrl(
hRootHandle, L"http://rainmeter.github.io/rainmeter/release", nullptr, 0, INTERNET_FLAG_RESYNCHRONIZE, 0);
if (hUrlDump) if (hUrlDump)
{ {
DWORD dwSize; DWORD dwSize;
@ -94,5 +95,5 @@ void CheckVersion(void* dummy)
void CheckUpdate() void CheckUpdate()
{ {
_beginthread(CheckVersion, 0, NULL); _beginthread(CheckVersion, 0, nullptr);
} }

View File

@ -26,7 +26,7 @@ lua_State* LuaManager::c_State = 0;
void LuaManager::Initialize() void LuaManager::Initialize()
{ {
if (c_State == NULL) if (c_State == nullptr)
{ {
// Initialize Lua // Initialize Lua
c_State = luaL_newstate(); c_State = luaL_newstate();
@ -50,10 +50,10 @@ void LuaManager::Finalize()
--c_RefCount; --c_RefCount;
} }
if (c_RefCount == 0 && c_State != NULL) if (c_RefCount == 0 && c_State != nullptr)
{ {
lua_close(c_State); lua_close(c_State);
c_State = NULL; c_State = nullptr;
} }
} }

View File

@ -60,7 +60,7 @@ bool LuaScript::Initialize(const std::wstring& scriptFile)
fread(fileData, fileSize, 1, file); fread(fileData, fileSize, 1, file);
fclose(file); fclose(file);
file = NULL; file = nullptr;
int load = luaL_loadbuffer(L, fileData, fileSize, ""); int load = luaL_loadbuffer(L, fileData, fileSize, "");
delete [] fileData; delete [] fileData;
@ -209,7 +209,7 @@ int LuaScript::RunFunctionWithReturn(const char* funcName, double& numValue, std
size_t strLen = 0; size_t strLen = 0;
const char* str = lua_tolstring(L, -1, &strLen); const char* str = lua_tolstring(L, -1, &strLen);
strValue = StringUtil::Widen(str, (int)strLen); strValue = StringUtil::Widen(str, (int)strLen);
numValue = strtod(str, NULL); numValue = strtod(str, nullptr);
} }
lua_pop(L, 2); lua_pop(L, 2);

View File

@ -37,7 +37,7 @@ static int Print(lua_State* L)
// Get result // Get result
const char* s = lua_tostring(L, -1); const char* s = lua_tostring(L, -1);
if (s == NULL) if (s == nullptr)
{ {
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("print")); return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("print"));
} }
@ -73,7 +73,7 @@ void LuaManager::RegisterGlobal(lua_State* L)
const luaL_Reg toluaFuncs[] = const luaL_Reg toluaFuncs[] =
{ {
{ "cast", tolua_cast }, { "cast", tolua_cast },
{ NULL, NULL } { nullptr, nullptr }
}; };
luaL_register(L, "tolua", toluaFuncs); luaL_register(L, "tolua", toluaFuncs);

View File

@ -147,7 +147,7 @@ void LuaManager::RegisterMeasure(lua_State* L)
{ "GetMinValue", GetMinValue }, { "GetMinValue", GetMinValue },
{ "GetMaxValue", GetMaxValue }, { "GetMaxValue", GetMaxValue },
{ "GetStringValue", GetStringValue }, { "GetStringValue", GetStringValue },
{ NULL, NULL } { nullptr, nullptr }
}; };
luaL_register(L, "Measure", functions); luaL_register(L, "Measure", functions);

View File

@ -164,7 +164,7 @@ void LuaManager::RegisterMeter(lua_State* L)
{ "Hide", Hide }, { "Hide", Hide },
{ "Show", Show }, { "Show", Show },
{ "SetText", SetText }, { "SetText", SetText },
{ NULL, NULL } { nullptr, nullptr }
}; };
luaL_register(L, "Meter", functions); luaL_register(L, "Meter", functions);

View File

@ -228,7 +228,7 @@ void LuaManager::RegisterMeterWindow(lua_State* L)
{ "GetX", GetX }, { "GetX", GetX },
{ "GetY", GetY }, { "GetY", GetY },
{ "MakePathAbsolute", MakePathAbsolute }, { "MakePathAbsolute", MakePathAbsolute },
{ NULL, NULL } { nullptr, nullptr }
}; };
luaL_register(L, "MeterWindow", functions); luaL_register(L, "MeterWindow", functions);

View File

@ -61,10 +61,10 @@ void UpdateProcesses();
void SplitName(WCHAR* names, std::vector<RawString>& splittedNames) void SplitName(WCHAR* names, std::vector<RawString>& splittedNames)
{ {
WCHAR* token = wcstok(names, L";"); WCHAR* token = wcstok(names, L";");
while (token != NULL) while (token != nullptr)
{ {
splittedNames.push_back(token); splittedNames.push_back(token);
token = wcstok(NULL, L";"); token = wcstok(nullptr, L";");
} }
} }
@ -216,7 +216,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
return measure->topProcessName.c_str(); return measure->topProcessName.c_str();
} }
return NULL; return nullptr;
} }
PLUGIN_EXPORT void Finalize(void* data) PLUGIN_EXPORT void Finalize(void* data)
@ -248,7 +248,7 @@ void UpdateProcesses()
if (pPerfObj) if (pPerfObj)
{ {
for (CPerfObjectInstance* pObjInst = pPerfObj->GetFirstObjectInstance(); for (CPerfObjectInstance* pObjInst = pPerfObj->GetFirstObjectInstance();
pObjInst != NULL; pObjInst != nullptr;
pObjInst = pPerfObj->GetNextObjectInstance()) pObjInst = pPerfObj->GetNextObjectInstance())
{ {
if (pObjInst->GetObjectInstanceName(name, 256)) if (pObjInst->GetObjectInstanceName(name, 256))
@ -260,9 +260,9 @@ void UpdateProcesses()
} }
CPerfCounter* pPerfCntr = pObjInst->GetCounterByName(L"% Processor Time"); CPerfCounter* pPerfCntr = pObjInst->GetCounterByName(L"% Processor Time");
if (pPerfCntr != NULL) if (pPerfCntr != nullptr)
{ {
pPerfCntr->GetData(data, 256, NULL); pPerfCntr->GetData(data, 256, nullptr);
if (pPerfCntr->GetSize() == 8) if (pPerfCntr->GetSize() == 8)
{ {

View File

@ -91,7 +91,7 @@ LPCWSTR CoreTempProxy::GetErrorMessage()
} }
else else
{ {
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, lastError, 0, this->m_ErrorMessage, 99, NULL); ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, lastError, 0, this->m_ErrorMessage, 99, nullptr);
} }
return this->m_ErrorMessage; return this->m_ErrorMessage;

View File

@ -130,7 +130,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
break; break;
default: default:
return NULL; return nullptr;
} }
return buffer; return buffer;

View File

@ -16,8 +16,8 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData)
HANDLE hdlMemory; HANDLE hdlMemory;
HANDLE hdlMutex; HANDLE hdlMutex;
hdlMutex = CreateMutex(NULL,FALSE,CORE_TEMP_MUTEX_OBJECT); hdlMutex = CreateMutex(nullptr,FALSE,CORE_TEMP_MUTEX_OBJECT);
if (hdlMutex == NULL) if (hdlMutex == nullptr)
{ {
return false; return false;
} }
@ -29,7 +29,7 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData)
TRUE, TRUE,
CORE_TEMP_MAPPING_OBJECT); // "CoreTempMappingObject" CORE_TEMP_MAPPING_OBJECT); // "CoreTempMappingObject"
if (hdlMemory == NULL) if (hdlMemory == nullptr)
{ {
ReleaseMutex(hdlMutex); ReleaseMutex(hdlMutex);
CloseHandle(hdlMutex); CloseHandle(hdlMutex);
@ -37,10 +37,10 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData)
} }
pSharedData = (PCORE_TEMP_SHARED_DATA)MapViewOfFile(hdlMemory, FILE_MAP_READ, 0, 0, 0); pSharedData = (PCORE_TEMP_SHARED_DATA)MapViewOfFile(hdlMemory, FILE_MAP_READ, 0, 0, 0);
if (pSharedData == NULL) if (pSharedData == nullptr)
{ {
CloseHandle(hdlMemory); CloseHandle(hdlMemory);
hdlMemory = NULL; hdlMemory = nullptr;
ReleaseMutex(hdlMutex); ReleaseMutex(hdlMutex);
CloseHandle(hdlMutex); CloseHandle(hdlMutex);
return false; return false;

View File

@ -68,7 +68,7 @@ void CFolderInfo::FreePcre()
if (m_RegExpFilter) if (m_RegExpFilter)
{ {
pcre_free(m_RegExpFilter); pcre_free(m_RegExpFilter);
m_RegExpFilter = NULL; m_RegExpFilter = nullptr;
} }
} }
@ -131,8 +131,8 @@ void CFolderInfo::CalculateSize()
} }
else if (!isFolder && m_RegExpFilter) else if (!isFolder && m_RegExpFilter)
{ {
int utf8BufLen = WideCharToMultiByte(CP_UTF8, 0, findData.cFileName, wcslen(findData.cFileName) + 1, utf8Buf, MAX_PATH * 3, NULL, NULL); int utf8BufLen = WideCharToMultiByte(CP_UTF8, 0, findData.cFileName, wcslen(findData.cFileName) + 1, utf8Buf, MAX_PATH * 3, nullptr, nullptr);
if (0 != pcre_exec(m_RegExpFilter, NULL, utf8Buf, utf8BufLen, 0, 0, NULL, 0)) if (0 != pcre_exec(m_RegExpFilter, nullptr, utf8Buf, utf8BufLen, 0, 0, nullptr, 0))
{ {
continue; continue;
} }
@ -178,14 +178,14 @@ void CFolderInfo::SetRegExpFilter(LPCWSTR filter)
if (*filter) if (*filter)
{ {
int filterLen = wcslen(filter) + 1; int filterLen = wcslen(filter) + 1;
int bufLen = WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, NULL, 0, NULL, NULL); int bufLen = WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, nullptr, 0, nullptr, nullptr);
char* buf = new char[bufLen]; char* buf = new char[bufLen];
WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, buf, bufLen, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, buf, bufLen, nullptr, nullptr);
const char* error; const char* error;
int erroffset; int erroffset;
m_RegExpFilter = pcre_compile(buf, PCRE_UTF8, &error, &erroffset, NULL); m_RegExpFilter = pcre_compile(buf, PCRE_UTF8, &error, &erroffset, nullptr);
delete [] buf; delete [] buf;
} }

View File

@ -19,7 +19,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "Internet.h" #include "Internet.h"
HINTERNET Internet::c_NetHandle = NULL; HINTERNET Internet::c_NetHandle = nullptr;
/* /*
** Initialize internet handle and crtical section. ** Initialize internet handle and crtical section.
@ -29,8 +29,8 @@ void Internet::Initialize()
{ {
c_NetHandle = InternetOpen(L"Rainmeter NowPlaying.dll", c_NetHandle = InternetOpen(L"Rainmeter NowPlaying.dll",
INTERNET_OPEN_TYPE_PRECONFIG, INTERNET_OPEN_TYPE_PRECONFIG,
NULL, nullptr,
NULL, nullptr,
0); 0);
if (!c_NetHandle) if (!c_NetHandle)
@ -57,7 +57,7 @@ std::wstring Internet::DownloadUrl(const std::wstring& url, int codepage)
// From WebParser.cpp // From WebParser.cpp
std::wstring result; std::wstring result;
DWORD flags = INTERNET_FLAG_RESYNCHRONIZE; DWORD flags = INTERNET_FLAG_RESYNCHRONIZE;
HINTERNET hUrlDump = InternetOpenUrl(c_NetHandle, url.c_str(), NULL, NULL, flags, 0); HINTERNET hUrlDump = InternetOpenUrl(c_NetHandle, url.c_str(), nullptr, 0, flags, 0);
if (!hUrlDump) if (!hUrlDump)
{ {
@ -68,7 +68,7 @@ std::wstring Internet::DownloadUrl(const std::wstring& url, int codepage)
const int CHUNK_SIZE = 8192; const int CHUNK_SIZE = 8192;
BYTE* lpData = new BYTE[CHUNK_SIZE]; BYTE* lpData = new BYTE[CHUNK_SIZE];
BYTE* lpOutPut; BYTE* lpOutPut;
BYTE* lpHolding = NULL; BYTE* lpHolding = nullptr;
int nCounter = 1; int nCounter = 1;
int nBufferSize; int nBufferSize;
DWORD dwDataSize = 0; DWORD dwDataSize = 0;
@ -98,7 +98,7 @@ std::wstring Internet::DownloadUrl(const std::wstring& url, int codepage)
lpOutPut = new BYTE[nBufferSize + 2]; lpOutPut = new BYTE[nBufferSize + 2];
// Make sure the buffer is not the initial buffer. // Make sure the buffer is not the initial buffer.
if (lpHolding != NULL) if (lpHolding != nullptr)
{ {
// Copy the data in the holding buffer. // Copy the data in the holding buffer.
memcpy(lpOutPut, lpHolding, dwDataSize); memcpy(lpOutPut, lpHolding, dwDataSize);
@ -223,10 +223,10 @@ void Internet::DecodeReferences(std::wstring& str)
} }
std::wstring num(str, pos, end - pos); std::wstring num(str, pos, end - pos);
WCHAR* pch = NULL; WCHAR* pch = nullptr;
errno = 0; errno = 0;
long ch = wcstol(num.c_str(), &pch, base); long ch = wcstol(num.c_str(), &pch, base);
if (pch == NULL || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character if (pch == nullptr || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character
{ {
start = pos; start = pos;
continue; continue;
@ -253,7 +253,7 @@ std::wstring Internet::ConvertToWide(LPCSTR str, int codepage)
if (str && *str) if (str && *str)
{ {
int strLen = (int)strlen(str); int strLen = (int)strlen(str);
int bufLen = MultiByteToWideChar(codepage, 0, str, strLen, NULL, 0); int bufLen = MultiByteToWideChar(codepage, 0, str, strLen, nullptr, 0);
if (bufLen > 0) if (bufLen > 0)
{ {
szWide.resize(bufLen); szWide.resize(bufLen);

View File

@ -29,7 +29,7 @@
static std::vector<ParentMeasure*> g_ParentMeasures; static std::vector<ParentMeasure*> g_ParentMeasures;
bool g_Initialized = false; bool g_Initialized = false;
HINSTANCE g_Instance = NULL; HINSTANCE g_Instance = nullptr;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
@ -116,7 +116,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
{ {
// ParentMeasure is created when PlayerName is an actual player (and not a reference) // ParentMeasure is created when PlayerName is an actual player (and not a reference)
ParentMeasure* parent = measure->parent; ParentMeasure* parent = measure->parent;
Player* oldPlayer = NULL; Player* oldPlayer = nullptr;
if (parent) if (parent)
{ {
if (parent->data != data) if (parent->data != data)
@ -147,13 +147,13 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
} }
else if (_wcsicmp(L"foobar2000", str) == 0) else if (_wcsicmp(L"foobar2000", str) == 0)
{ {
HWND fooWindow = FindWindow(L"foo_rainmeter_class", NULL); HWND fooWindow = FindWindow(L"foo_rainmeter_class", nullptr);
if (fooWindow) if (fooWindow)
{ {
const WCHAR* error = L"Your foobar2000 plugin is out of date.\n\nDo you want to update the plugin now?"; const WCHAR* error = L"Your foobar2000 plugin is out of date.\n\nDo you want to update the plugin now?";
if (MessageBox(NULL, error, L"Rainmeter", MB_YESNO | MB_ICONINFORMATION | MB_TOPMOST) == IDYES) if (MessageBox(nullptr, error, L"Rainmeter", MB_YESNO | MB_ICONINFORMATION | MB_TOPMOST) == IDYES)
{ {
ShellExecute(NULL, L"open", L"http://github.com/poiru/foo-cad#readme", NULL, NULL, SW_SHOWNORMAL); ShellExecute(nullptr, L"open", L"http://github.com/poiru/foo-cad#readme", nullptr, nullptr, SW_SHOWNORMAL);
} }
} }
@ -365,7 +365,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
{ {
Measure* measure = (Measure*)data; Measure* measure = (Measure*)data;
ParentMeasure* parent = measure->parent; ParentMeasure* parent = measure->parent;
if (!parent) return NULL; if (!parent) return nullptr;
const Player* player = parent->player; const Player* player = parent->player;
static WCHAR buffer[32]; static WCHAR buffer[32];
@ -435,7 +435,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
return buffer; return buffer;
} }
return NULL; return nullptr;
} }
PLUGIN_EXPORT void Finalize(void* data) PLUGIN_EXPORT void Finalize(void* data)

View File

@ -141,7 +141,7 @@ void Player::FindLyrics()
m_Lyrics.clear(); m_Lyrics.clear();
unsigned int id; unsigned int id;
HANDLE thread = (HANDLE)_beginthreadex(NULL, 0, LyricsThreadProc, this, 0, &id); HANDLE thread = (HANDLE)_beginthreadex(nullptr, 0, LyricsThreadProc, this, 0, &id);
if (thread) if (thread)
{ {
m_InternetThread = thread; m_InternetThread = thread;
@ -185,7 +185,7 @@ unsigned __stdcall Player::LyricsThreadProc(void* pParam)
} }
CloseHandle(player->m_InternetThread); CloseHandle(player->m_InternetThread);
player->m_InternetThread = NULL; player->m_InternetThread = nullptr;
return 0; return 0;
} }

View File

@ -21,7 +21,7 @@
#include "AIMP/aimp2_sdk.h" #include "AIMP/aimp2_sdk.h"
#include "Winamp/wa_ipc.h" #include "Winamp/wa_ipc.h"
Player* PlayerAIMP::c_Player = NULL; Player* PlayerAIMP::c_Player = nullptr;
/* /*
** Constructor. ** Constructor.
@ -44,7 +44,7 @@ PlayerAIMP::PlayerAIMP() : Player(),
*/ */
PlayerAIMP::~PlayerAIMP() PlayerAIMP::~PlayerAIMP()
{ {
c_Player = NULL; c_Player = nullptr;
if (m_FileMap) UnmapViewOfFile(m_FileMap); if (m_FileMap) UnmapViewOfFile(m_FileMap);
if (m_FileMapHandle) CloseHandle(m_FileMapHandle); if (m_FileMapHandle) CloseHandle(m_FileMapHandle);
} }
@ -79,7 +79,7 @@ bool PlayerAIMP::CheckWindow()
if (m_Window) if (m_Window)
{ {
m_WinampWindow = FindWindow(L"Winamp v1.x", NULL); m_WinampWindow = FindWindow(L"Winamp v1.x", nullptr);
m_FileMapHandle = OpenFileMapping(FILE_MAP_READ, FALSE, L"AIMP2_RemoteInfo"); m_FileMapHandle = OpenFileMapping(FILE_MAP_READ, FALSE, L"AIMP2_RemoteInfo");
if (m_FileMapHandle) if (m_FileMapHandle)
@ -315,14 +315,14 @@ void PlayerAIMP::OpenPlayer(std::wstring& path)
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
L"DisplayIcon", L"DisplayIcon",
NULL, nullptr,
(LPDWORD)&type, (LPDWORD)&type,
(LPBYTE)data, (LPBYTE)data,
(LPDWORD)&size) == ERROR_SUCCESS) (LPDWORD)&size) == ERROR_SUCCESS)
{ {
if (type == REG_SZ) if (type == REG_SZ)
{ {
ShellExecute(NULL, L"open", data, NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", data, nullptr, nullptr, SW_SHOW);
path = data; path = data;
} }
} }
@ -338,7 +338,7 @@ void PlayerAIMP::OpenPlayer(std::wstring& path)
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
L"DisplayIcon", L"DisplayIcon",
NULL, nullptr,
(LPDWORD)&type, (LPDWORD)&type,
(LPBYTE)data, (LPBYTE)data,
(LPDWORD)&size) == ERROR_SUCCESS) (LPDWORD)&size) == ERROR_SUCCESS)
@ -348,7 +348,7 @@ void PlayerAIMP::OpenPlayer(std::wstring& path)
path = data; path = data;
path.resize(path.find_last_of(L'\\') + 1); path.resize(path.find_last_of(L'\\') + 1);
path += L"AIMP3.exe"; path += L"AIMP3.exe";
ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW);
} }
} }
} }
@ -358,6 +358,6 @@ void PlayerAIMP::OpenPlayer(std::wstring& path)
} }
else else
{ {
ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW);
} }
} }

View File

@ -20,7 +20,7 @@
#include "PlayerCAD.h" #include "PlayerCAD.h"
#include "CAD/cad_sdk.h" #include "CAD/cad_sdk.h"
Player* PlayerCAD::c_Player = NULL; Player* PlayerCAD::c_Player = nullptr;
extern HINSTANCE g_Instance; extern HINSTANCE g_Instance;
// This player emulates the CD Art Display IPC interface, which is supported by // This player emulates the CD Art Display IPC interface, which is supported by
@ -45,7 +45,7 @@ PlayerCAD::PlayerCAD() : Player(),
*/ */
PlayerCAD::~PlayerCAD() PlayerCAD::~PlayerCAD()
{ {
c_Player = NULL; c_Player = nullptr;
Uninitialize(); Uninitialize();
} }
@ -85,8 +85,8 @@ void PlayerCAD::Initialize()
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, nullptr,
NULL, nullptr,
g_Instance, g_Instance,
this); this);
@ -98,8 +98,8 @@ void PlayerCAD::Initialize()
FPCHANGEWINDOWMESSAGEFILTEREX ChangeWindowMessageFilterEx = (FPCHANGEWINDOWMESSAGEFILTEREX)GetProcAddress(hUser32, "ChangeWindowMessageFilterEx"); FPCHANGEWINDOWMESSAGEFILTEREX ChangeWindowMessageFilterEx = (FPCHANGEWINDOWMESSAGEFILTEREX)GetProcAddress(hUser32, "ChangeWindowMessageFilterEx");
if (ChangeWindowMessageFilterEx) if (ChangeWindowMessageFilterEx)
{ {
ChangeWindowMessageFilterEx(m_Window, WM_USER, MSGFLT_ALLOW, NULL); ChangeWindowMessageFilterEx(m_Window, WM_USER, MSGFLT_ALLOW, nullptr);
ChangeWindowMessageFilterEx(m_Window, WM_COPYDATA, MSGFLT_ALLOW, NULL); ChangeWindowMessageFilterEx(m_Window, WM_COPYDATA, MSGFLT_ALLOW, nullptr);
} }
else else
{ {
@ -119,17 +119,17 @@ void PlayerCAD::Initialize()
LPCTSTR file = RmGetSettingsFile(); LPCTSTR file = RmGetSettingsFile();
// Read saved settings // Read saved settings
GetPrivateProfileString(L"NowPlaying.dll", L"ClassName", NULL, buffer, MAX_PATH, file); GetPrivateProfileString(L"NowPlaying.dll", L"ClassName", nullptr, buffer, MAX_PATH, file);
std::wstring className = buffer; std::wstring className = buffer;
GetPrivateProfileString(L"NowPlaying.dll", L"WindowName", NULL, buffer, MAX_PATH, file); GetPrivateProfileString(L"NowPlaying.dll", L"WindowName", nullptr, buffer, MAX_PATH, file);
std::wstring windowName = buffer; std::wstring windowName = buffer;
GetPrivateProfileString(L"NowPlaying.dll", L"PlayerPath", NULL, buffer, MAX_PATH, file); GetPrivateProfileString(L"NowPlaying.dll", L"PlayerPath", nullptr, buffer, MAX_PATH, file);
m_PlayerPath = buffer; m_PlayerPath = buffer;
LPCTSTR classSz = className.empty() ? NULL : className.c_str(); LPCTSTR classSz = className.empty() ? nullptr : className.c_str();
LPCTSTR windowSz = windowName.empty() ? NULL : windowName.c_str(); LPCTSTR windowSz = windowName.empty() ? nullptr : windowName.c_str();
if (classSz || windowSz) if (classSz || windowSz)
{ {
@ -138,12 +138,12 @@ void PlayerCAD::Initialize()
else else
{ {
classSz = L"CD Art Display IPC Class"; classSz = L"CD Art Display IPC Class";
m_PlayerWindow = FindWindow(classSz, NULL); m_PlayerWindow = FindWindow(classSz, nullptr);
if (m_PlayerWindow) if (m_PlayerWindow)
{ {
WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file); WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file);
windowSz = (GetWindowText(m_PlayerWindow, buffer, MAX_PATH) > 0) ? buffer : NULL; windowSz = (GetWindowText(m_PlayerWindow, buffer, MAX_PATH) > 0) ? buffer : nullptr;
WritePrivateProfileString(L"NowPlaying.dll", L"WindowName", windowSz, file); WritePrivateProfileString(L"NowPlaying.dll", L"WindowName", windowSz, file);
DWORD pID; DWORD pID;
@ -151,7 +151,7 @@ void PlayerCAD::Initialize()
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pID); HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pID);
if (hProcess) if (hProcess)
{ {
if (GetModuleFileNameEx(hProcess, NULL, buffer, MAX_PATH) > 0) if (GetModuleFileNameEx(hProcess, nullptr, buffer, MAX_PATH) > 0)
{ {
WritePrivateProfileString(L"NowPlaying.dll", L"PlayerPath", buffer, file); WritePrivateProfileString(L"NowPlaying.dll", L"PlayerPath", buffer, file);
} }
@ -279,7 +279,7 @@ LRESULT CALLBACK PlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
WCHAR* data = (WCHAR*)cds->lpData; WCHAR* data = (WCHAR*)cds->lpData;
WCHAR* pos; WCHAR* pos;
UINT index = 1; UINT index = 1;
while ((pos = wcschr(data, '\t')) != NULL) while ((pos = wcschr(data, '\t')) != nullptr)
{ {
switch (index) switch (index)
{ {
@ -368,8 +368,8 @@ LRESULT CALLBACK PlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
player->m_PlayerPath.assign(data, 0, len); player->m_PlayerPath.assign(data, 0, len);
data.erase(0, ++len); data.erase(0, ++len);
LPCTSTR classSz = className.empty() ? NULL : className.c_str(); LPCTSTR classSz = className.empty() ? nullptr : className.c_str();
LPCTSTR windowSz = windowName.empty() ? NULL : windowName.c_str(); LPCTSTR windowSz = windowName.empty() ? nullptr : windowName.c_str();
LPCTSTR file = RmGetSettingsFile(); LPCTSTR file = RmGetSettingsFile();
WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file); WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file);
@ -537,15 +537,15 @@ void PlayerCAD::OpenPlayer(std::wstring& path)
{ {
if (!m_Initialized) if (!m_Initialized)
{ {
HINSTANCE ret = NULL; HINSTANCE ret = nullptr;
if (!path.empty()) if (!path.empty())
{ {
ret = ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); ret = ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW);
} }
else if (!m_PlayerPath.empty()) else if (!m_PlayerPath.empty())
{ {
ret = ShellExecute(NULL, L"open", m_PlayerPath.c_str(), NULL, NULL, SW_SHOW); ret = ShellExecute(nullptr, L"open", m_PlayerPath.c_str(), nullptr, nullptr, SW_SHOW);
} }
m_Open = (ret > (HINSTANCE)32); m_Open = (ret > (HINSTANCE)32);

View File

@ -19,7 +19,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "PlayerITunes.h" #include "PlayerITunes.h"
Player* PlayerITunes::c_Player = NULL; Player* PlayerITunes::c_Player = nullptr;
extern HINSTANCE g_Instance; extern HINSTANCE g_Instance;
/* /*
@ -101,7 +101,7 @@ HRESULT STDMETHODCALLTYPE PlayerITunes::CEventHandler::Invoke(DISPID dispidMembe
case ITEventAboutToPromptUserToQuit: case ITEventAboutToPromptUserToQuit:
PostMessage(m_Player->m_CallbackWindow, WM_USER, ITEventAboutToPromptUserToQuit, 0); PostMessage(m_Player->m_CallbackWindow, WM_USER, ITEventAboutToPromptUserToQuit, 0);
SetTimer(m_Player->m_CallbackWindow, TIMER_CHECKACTIVE, 500, NULL); SetTimer(m_Player->m_CallbackWindow, TIMER_CHECKACTIVE, 500, nullptr);
break; break;
} }
@ -135,7 +135,7 @@ PlayerITunes::PlayerITunes() : Player(),
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
HWND_MESSAGE, HWND_MESSAGE,
NULL, nullptr,
g_Instance, g_Instance,
this); this);
} }
@ -146,7 +146,7 @@ PlayerITunes::PlayerITunes() : Player(),
*/ */
PlayerITunes::~PlayerITunes() PlayerITunes::~PlayerITunes()
{ {
c_Player = NULL; c_Player = nullptr;
DestroyWindow(m_CallbackWindow); DestroyWindow(m_CallbackWindow);
UnregisterClass(L"NowPlayingITunesClass", g_Instance); UnregisterClass(L"NowPlayingITunesClass", g_Instance);
@ -176,7 +176,7 @@ void PlayerITunes::Initialize()
{ {
while (true) while (true)
{ {
HRESULT hr = CoCreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER, IID_IiTunes, (PVOID*)&m_iTunes); HRESULT hr = CoCreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER, IID_IiTunes, (PVOID*)&m_iTunes);
if (hr == CO_E_SERVER_EXEC_FAILURE) if (hr == CO_E_SERVER_EXEC_FAILURE)
{ {
@ -187,7 +187,7 @@ void PlayerITunes::Initialize()
else if (hr != S_OK) else if (hr != S_OK)
{ {
// Failed to get hold of iTunes instance via COM // Failed to get hold of iTunes instance via COM
m_iTunes = NULL; m_iTunes = nullptr;
} }
break; break;
@ -621,7 +621,7 @@ void PlayerITunes::ClosePlayer()
{ {
m_iTunes->Quit(); m_iTunes->Quit();
Uninitialize(); Uninitialize();
SetTimer(m_CallbackWindow, TIMER_CHECKACTIVE, 500, NULL); SetTimer(m_CallbackWindow, TIMER_CHECKACTIVE, 500, nullptr);
} }
/* /*
@ -630,5 +630,5 @@ void PlayerITunes::ClosePlayer()
*/ */
void PlayerITunes::OpenPlayer(std::wstring& path) void PlayerITunes::OpenPlayer(std::wstring& path)
{ {
ShellExecute(NULL, L"open", path.empty() ? L"iTunes.exe" : path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.empty() ? L"iTunes.exe" : path.c_str(), nullptr, nullptr, SW_SHOW);
} }

View File

@ -19,7 +19,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "PlayerSpotify.h" #include "PlayerSpotify.h"
Player* PlayerSpotify::c_Player = NULL; Player* PlayerSpotify::c_Player = nullptr;
/* /*
** Constructor. ** Constructor.
@ -37,7 +37,7 @@ PlayerSpotify::PlayerSpotify() : Player(),
*/ */
PlayerSpotify::~PlayerSpotify() PlayerSpotify::~PlayerSpotify()
{ {
c_Player = NULL; c_Player = nullptr;
} }
/* /*
@ -67,7 +67,7 @@ bool PlayerSpotify::CheckWindow()
{ {
m_LastCheckTime = time; m_LastCheckTime = time;
m_Window = FindWindow(L"SpotifyMainWindow", NULL); m_Window = FindWindow(L"SpotifyMainWindow", nullptr);
if (m_Window) if (m_Window)
{ {
m_Initialized = true; m_Initialized = true;
@ -202,8 +202,8 @@ void PlayerSpotify::OpenPlayer(std::wstring& path)
DWORD type = 0; DWORD type = 0;
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
NULL, nullptr,
NULL, nullptr,
(LPDWORD)&type, (LPDWORD)&type,
(LPBYTE)data, (LPBYTE)data,
(LPDWORD)&size) == ERROR_SUCCESS) (LPDWORD)&size) == ERROR_SUCCESS)
@ -213,7 +213,7 @@ void PlayerSpotify::OpenPlayer(std::wstring& path)
path = data; path = data;
path.erase(0, 1); // Get rid of the leading quote path.erase(0, 1); // Get rid of the leading quote
path.resize(path.length() - 3); // And the ",0 at the end path.resize(path.length() - 3); // And the ",0 at the end
ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW);
} }
} }
@ -222,7 +222,7 @@ void PlayerSpotify::OpenPlayer(std::wstring& path)
} }
else else
{ {
ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW);
} }
} }
else else

View File

@ -19,7 +19,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "PlayerWLM.h" #include "PlayerWLM.h"
Player* PlayerWLM::c_Player = NULL; Player* PlayerWLM::c_Player = nullptr;
extern HINSTANCE g_Instance; extern HINSTANCE g_Instance;
// This player emulates the MSN/WLM Messenger 'Listening to' interface, which is // This player emulates the MSN/WLM Messenger 'Listening to' interface, which is
@ -47,8 +47,8 @@ PlayerWLM::PlayerWLM() : Player(),
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, nullptr,
NULL, nullptr,
g_Instance, g_Instance,
this); this);
@ -61,7 +61,7 @@ PlayerWLM::PlayerWLM() : Player(),
*/ */
PlayerWLM::~PlayerWLM() PlayerWLM::~PlayerWLM()
{ {
c_Player = NULL; c_Player = nullptr;
DestroyWindow(m_Window); DestroyWindow(m_Window);
UnregisterClass(L"MsnMsgrUIManager", g_Instance); UnregisterClass(L"MsnMsgrUIManager", g_Instance);
} }

View File

@ -19,7 +19,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "PlayerWMP.h" #include "PlayerWMP.h"
Player* PlayerWMP::c_Player = NULL; Player* PlayerWMP::c_Player = nullptr;
extern HINSTANCE g_Instance; extern HINSTANCE g_Instance;
namespace { namespace {
@ -114,7 +114,7 @@ HRESULT STDMETHODCALLTYPE PlayerWMP::CRemoteHost::QueryInterface(IID const& riid
} }
else else
{ {
*object = NULL; *object = nullptr;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
@ -143,11 +143,11 @@ HRESULT PlayerWMP::CRemoteHost::GetScriptableObject(BSTR* pbstrName, IDispatch**
{ {
if (pbstrName) if (pbstrName)
{ {
*pbstrName = NULL; *pbstrName = nullptr;
} }
if (ppDispatch) if (ppDispatch)
{ {
*ppDispatch = NULL; *ppDispatch = nullptr;
} }
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -220,7 +220,7 @@ PlayerWMP::PlayerWMP() : Player(),
PlayerWMP::~PlayerWMP() PlayerWMP::~PlayerWMP()
{ {
c_Player = NULL; c_Player = nullptr;
Uninitialize(); Uninitialize();
} }
@ -265,13 +265,13 @@ void PlayerWMP::Initialize()
L"NowPlayingWMP", L"", L"NowPlayingWMP", L"",
WS_DISABLED, WS_DISABLED,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, g_Instance, NULL); nullptr, nullptr, g_Instance, nullptr);
HWND window = CreateWindow( HWND window = CreateWindow(
L"AtlAxWin", L"", L"AtlAxWin", L"",
WS_DISABLED | WS_CHILD, WS_DISABLED | WS_CHILD,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
m_Window, NULL, g_Instance, NULL); m_Window, nullptr, g_Instance, nullptr);
Microsoft::WRL::ComPtr<IUnknown> axHost; Microsoft::WRL::ComPtr<IUnknown> axHost;
Microsoft::WRL::ComPtr<IObjectWithSite> hostObject; Microsoft::WRL::ComPtr<IObjectWithSite> hostObject;
@ -513,7 +513,7 @@ void PlayerWMP::UpdateData()
{ {
m_LastCheckTime = time; m_LastCheckTime = time;
if (FindWindow(L"WMPlayerApp", NULL)) if (FindWindow(L"WMPlayerApp", nullptr))
{ {
Initialize(); Initialize();
} }
@ -639,7 +639,7 @@ void PlayerWMP::SetVolume(int volume)
*/ */
void PlayerWMP::ClosePlayer() void PlayerWMP::ClosePlayer()
{ {
HWND wnd = FindWindow(L"WMPlayerApp", NULL); HWND wnd = FindWindow(L"WMPlayerApp", nullptr);
if (wnd) if (wnd)
{ {
@ -653,5 +653,5 @@ void PlayerWMP::ClosePlayer()
*/ */
void PlayerWMP::OpenPlayer(std::wstring& path) void PlayerWMP::OpenPlayer(std::wstring& path)
{ {
ShellExecute(NULL, L"open", path.empty() ? L"wmplayer.exe" : path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.empty() ? L"wmplayer.exe" : path.c_str(), nullptr, nullptr, SW_SHOW);
} }

View File

@ -22,7 +22,7 @@
#include "Winamp/wa_ipc.h" #include "Winamp/wa_ipc.h"
#include "Winamp/wa_cmd.h" #include "Winamp/wa_cmd.h"
Player* PlayerWinamp::c_Player = NULL; Player* PlayerWinamp::c_Player = nullptr;
// This player retrieves data through the Winamp IPC interface. // This player retrieves data through the Winamp IPC interface.
@ -47,7 +47,7 @@ PlayerWinamp::PlayerWinamp(WINAMPTYPE type) : Player(),
*/ */
PlayerWinamp::~PlayerWinamp() PlayerWinamp::~PlayerWinamp()
{ {
c_Player = NULL; c_Player = nullptr;
if (m_WinampHandle) CloseHandle(m_WinampHandle); if (m_WinampHandle) CloseHandle(m_WinampHandle);
} }
@ -78,7 +78,7 @@ bool PlayerWinamp::CheckWindow()
{ {
m_LastCheckTime = time; m_LastCheckTime = time;
m_Window = FindWindow(L"Winamp v1.x", NULL); m_Window = FindWindow(L"Winamp v1.x", nullptr);
if (m_Window) if (m_Window)
{ {
DWORD pID; DWORD pID;
@ -136,7 +136,7 @@ void PlayerWinamp::UpdateData()
if (m_UseUnicodeAPI) if (m_UseUnicodeAPI)
{ {
if (!ReadProcessMemory(m_WinampHandle, m_WinampAddress, &wBuffer, sizeof(wBuffer), NULL)) if (!ReadProcessMemory(m_WinampHandle, m_WinampAddress, &wBuffer, sizeof(wBuffer), nullptr))
{ {
// Failed to read memory // Failed to read memory
return; return;
@ -148,7 +148,7 @@ void PlayerWinamp::UpdateData()
int pos = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETLISTPOS); int pos = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETLISTPOS);
LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, pos, IPC_GETPLAYLISTFILE); LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, pos, IPC_GETPLAYLISTFILE);
if (!ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), NULL)) if (!ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), nullptr))
{ {
// Failed to read memory // Failed to read memory
return; return;
@ -281,13 +281,13 @@ void PlayerWinamp::UpdateData()
if (m_UseUnicodeAPI) if (m_UseUnicodeAPI)
{ {
LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, 0, IPC_GET_PLAYING_TITLE); LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, 0, IPC_GET_PLAYING_TITLE);
ReadProcessMemory(m_WinampHandle, address, &wBuffer, sizeof(wBuffer), NULL); ReadProcessMemory(m_WinampHandle, address, &wBuffer, sizeof(wBuffer), nullptr);
} }
else else
{ {
int pos = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETLISTPOS); int pos = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETLISTPOS);
LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, pos, IPC_GETPLAYLISTTITLE); LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, pos, IPC_GETPLAYLISTTITLE);
ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), NULL); ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), nullptr);
mbstowcs(wBuffer, cBuffer, MAX_PATH); mbstowcs(wBuffer, cBuffer, MAX_PATH);
} }
@ -458,7 +458,7 @@ void PlayerWinamp::OpenPlayer(std::wstring& path)
{ {
if (m_WinampType == WA_WINAMP) if (m_WinampType == WA_WINAMP)
{ {
ShellExecute(NULL, L"open", path.empty() ? L"winamp.exe" : path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.empty() ? L"winamp.exe" : path.c_str(), nullptr, nullptr, SW_SHOW);
} }
else // if (m_WinampType == WA_MEDIAMONKEY) else // if (m_WinampType == WA_MEDIAMONKEY)
{ {
@ -477,15 +477,15 @@ void PlayerWinamp::OpenPlayer(std::wstring& path)
DWORD type = 0; DWORD type = 0;
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
NULL, nullptr,
NULL, nullptr,
(LPDWORD)&type, (LPDWORD)&type,
(LPBYTE)data, (LPBYTE)data,
(LPDWORD)&size) == ERROR_SUCCESS) (LPDWORD)&size) == ERROR_SUCCESS)
{ {
if (type == REG_SZ) if (type == REG_SZ)
{ {
ShellExecute(NULL, L"open", data, NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", data, nullptr, nullptr, SW_SHOW);
path = data; path = data;
} }
} }
@ -495,7 +495,7 @@ void PlayerWinamp::OpenPlayer(std::wstring& path)
} }
else else
{ {
ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW);
} }
} }
} }

View File

@ -42,7 +42,7 @@ CPerfObjectList::GetFirstPerfObject( void )
CPerfObject * CPerfObject *
CPerfObjectList::GetNextPerfObject( void ) CPerfObjectList::GetNextPerfObject( void )
{ {
// Are we at the last object in the list? Return NULL if so. // Are we at the last object in the list? Return nullptr if so.
if ( ++m_currentObjectListIndex >= m_pPerfSnapshot->GetNumObjectTypes() ) if ( ++m_currentObjectListIndex >= m_pPerfSnapshot->GetNumObjectTypes() )
return 0; return 0;

View File

@ -149,7 +149,7 @@ ULONGLONG GetPerfData(LPCWSTR objectName, LPCWSTR instanceName, LPCWSTR counterN
if (pPerfObj) if (pPerfObj)
{ {
for (CPerfObjectInstance* pObjInst = pPerfObj->GetFirstObjectInstance(); for (CPerfObjectInstance* pObjInst = pPerfObj->GetFirstObjectInstance();
pObjInst != NULL; pObjInst != nullptr;
pObjInst = pPerfObj->GetNextObjectInstance()) pObjInst = pPerfObj->GetNextObjectInstance())
{ {
if (*instanceName) if (*instanceName)
@ -170,9 +170,9 @@ ULONGLONG GetPerfData(LPCWSTR objectName, LPCWSTR instanceName, LPCWSTR counterN
} }
CPerfCounter* pPerfCntr = pObjInst->GetCounterByName(counterName); CPerfCounter* pPerfCntr = pObjInst->GetCounterByName(counterName);
if (pPerfCntr != NULL) if (pPerfCntr != nullptr)
{ {
pPerfCntr->GetData(data, 256, NULL); pPerfCntr->GetData(data, 256, nullptr);
if (pPerfCntr->GetSize() == 1) if (pPerfCntr->GetSize() == 1)
{ {

View File

@ -17,7 +17,7 @@
#include "perfsnap.h" #include "perfsnap.h"
#include "makeptr.h" #include "makeptr.h"
PBYTE CPerfSnapshot::c_pBuffer = NULL; PBYTE CPerfSnapshot::c_pBuffer = nullptr;
DWORD CPerfSnapshot::c_cbBufferSize = 0; DWORD CPerfSnapshot::c_cbBufferSize = 0;
CPerfSnapshot::CPerfSnapshot( CPerfSnapshot::CPerfSnapshot(

View File

@ -96,7 +96,7 @@ CPerfTitleDatabase::CPerfTitleDatabase(
// The raw data entries are an ASCII string index (e.g., "242"), followed // The raw data entries are an ASCII string index (e.g., "242"), followed
// by the corresponding string. Fill in the appropriate slot in the // by the corresponding string. Fill in the appropriate slot in the
// m_TitleStrings array with the pointer to the string name. The end // m_TitleStrings array with the pointer to the string name. The end
// of the list is indicated by a double NULL. // of the list is indicated by a double nullptr.
PTSTR pszWorkStr = (PTSTR)m_pszRawStrings; PTSTR pszWorkStr = (PTSTR)m_pszRawStrings;
unsigned cbCurrStr; unsigned cbCurrStr;

View File

@ -43,7 +43,7 @@ struct MeasureData
threadActive(false), threadActive(false),
value(), value(),
finishAction(), finishAction(),
skin(NULL) skin(nullptr)
{ {
} }
}; };
@ -83,11 +83,11 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
if (*value) if (*value)
{ {
int strLen = (int)wcslen(value) + 1; int strLen = (int)wcslen(value) + 1;
int bufLen = WideCharToMultiByte(CP_ACP, 0, value, strLen, NULL, 0, NULL, NULL); int bufLen = WideCharToMultiByte(CP_ACP, 0, value, strLen, nullptr, 0, nullptr, nullptr);
if (bufLen > 0) if (bufLen > 0)
{ {
char* buffer = new char[bufLen]; char* buffer = new char[bufLen];
WideCharToMultiByte(CP_ACP, 0, value, strLen, buffer, bufLen, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, value, strLen, buffer, bufLen, nullptr, nullptr);
measure->destAddr = inet_addr(buffer); measure->destAddr = inet_addr(buffer);
if (measure->destAddr == INADDR_NONE) if (measure->destAddr == INADDR_NONE)
@ -136,7 +136,7 @@ DWORD WINAPI NetworkThreadProc(void* pParam)
HANDLE hIcmpFile = IcmpCreateFile(); HANDLE hIcmpFile = IcmpCreateFile();
if (hIcmpFile != INVALID_HANDLE_VALUE) if (hIcmpFile != INVALID_HANDLE_VALUE)
{ {
IcmpSendEcho(hIcmpFile, measure->destAddr, NULL, 0, NULL, buffer, bufferSize, measure->timeout); IcmpSendEcho(hIcmpFile, measure->destAddr, nullptr, 0, nullptr, buffer, bufferSize, measure->timeout);
IcmpCloseHandle(hIcmpFile); IcmpCloseHandle(hIcmpFile);
ICMP_ECHO_REPLY* reply = (ICMP_ECHO_REPLY*)buffer; ICMP_ECHO_REPLY* reply = (ICMP_ECHO_REPLY*)buffer;
@ -148,7 +148,7 @@ DWORD WINAPI NetworkThreadProc(void* pParam)
} }
} }
HMODULE module = NULL; HMODULE module = nullptr;
EnterCriticalSection(&g_CriticalSection); EnterCriticalSection(&g_CriticalSection);
if (measure->threadActive) if (measure->threadActive)
@ -188,7 +188,7 @@ PLUGIN_EXPORT double Update(void* data)
{ {
// Launch a new thread to fetch the web data // Launch a new thread to fetch the web data
DWORD id; DWORD id;
HANDLE thread = CreateThread(NULL, 0, NetworkThreadProc, measure, 0, &id); HANDLE thread = CreateThread(nullptr, 0, NetworkThreadProc, measure, 0, &id);
if (thread) if (thread)
{ {
CloseHandle(thread); CloseHandle(thread);

View File

@ -173,7 +173,7 @@ PLUGIN_EXPORT double Update(void* data)
{ {
PROCESSOR_POWER_INFORMATION* ppi = new PROCESSOR_POWER_INFORMATION[g_NumOfProcessors]; PROCESSOR_POWER_INFORMATION* ppi = new PROCESSOR_POWER_INFORMATION[g_NumOfProcessors];
memset(ppi, 0, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors); memset(ppi, 0, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors);
CallNtPowerInformation(ProcessorInformation, NULL, 0, ppi, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors); CallNtPowerInformation(ProcessorInformation, nullptr, 0, ppi, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors);
double value = (measure->type == POWER_MHZ) ? ppi[0].CurrentMhz : ppi[0].CurrentMhz * 1000000.0; double value = (measure->type == POWER_MHZ) ? ppi[0].CurrentMhz : ppi[0].CurrentMhz * 1000000.0;
delete [] ppi; delete [] ppi;
return value; return value;
@ -223,7 +223,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
} }
} }
return NULL; return nullptr;
} }
PLUGIN_EXPORT void Finalize(void* data) PLUGIN_EXPORT void Finalize(void* data)

View File

@ -127,7 +127,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
measure->separator = RmReadString(rm, L"Separator", L"\n"); measure->separator = RmReadString(rm, L"Separator", L"\n");
} }
srand((unsigned)time(NULL)); srand((unsigned)time(nullptr));
} }
PLUGIN_EXPORT double Update(void* data) PLUGIN_EXPORT double Update(void* data)
@ -163,8 +163,8 @@ PLUGIN_EXPORT double Update(void* data)
WCHAR* wBuffer = (WCHAR*)buffer; WCHAR* wBuffer = (WCHAR*)buffer;
// Read until we find the first separator // Read until we find the first separator
WCHAR* sepPos1 = NULL; WCHAR* sepPos1 = nullptr;
WCHAR* sepPos2 = NULL; WCHAR* sepPos2 = nullptr;
do do
{ {
size_t len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file); size_t len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file);
@ -172,7 +172,7 @@ PLUGIN_EXPORT double Update(void* data)
buffer[len + 1] = 0; buffer[len + 1] = 0;
sepPos1 = wcsstr(wBuffer, measure->separator.c_str()); sepPos1 = wcsstr(wBuffer, measure->separator.c_str());
if (sepPos1 == NULL) if (sepPos1 == nullptr)
{ {
// The separator wasn't found // The separator wasn't found
if (feof(file)) if (feof(file))
@ -191,13 +191,13 @@ PLUGIN_EXPORT double Update(void* data)
sepPos1 += measure->separator.size(); sepPos1 += measure->separator.size();
} }
} }
while (sepPos1 == NULL); while (sepPos1 == nullptr);
// Find the second separator // Find the second separator
do do
{ {
sepPos2 = wcsstr(sepPos1, measure->separator.c_str()); sepPos2 = wcsstr(sepPos1, measure->separator.c_str());
if (sepPos2 == NULL) if (sepPos2 == nullptr)
{ {
// The separator wasn't found // The separator wasn't found
if (feof(file)) if (feof(file))
@ -228,7 +228,7 @@ PLUGIN_EXPORT double Update(void* data)
measure->value += sepPos1; measure->value += sepPos1;
} }
} }
while (sepPos2 == NULL); while (sepPos2 == nullptr);
} }
else else
{ {
@ -239,15 +239,15 @@ PLUGIN_EXPORT double Update(void* data)
const char* separatorSz = separator.c_str(); const char* separatorSz = separator.c_str();
// Read until we find the first separator // Read until we find the first separator
char* sepPos1 = NULL; char* sepPos1 = nullptr;
char* sepPos2 = NULL; char* sepPos2 = nullptr;
do do
{ {
size_t len = fread(buffer, sizeof(char), BUFFER_SIZE, file); size_t len = fread(buffer, sizeof(char), BUFFER_SIZE, file);
aBuffer[len] = 0; aBuffer[len] = 0;
sepPos1 = strstr(aBuffer, separatorSz); sepPos1 = strstr(aBuffer, separatorSz);
if (sepPos1 == NULL) if (sepPos1 == nullptr)
{ {
// The separator wasn't found // The separator wasn't found
if (feof(file)) if (feof(file))
@ -265,13 +265,13 @@ PLUGIN_EXPORT double Update(void* data)
sepPos1 += separator.size(); sepPos1 += separator.size();
} }
} }
while (sepPos1 == NULL); while (sepPos1 == nullptr);
// Find the second separator // Find the second separator
do do
{ {
sepPos2 = strstr(sepPos1, separatorSz); sepPos2 = strstr(sepPos1, separatorSz);
if (sepPos2 == NULL) if (sepPos2 == nullptr)
{ {
// The separator wasn't found // The separator wasn't found
if (feof(file)) if (feof(file))
@ -301,7 +301,7 @@ PLUGIN_EXPORT double Update(void* data)
measure->value += StringUtil::Widen(sepPos1); measure->value += StringUtil::Widen(sepPos1);
} }
} }
while (sepPos2 == NULL); while (sepPos2 == nullptr);
} }
} }

View File

@ -119,7 +119,7 @@ PLUGIN_EXPORT double Update(void* data)
g_UpdateCount = g_InstanceCount * -2; g_UpdateCount = g_InstanceCount * -2;
DWORD id; DWORD id;
HANDLE thread = CreateThread(NULL, 0, QueryRecycleBinThreadProc, NULL, 0, &id); HANDLE thread = CreateThread(nullptr, 0, QueryRecycleBinThreadProc, nullptr, 0, &id);
if (thread) if (thread)
{ {
CloseHandle(thread); CloseHandle(thread);
@ -167,15 +167,15 @@ PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args)
if (_wcsicmp(args, L"EmptyBin") == 0) if (_wcsicmp(args, L"EmptyBin") == 0)
{ {
SHEmptyRecycleBin(NULL, NULL, 0); SHEmptyRecycleBin(nullptr, nullptr, 0);
} }
else if (_wcsicmp(args, L"EmptyBinSilent") == 0) else if (_wcsicmp(args, L"EmptyBinSilent") == 0)
{ {
SHEmptyRecycleBin(NULL, NULL, SHERB_NOCONFIRMATION | SHERB_NOPROGRESSUI | SHERB_NOSOUND); SHEmptyRecycleBin(nullptr, nullptr, SHERB_NOCONFIRMATION | SHERB_NOPROGRESSUI | SHERB_NOSOUND);
} }
else if (_wcsicmp(args, L"OpenBin") == 0) else if (_wcsicmp(args, L"OpenBin") == 0)
{ {
ShellExecute(NULL, L"open", L"explorer.exe", L"/N,::{645FF040-5081-101B-9F08-00AA002F954E}", NULL, SW_SHOW); ShellExecute(nullptr, L"open", L"explorer.exe", L"/N,::{645FF040-5081-101B-9F08-00AA002F954E}", nullptr, SW_SHOW);
} }
} }
@ -185,12 +185,12 @@ DWORD WINAPI QueryRecycleBinThreadProc(void* pParam)
SHQUERYRBINFO rbi = {0}; SHQUERYRBINFO rbi = {0};
rbi.cbSize = sizeof(SHQUERYRBINFO); rbi.cbSize = sizeof(SHQUERYRBINFO);
SHQueryRecycleBin(NULL, &rbi); SHQueryRecycleBin(nullptr, &rbi);
g_BinCount = (double)rbi.i64NumItems; g_BinCount = (double)rbi.i64NumItems;
g_BinSize = (double)rbi.i64Size; g_BinSize = (double)rbi.i64Size;
EnterCriticalSection(&g_CriticalSection); EnterCriticalSection(&g_CriticalSection);
HMODULE module = NULL; HMODULE module = nullptr;
if (g_FreeInstanceInThread) if (g_FreeInstanceInThread)
{ {
DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT; DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;
@ -227,7 +227,7 @@ bool HasRecycleBinChanged()
if (ls == ERROR_SUCCESS) if (ls == ERROR_SUCCESS)
{ {
DWORD volumeCount = 0; DWORD volumeCount = 0;
RegQueryInfoKey(volumeKey, NULL, NULL, NULL, &volumeCount, NULL, NULL, NULL, NULL, NULL, NULL, NULL); RegQueryInfoKey(volumeKey, nullptr, nullptr, nullptr, &volumeCount, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
if (volumeCount != s_LastVolumeCount) if (volumeCount != s_LastVolumeCount)
{ {
s_LastVolumeCount = volumeCount; s_LastVolumeCount = volumeCount;
@ -238,14 +238,14 @@ bool HasRecycleBinChanged()
DWORD bufferSize = _countof(buffer); DWORD bufferSize = _countof(buffer);
DWORD index = 0; DWORD index = 0;
while ((ls = RegEnumKeyEx(volumeKey, index, buffer, &bufferSize, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) while ((ls = RegEnumKeyEx(volumeKey, index, buffer, &bufferSize, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS)
{ {
HKEY volumeSubKey; HKEY volumeSubKey;
ls = RegOpenKeyEx(volumeKey, buffer, 0, KEY_QUERY_VALUE, &volumeSubKey); ls = RegOpenKeyEx(volumeKey, buffer, 0, KEY_QUERY_VALUE, &volumeSubKey);
if (ls == ERROR_SUCCESS) if (ls == ERROR_SUCCESS)
{ {
ULONGLONG lastWriteTime; ULONGLONG lastWriteTime;
ls = RegQueryInfoKey(volumeSubKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (FILETIME*)&lastWriteTime); ls = RegQueryInfoKey(volumeSubKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, (FILETIME*)&lastWriteTime);
if (ls == ERROR_SUCCESS) if (ls == ERROR_SUCCESS)
{ {
if (lastWriteTime > s_LastWriteTime) if (lastWriteTime > s_LastWriteTime)
@ -274,7 +274,7 @@ bool HasRecycleBinChanged()
if (ls == ERROR_SUCCESS) if (ls == ERROR_SUCCESS)
{ {
ULONGLONG lastWriteTime; ULONGLONG lastWriteTime;
ls = RegQueryInfoKey(iconKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (FILETIME*)&lastWriteTime); ls = RegQueryInfoKey(iconKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, (FILETIME*)&lastWriteTime);
if (ls == ERROR_SUCCESS) if (ls == ERROR_SUCCESS)
{ {
if (lastWriteTime > s_LastWriteTime) if (lastWriteTime > s_LastWriteTime)

View File

@ -103,7 +103,7 @@ PLUGIN_EXPORT double Update(void* data)
if (measure->type == WINDOW_COUNT) if (measure->type == WINDOW_COUNT)
{ {
g_WindowCount = 0; g_WindowCount = 0;
EnumChildWindows(NULL, EnumWindowProc, 0); EnumChildWindows(nullptr, EnumWindowProc, 0);
return g_WindowCount; return g_WindowCount;
} }
@ -133,7 +133,7 @@ PLUGIN_EXPORT double Update(void* data)
for (UINT i = 0, isize = bytesNeeded / sizeof(DWORD); i < isize; ++i) for (UINT i = 0, isize = bytesNeeded / sizeof(DWORD); i < isize; ++i)
{ {
HANDLE hProcess = OpenProcess(flags, true, aProcesses[i]); HANDLE hProcess = OpenProcess(flags, true, aProcesses[i]);
if (hProcess != NULL) if (hProcess != nullptr)
{ {
if (name) if (name)
{ {

View File

@ -140,7 +140,7 @@ PLUGIN_EXPORT void Finalize(void* data)
void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value) void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value)
{ {
HANDLE hData = OpenFileMapping(FILE_MAP_READ, FALSE, L"SFSharedMemory_ALM"); HANDLE hData = OpenFileMapping(FILE_MAP_READ, FALSE, L"SFSharedMemory_ALM");
if (hData == NULL) return; if (hData == nullptr) return;
SpeedFanData* ptr = (SpeedFanData*)MapViewOfFile(hData, FILE_MAP_READ, 0, 0, 0); SpeedFanData* ptr = (SpeedFanData*)MapViewOfFile(hData, FILE_MAP_READ, 0, 0, 0);
if (ptr == 0) if (ptr == 0)

View File

@ -86,11 +86,11 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm)
{ {
if (GetSystemMetrics(SM_CMONITORS) > 32) if (GetSystemMetrics(SM_CMONITORS) > 32)
{ {
LSLog(LOG_ERROR, NULL, L"SysInfo.dll: Max amount of monitors supported is 32."); LSLog(LOG_ERROR, nullptr, L"SysInfo.dll: Max amount of monitors supported is 32.");
} }
m_Monitors.count = 0; m_Monitors.count = 0;
EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, (LPARAM)(&m_Monitors)); EnumDisplayMonitors(nullptr, nullptr, MyInfoEnumProc, (LPARAM)(&m_Monitors));
g_Initialized = true; g_Initialized = true;
} }
} }
@ -361,7 +361,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
break; break;
} }
return NULL; return nullptr;
} }
PLUGIN_EXPORT double Update(void* data) PLUGIN_EXPORT double Update(void* data)

View File

@ -25,13 +25,13 @@
#include "../../Library/Export.h" #include "../../Library/Export.h"
int DexpotMeasure::InstanceCount = 0; int DexpotMeasure::InstanceCount = 0;
HWND DexpotMeasure::hWndDexpot = NULL; HWND DexpotMeasure::hWndDexpot = nullptr;
HWND DexpotMeasure::hWndMessageWindow = NULL; HWND DexpotMeasure::hWndMessageWindow = nullptr;
std::set<DexpotMeasure*> DexpotMeasure::DexpotMeasures; std::set<DexpotMeasure*> DexpotMeasure::DexpotMeasures;
TCHAR DexpotMeasure::StringBuffer[STRINGBUFFER_SIZE]; TCHAR DexpotMeasure::StringBuffer[STRINGBUFFER_SIZE];
UINT DexpotMeasure::WM_DEXPOTSTARTED = RegisterWindowMessage(_T("DexpotStarted")); UINT DexpotMeasure::WM_DEXPOTSTARTED = RegisterWindowMessage(_T("DexpotStarted"));
BOOL DexpotMeasure::PluginRegistered = FALSE; BOOL DexpotMeasure::PluginRegistered = FALSE;
HWND DexpotMeasure::hWndRainmeterControl = NULL; HWND DexpotMeasure::hWndRainmeterControl = nullptr;
int DexpotMeasure::CurrentDesktop = 0; int DexpotMeasure::CurrentDesktop = 0;
std::vector<std::wstring> DexpotDesktopNameMeasure::DesktopNames; std::vector<std::wstring> DexpotDesktopNameMeasure::DesktopNames;
@ -54,7 +54,7 @@ DexpotMeasure* DexpotMeasure::CreateMeasure(HMODULE instance, UINT id, LPCTSTR i
else if (TypeString == _T("DesktopWallpaper")) return new DexpotDesktopWallpaperMeasure(instance, id); else if (TypeString == _T("DesktopWallpaper")) return new DexpotDesktopWallpaperMeasure(instance, id);
else if (TypeString == _T("Command")) return new DexpotCommandMeasure(instance, id); else if (TypeString == _T("Command")) return new DexpotCommandMeasure(instance, id);
return NULL; return nullptr;
} }
UINT DexpotMeasure::Initialize(LPCTSTR iniFile, LPCTSTR section) UINT DexpotMeasure::Initialize(LPCTSTR iniFile, LPCTSTR section)
@ -115,7 +115,7 @@ BOOL DexpotMeasure::FindDexpotWindow()
{ {
if (IsWindow(hWndDexpot)) return TRUE; if (IsWindow(hWndDexpot)) return TRUE;
hWndDexpot = FindWindow(DEXPOTCLASS, DEXPOTTITLE); hWndDexpot = FindWindow(DEXPOTCLASS, DEXPOTTITLE);
return hWndDexpot != NULL; return hWndDexpot != nullptr;
} }
HWND DexpotMeasure::CreateMessageWindow() HWND DexpotMeasure::CreateMessageWindow()
@ -128,9 +128,9 @@ HWND DexpotMeasure::CreateMessageWindow()
wc.lpfnWndProc = WindowProc; wc.lpfnWndProc = WindowProc;
RegisterClass(&wc); RegisterClass(&wc);
HWND hWnd = CreateWindowEx(0, _T("DexpotPluginWindowClass"), _T("Dexpot Rainmeter Plugin"), 0, 0, 0, 0, 0, NULL, NULL, hInstance, NULL); HWND hWnd = CreateWindowEx(0, _T("DexpotPluginWindowClass"), _T("Dexpot Rainmeter Plugin"), 0, 0, 0, 0, 0, nullptr, nullptr, hInstance, nullptr);
SetWindowLong(hWnd, GWL_STYLE, 0); SetWindowLong(hWnd, GWL_STYLE, 0);
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(hWnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
MoveWindow(hWnd, 0, 0, 0, 0, FALSE); MoveWindow(hWnd, 0, 0, 0, 0, FALSE);
return hWnd; return hWnd;
@ -385,7 +385,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot()
{ {
int Desktop = DesktopNumber == 0 ? CurrentDesktop : DesktopNumber; int Desktop = DesktopNumber == 0 ? CurrentDesktop : DesktopNumber;
int nBytes = 0; int nBytes = 0;
BYTE *pBytes = NULL; BYTE *pBytes = nullptr;
HANDLE fm; HANDLE fm;
HANDLE mutex; HANDLE mutex;
@ -429,7 +429,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot()
bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = nBytes; bmi.bmiHeader.biSizeImage = nBytes;
ScreenDC = GetDC(NULL); ScreenDC = GetDC(nullptr);
MemDC = CreateCompatibleDC(ScreenDC); MemDC = CreateCompatibleDC(ScreenDC);
MemDC2 = CreateCompatibleDC(ScreenDC); MemDC2 = CreateCompatibleDC(ScreenDC);
OriginalBitmap = CreateCompatibleBitmap(ScreenDC, DesktopWidth, DesktopHeight); OriginalBitmap = CreateCompatibleBitmap(ScreenDC, DesktopWidth, DesktopHeight);
@ -441,7 +441,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot()
bmi.bmiHeader.biHeight = ScaledHeight; bmi.bmiHeader.biHeight = ScaledHeight;
bmi.bmiHeader.biSizeImage = nBytes; bmi.bmiHeader.biSizeImage = nBytes;
ScaledBitmap = CreateDIBSection(MemDC, &bmi, 0, (void**) &ScaledBytes, NULL, 0); ScaledBitmap = CreateDIBSection(MemDC, &bmi, 0, (void**) &ScaledBytes, nullptr, 0);
OldBitmap = SelectObject(MemDC, (HGDIOBJ) ScaledBitmap); OldBitmap = SelectObject(MemDC, (HGDIOBJ) ScaledBitmap);
SetStretchBltMode(MemDC, HALFTONE); SetStretchBltMode(MemDC, HALFTONE);
StretchBlt(MemDC, 0, 0, ScaledWidth, ScaledHeight, MemDC2, 0, 0, DesktopWidth, DesktopHeight, SRCCOPY); StretchBlt(MemDC, 0, 0, ScaledWidth, ScaledHeight, MemDC2, 0, 0, DesktopWidth, DesktopHeight, SRCCOPY);
@ -467,7 +467,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot()
DeleteObject(OriginalBitmap); DeleteObject(OriginalBitmap);
DeleteDC(MemDC); DeleteDC(MemDC);
DeleteDC(MemDC2); DeleteDC(MemDC2);
ReleaseDC(NULL, ScreenDC); ReleaseDC(nullptr, ScreenDC);
} }
UnmapViewOfFile(pBytes); UnmapViewOfFile(pBytes);

View File

@ -23,7 +23,7 @@
#include "VirtuaWinMessages.h" #include "VirtuaWinMessages.h"
#include "../../Library/Export.h" #include "../../Library/Export.h"
HWND VirtuaWinMeasure::vwHandle = NULL; HWND VirtuaWinMeasure::vwHandle = nullptr;
std::map<std::wstring, VirtuaWinMeasure::MeasureType> VirtuaWinMeasure::StringToType; std::map<std::wstring, VirtuaWinMeasure::MeasureType> VirtuaWinMeasure::StringToType;
VirtuaWinMeasure::VirtuaWinMeasure(HMODULE instance, UINT id) : VDMeasure(instance, id) VirtuaWinMeasure::VirtuaWinMeasure(HMODULE instance, UINT id) : VDMeasure(instance, id)
@ -144,5 +144,5 @@ BOOL VirtuaWinMeasure::FindVirtuaWinWindow()
{ {
if (IsWindow(vwHandle)) return TRUE; if (IsWindow(vwHandle)) return TRUE;
vwHandle = FindWindow(_T("VirtuaWinMainClass"), _T("VirtuaWinMainClass")); vwHandle = FindWindow(_T("VirtuaWinMainClass"), _T("VirtuaWinMainClass"));
return vwHandle != NULL; return vwHandle != nullptr;
} }

View File

@ -90,7 +90,7 @@ HMODULE VDMeasure::hInstance;
UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
VDMeasure *Measure = NULL; VDMeasure *Measure = nullptr;
LPCTSTR VDManager = ReadConfigString(section, _T("VDManager"), _T("")); LPCTSTR VDManager = ReadConfigString(section, _T("VDManager"), _T(""));
if (_tcsicmp(VDManager, _T("Dexpot")) == 0) if (_tcsicmp(VDManager, _T("Dexpot")) == 0)

View File

@ -30,12 +30,12 @@
#include "../../Common/StringUtil.h" #include "../../Common/StringUtil.h"
#include "../API/RainmeterAPI.h" #include "../API/RainmeterAPI.h"
void ShowError(int lineNumber, WCHAR* errorMsg = NULL); void ShowError(int lineNumber, WCHAR* errorMsg = nullptr);
class ProxyCachePool class ProxyCachePool
{ {
public: public:
ProxyCachePool(LPCWSTR globalProxyName = NULL) : ProxyCachePool(LPCWSTR globalProxyName = nullptr) :
m_GlobalProxyName((globalProxyName && *globalProxyName) ? globalProxyName : L"/auto") m_GlobalProxyName((globalProxyName && *globalProxyName) ? globalProxyName : L"/auto")
{ {
m_GlobalProxyCache = new ProxyCache(CreateProxy(m_GlobalProxyName.c_str()), true); m_GlobalProxyCache = new ProxyCache(CreateProxy(m_GlobalProxyName.c_str()), true);
@ -57,7 +57,7 @@ public:
HINTERNET GetCache(const std::wstring& proxyName) HINTERNET GetCache(const std::wstring& proxyName)
{ {
ProxyCache* cache = NULL; ProxyCache* cache = nullptr;
if (proxyName.empty()) if (proxyName.empty())
{ {
@ -125,12 +125,12 @@ private:
if (_wcsicmp(proxyName, L"/auto") == 0) if (_wcsicmp(proxyName, L"/auto") == 0)
{ {
proxyType = INTERNET_OPEN_TYPE_PRECONFIG; proxyType = INTERNET_OPEN_TYPE_PRECONFIG;
proxyServer = NULL; proxyServer = nullptr;
} }
else if (_wcsicmp(proxyName, L"/none") == 0) else if (_wcsicmp(proxyName, L"/none") == 0)
{ {
proxyType = INTERNET_OPEN_TYPE_DIRECT; proxyType = INTERNET_OPEN_TYPE_DIRECT;
proxyServer = NULL; proxyServer = nullptr;
} }
else else
{ {
@ -141,7 +141,7 @@ private:
HINTERNET handle = InternetOpen(L"Rainmeter WebParser plugin", HINTERNET handle = InternetOpen(L"Rainmeter WebParser plugin",
proxyType, proxyType,
proxyServer, proxyServer,
NULL, nullptr,
0); 0);
if (handle) if (handle)
@ -179,7 +179,7 @@ private:
ProxyCache() {} ProxyCache() {}
ProxyCache(const ProxyCache& cache) {} ProxyCache(const ProxyCache& cache) {}
void Dispose() { if (m_Handle) { InternetCloseHandle(m_Handle); m_Handle = NULL; } } void Dispose() { if (m_Handle) { InternetCloseHandle(m_Handle); m_Handle = nullptr; } }
HINTERNET m_Handle; HINTERNET m_Handle;
bool m_IsGlobal; bool m_IsGlobal;
@ -248,7 +248,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam);
void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize); void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize);
CRITICAL_SECTION g_CriticalSection; CRITICAL_SECTION g_CriticalSection;
ProxyCachePool* g_ProxyCachePool = NULL; ProxyCachePool* g_ProxyCachePool = nullptr;
UINT g_InstanceCount = 0; UINT g_InstanceCount = 0;
static std::vector<MeasureData*> g_Measures; static std::vector<MeasureData*> g_Measures;
@ -327,10 +327,10 @@ void DecodeReferences(std::wstring& str, int opt)
} }
std::wstring num(str, pos, end - pos); std::wstring num(str, pos, end - pos);
WCHAR* pch = NULL; WCHAR* pch = nullptr;
errno = 0; errno = 0;
long ch = wcstol(num.c_str(), &pch, base); long ch = wcstol(num.c_str(), &pch, base);
if (pch == NULL || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character if (pch == nullptr || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character
{ {
start = pos; start = pos;
continue; continue;
@ -656,7 +656,7 @@ void SetupGlobalProxySetting()
WCHAR buffer[MAX_PATH] = {0}; WCHAR buffer[MAX_PATH] = {0};
LPCWSTR file = RmGetSettingsFile(); LPCWSTR file = RmGetSettingsFile();
GetPrivateProfileString(L"WebParser.dll", L"ProxyServer", NULL, buffer, MAX_PATH, file); GetPrivateProfileString(L"WebParser.dll", L"ProxyServer", nullptr, buffer, MAX_PATH, file);
g_ProxyCachePool = new ProxyCachePool(buffer); g_ProxyCachePool = new ProxyCachePool(buffer);
} }
} }
@ -664,7 +664,7 @@ void SetupGlobalProxySetting()
void ClearGlobalProxySetting() void ClearGlobalProxySetting()
{ {
delete g_ProxyCachePool; delete g_ProxyCachePool;
g_ProxyCachePool = NULL; g_ProxyCachePool = nullptr;
} }
void SetupProxySetting(ProxySetting& setting, void* rm) void SetupProxySetting(ProxySetting& setting, void* rm)
@ -683,7 +683,7 @@ void ClearProxySetting(ProxySetting& setting)
g_ProxyCachePool->RemoveCache(setting.server); g_ProxyCachePool->RemoveCache(setting.server);
} }
setting.handle = NULL; setting.handle = nullptr;
setting.server.clear(); setting.server.clear();
} }
@ -767,7 +767,7 @@ PLUGIN_EXPORT double Update(void* data)
{ {
// Launch a new thread to fetch the web data // Launch a new thread to fetch the web data
unsigned int id; unsigned int id;
HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkDownloadThreadProc, measure, 0, &id); HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkDownloadThreadProc, measure, 0, &id);
if (threadHandle) if (threadHandle)
{ {
measure->dlThreadHandle = threadHandle; measure->dlThreadHandle = threadHandle;
@ -797,7 +797,7 @@ PLUGIN_EXPORT double Update(void* data)
if (!measure->resultString.empty()) if (!measure->resultString.empty())
{ {
value = wcstod(measure->resultString.c_str(), NULL); value = wcstod(measure->resultString.c_str(), nullptr);
} }
LeaveCriticalSection(&g_CriticalSection); LeaveCriticalSection(&g_CriticalSection);
@ -811,7 +811,7 @@ PLUGIN_EXPORT double Update(void* data)
{ {
// Launch a new thread to fetch the web data // Launch a new thread to fetch the web data
unsigned int id; unsigned int id;
HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkThreadProc, measure, 0, &id); HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkThreadProc, measure, 0, &id);
if (threadHandle) if (threadHandle)
{ {
measure->threadHandle = threadHandle; measure->threadHandle = threadHandle;
@ -901,9 +901,9 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize)
flags, // default options flags, // default options
&error, // for error message &error, // for error message
&erroffset, // for error offset &erroffset, // for error offset
NULL); // use default character tables nullptr); // use default character tables
if (re != NULL) if (re != nullptr)
{ {
// Compilation succeeded: match the subject in the second argument // Compilation succeeded: match the subject in the second argument
std::string utf8Data; std::string utf8Data;
@ -925,7 +925,7 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize)
rc = pcre_exec( rc = pcre_exec(
re, // the compiled pattern re, // the compiled pattern
NULL, // no extra data - we didn't study the pattern nullptr, // no extra data - we didn't study the pattern
parseData, // the subject string parseData, // the subject string
dwSize, // the length of the subject dwSize, // the length of the subject
0, // start at offset 0 in the subject 0, // start at offset 0 in the subject
@ -1041,7 +1041,7 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize)
{ {
// Start the download thread // Start the download thread
unsigned int id; unsigned int id;
HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkDownloadThreadProc, (*i), 0, &id); HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkDownloadThreadProc, (*i), 0, &id);
if (threadHandle) if (threadHandle)
{ {
(*i)->dlThreadHandle = threadHandle; (*i)->dlThreadHandle = threadHandle;
@ -1139,7 +1139,7 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize)
{ {
// Start the download thread // Start the download thread
unsigned int id; unsigned int id;
HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkDownloadThreadProc, measure, 0, &id); HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkDownloadThreadProc, measure, 0, &id);
if (threadHandle) if (threadHandle)
{ {
measure->dlThreadHandle = threadHandle; measure->dlThreadHandle = threadHandle;
@ -1229,7 +1229,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam)
} }
PathCanonicalize(buffer, measure->downloadFolder.c_str()); PathCanonicalize(buffer, measure->downloadFolder.c_str());
CreateDirectory(buffer, NULL); // Make sure that the folder exists CreateDirectory(buffer, nullptr); // Make sure that the folder exists
wcscat(buffer, path.c_str()); wcscat(buffer, path.c_str());
@ -1245,7 +1245,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam)
GetTempPath(MAX_PATH, buffer); GetTempPath(MAX_PATH, buffer);
wcscat(buffer, L"Rainmeter-Cache\\"); // "%TEMP%\Rainmeter-Cache\" wcscat(buffer, L"Rainmeter-Cache\\"); // "%TEMP%\Rainmeter-Cache\"
} }
CreateDirectory(buffer, NULL); // Make sure that the folder exists CreateDirectory(buffer, nullptr); // Make sure that the folder exists
directory = buffer; directory = buffer;
if (fullpath.empty()) if (fullpath.empty())
@ -1358,7 +1358,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam)
} }
// Create empty file // Create empty file
HANDLE hFile = CreateFile(fullpath.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE hFile = CreateFile(fullpath.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile);
LeaveCriticalSection(&g_CriticalSection); LeaveCriticalSection(&g_CriticalSection);
@ -1384,7 +1384,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam)
if (ret == ERROR_SUCCESS) if (ret == ERROR_SUCCESS)
{ {
DWORD size = sizeof(mode); DWORD size = sizeof(mode);
ret = RegQueryValueEx(hKey, L"SyncMode5", NULL, NULL, (LPBYTE)&mode, &size); ret = RegQueryValueEx(hKey, L"SyncMode5", nullptr, nullptr, (LPBYTE)&mode, &size);
RegCloseKey(hKey); RegCloseKey(hKey);
} }
@ -1412,10 +1412,10 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam)
log += fullpath; log += fullpath;
RmLog(LOG_DEBUG, log.c_str()); RmLog(LOG_DEBUG, log.c_str());
HRESULT resultCoInitialize = CoInitialize(NULL); // requires before calling URLDownloadToFile function HRESULT resultCoInitialize = CoInitialize(nullptr); // requires before calling URLDownloadToFile function
// Download the file // Download the file
HRESULT result = URLDownloadToFile(NULL, url.c_str(), fullpath.c_str(), NULL, NULL); HRESULT result = URLDownloadToFile(nullptr, url.c_str(), fullpath.c_str(), 0, nullptr);
if (result == S_OK) if (result == S_OK)
{ {
EnterCriticalSection(&g_CriticalSection); EnterCriticalSection(&g_CriticalSection);
@ -1546,7 +1546,7 @@ PLUGIN_EXPORT void Finalize(void* data)
EnterCriticalSection(&g_CriticalSection); EnterCriticalSection(&g_CriticalSection);
TerminateThread(measure->threadHandle, 0); TerminateThread(measure->threadHandle, 0);
measure->threadHandle = NULL; measure->threadHandle = nullptr;
LeaveCriticalSection(&g_CriticalSection); LeaveCriticalSection(&g_CriticalSection);
} }
@ -1557,7 +1557,7 @@ PLUGIN_EXPORT void Finalize(void* data)
EnterCriticalSection(&g_CriticalSection); EnterCriticalSection(&g_CriticalSection);
TerminateThread(measure->dlThreadHandle, 0); TerminateThread(measure->dlThreadHandle, 0);
measure->dlThreadHandle = NULL; measure->dlThreadHandle = nullptr;
LeaveCriticalSection(&g_CriticalSection); LeaveCriticalSection(&g_CriticalSection);
} }
@ -1605,19 +1605,19 @@ BYTE* DownloadUrl(HINTERNET handle, std::wstring& url, DWORD* dataSize, bool for
flags = INTERNET_FLAG_RELOAD; flags = INTERNET_FLAG_RELOAD;
} }
HINTERNET hUrlDump = InternetOpenUrl(handle, url.c_str(), NULL, NULL, flags, 0); HINTERNET hUrlDump = InternetOpenUrl(handle, url.c_str(), nullptr, 0, flags, 0);
if (!hUrlDump) if (!hUrlDump)
{ {
if (_wcsnicmp(url.c_str(), L"file://", 7) == 0) // file scheme if (_wcsnicmp(url.c_str(), L"file://", 7) == 0) // file scheme
{ {
const std::string urlACP = StringUtil::Narrow(url); const std::string urlACP = StringUtil::Narrow(url);
hUrlDump = InternetOpenUrlA(handle, urlACP.c_str(), NULL, NULL, flags, 0); hUrlDump = InternetOpenUrlA(handle, urlACP.c_str(), nullptr, 0, flags, 0);
} }
if (!hUrlDump) if (!hUrlDump)
{ {
ShowError(__LINE__); ShowError(__LINE__);
return NULL; return nullptr;
} }
} }
@ -1674,7 +1674,7 @@ void ShowError(int lineNumber, WCHAR* errorMsg)
err += buffer; err += buffer;
err += L") "; err += L") ";
if (errorMsg == NULL) if (errorMsg == nullptr)
{ {
if (dwErr == ERROR_INTERNET_EXTENDED_ERROR) if (dwErr == ERROR_INTERNET_EXTENDED_ERROR)
{ {
@ -1697,7 +1697,7 @@ void ShowError(int lineNumber, WCHAR* errorMsg)
} }
else else
{ {
LPVOID lpMsgBuf = NULL; LPVOID lpMsgBuf = nullptr;
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
@ -1710,10 +1710,10 @@ void ShowError(int lineNumber, WCHAR* errorMsg)
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, (LPTSTR) &lpMsgBuf,
0, 0,
NULL nullptr
); );
if (lpMsgBuf == NULL) if (lpMsgBuf == nullptr)
{ {
err += L"Unknown error"; err += L"Unknown error";
} }

View File

@ -48,9 +48,9 @@ UINT g_Instances = 0;
// Globals that store system's wifi interface/adapter structs // Globals that store system's wifi interface/adapter structs
// These are initialized in Initialize(), used during each update // These are initialized in Initialize(), used during each update
HANDLE g_hClient = NULL; HANDLE g_hClient = nullptr;
PWLAN_INTERFACE_INFO g_pInterface = NULL; PWLAN_INTERFACE_INFO g_pInterface = nullptr;
PWLAN_INTERFACE_INFO_LIST g_pIntfList = NULL; PWLAN_INTERFACE_INFO_LIST g_pIntfList = nullptr;
// Function that translates DOT11 ENUMs to output strings // Function that translates DOT11 ENUMs to output strings
LPCWSTR GetDot11Str(int, int); LPCWSTR GetDot11Str(int, int);
@ -61,7 +61,7 @@ std::wstring ConvertToWide(LPCSTR str, int strLen)
if (str && *str) if (str && *str)
{ {
int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0); int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, nullptr, 0);
if (bufLen > 0) if (bufLen > 0)
{ {
szWide.resize(bufLen); szWide.resize(bufLen);
@ -73,18 +73,18 @@ std::wstring ConvertToWide(LPCSTR str, int strLen)
void FinalizeHandle() void FinalizeHandle()
{ {
g_pInterface = NULL; g_pInterface = nullptr;
if (g_pIntfList != NULL) if (g_pIntfList != nullptr)
{ {
WlanFreeMemory(g_pIntfList); WlanFreeMemory(g_pIntfList);
g_pIntfList = NULL; g_pIntfList = nullptr;
} }
if (g_hClient != NULL) if (g_hClient != nullptr)
{ {
WlanCloseHandle(g_hClient, NULL); WlanCloseHandle(g_hClient, nullptr);
g_hClient = NULL; g_hClient = nullptr;
} }
} }
@ -100,10 +100,10 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm)
WCHAR buffer[256]; WCHAR buffer[256];
// Create WINLAN API Handle // Create WINLAN API Handle
if (g_hClient == NULL) if (g_hClient == nullptr)
{ {
DWORD dwNegotiatedVersion = 0; DWORD dwNegotiatedVersion = 0;
DWORD dwErr = WlanOpenHandle(WLAN_API_VERSION, NULL, &dwNegotiatedVersion, &g_hClient); DWORD dwErr = WlanOpenHandle(WLAN_API_VERSION, nullptr, &dwNegotiatedVersion, &g_hClient);
if (ERROR_SUCCESS != dwErr) if (ERROR_SUCCESS != dwErr)
{ {
FinalizeHandle(); FinalizeHandle();
@ -114,9 +114,9 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm)
} }
// Query list of WLAN interfaces // Query list of WLAN interfaces
if (g_pIntfList == NULL) if (g_pIntfList == nullptr)
{ {
DWORD dwErr = WlanEnumInterfaces(g_hClient, NULL, &g_pIntfList); DWORD dwErr = WlanEnumInterfaces(g_hClient, nullptr, &g_pIntfList);
if (ERROR_SUCCESS != dwErr) if (ERROR_SUCCESS != dwErr)
{ {
FinalizeHandle(); FinalizeHandle();
@ -136,7 +136,7 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm)
PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
{ {
if (g_hClient == NULL) return; if (g_hClient == nullptr) return;
MeasureData* measure = (MeasureData*)data; MeasureData* measure = (MeasureData*)data;
WCHAR buffer[128]; WCHAR buffer[128];
@ -234,7 +234,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
PLUGIN_EXPORT double Update(void* data) PLUGIN_EXPORT double Update(void* data)
{ {
if (g_pInterface == NULL) return 0; if (g_pInterface == nullptr) return 0;
MeasureData* measure = (MeasureData*)data; MeasureData* measure = (MeasureData*)data;
double value = 0; double value = 0;
@ -243,8 +243,8 @@ PLUGIN_EXPORT double Update(void* data)
{ {
if (measure->type == LIST) if (measure->type == LIST)
{ {
PWLAN_AVAILABLE_NETWORK_LIST pwnl = NULL; PWLAN_AVAILABLE_NETWORK_LIST pwnl = nullptr;
DWORD dwErr = WlanGetAvailableNetworkList(g_hClient, &g_pInterface->InterfaceGuid, NULL, NULL, &pwnl); DWORD dwErr = WlanGetAvailableNetworkList(g_hClient, &g_pInterface->InterfaceGuid, 0, nullptr, &pwnl);
if (ERROR_SUCCESS != dwErr) if (ERROR_SUCCESS != dwErr)
{ {
@ -267,7 +267,7 @@ PLUGIN_EXPORT double Update(void* data)
std::wstring ssid = ConvertToWide((LPCSTR)pwnl->Network[i].dot11Ssid.ucSSID, (int)pwnl->Network[i].dot11Ssid.uSSIDLength); std::wstring ssid = ConvertToWide((LPCSTR)pwnl->Network[i].dot11Ssid.ucSSID, (int)pwnl->Network[i].dot11Ssid.uSSIDLength);
// Prevent duplicates that result from profiles, check using SSID // Prevent duplicates that result from profiles, check using SSID
if (!ssid.empty() && ssid[0] && wcsstr(measure->statusString.c_str(), ssid.c_str()) == NULL) if (!ssid.empty() && ssid[0] && wcsstr(measure->statusString.c_str(), ssid.c_str()) == nullptr)
{ {
++printed; ++printed;
measure->statusString += ssid; measure->statusString += ssid;
@ -299,8 +299,8 @@ PLUGIN_EXPORT double Update(void* data)
else else
{ {
ULONG outsize = 0; ULONG outsize = 0;
PWLAN_CONNECTION_ATTRIBUTES wlan_cattr = NULL; PWLAN_CONNECTION_ATTRIBUTES wlan_cattr = nullptr;
DWORD dwErr = WlanQueryInterface(g_hClient, &g_pInterface->InterfaceGuid, wlan_intf_opcode_current_connection, NULL, &outsize, (PVOID*)&wlan_cattr, NULL); DWORD dwErr = WlanQueryInterface(g_hClient, &g_pInterface->InterfaceGuid, wlan_intf_opcode_current_connection, nullptr, &outsize, (PVOID*)&wlan_cattr, nullptr);
if (ERROR_SUCCESS != dwErr) if (ERROR_SUCCESS != dwErr)
{ {
@ -357,7 +357,7 @@ PLUGIN_EXPORT double Update(void* data)
PLUGIN_EXPORT LPCWSTR GetString(void* data) PLUGIN_EXPORT LPCWSTR GetString(void* data)
{ {
if (g_pInterface == NULL) return NULL; if (g_pInterface == nullptr) return nullptr;
MeasureData* measure = (MeasureData*)data; MeasureData* measure = (MeasureData*)data;
@ -371,7 +371,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
return measure->statusString.c_str(); return measure->statusString.c_str();
default: default:
return NULL; return nullptr;
} }
} }

View File

@ -27,7 +27,7 @@
#include "../../Library/DisableThreadLibraryCalls.h" // contains DllMain entry point #include "../../Library/DisableThreadLibraryCalls.h" // contains DllMain entry point
#define SAFE_RELEASE(punk) \ #define SAFE_RELEASE(punk) \
if ((punk) != NULL) { (punk)->Release(); (punk) = NULL; } if ((punk) != nullptr) { (punk)->Release(); (punk) = nullptr; }
static BOOL com_initialized = FALSE; static BOOL com_initialized = FALSE;
static BOOL instance_created = FALSE; static BOOL instance_created = FALSE;
@ -110,7 +110,7 @@ HRESULT RegisterDevice(PCWSTR devID)
InitCom(); InitCom();
IPolicyConfig *pPolicyConfig; IPolicyConfig *pPolicyConfig;
hr = CoCreateInstance(IID_CPolicyConfigClient, NULL, hr = CoCreateInstance(IID_CPolicyConfigClient, nullptr,
CLSCTX_ALL, IID_IPolicyConfig, CLSCTX_ALL, IID_IPolicyConfig,
(LPVOID *)&pPolicyConfig); (LPVOID *)&pPolicyConfig);
if (hr == S_OK) if (hr == S_OK)

View File

@ -62,8 +62,8 @@ PLUGIN_EXPORT double Update(void* data)
MeasureData* measure = (MeasureData*)data; MeasureData* measure = (MeasureData*)data;
HWND hwnd = FindWindow( HWND hwnd = FindWindow(
measure->windowClass.empty() ? NULL : measure->windowClass.c_str(), measure->windowClass.empty() ? nullptr : measure->windowClass.c_str(),
measure->windowName.empty() ? NULL : measure->windowName.c_str()); measure->windowName.empty() ? nullptr : measure->windowName.c_str());
if (hwnd) if (hwnd)
{ {
@ -96,7 +96,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
return measure->value.c_str(); return measure->value.c_str();
} }
return NULL; return nullptr;
} }
PLUGIN_EXPORT void Finalize(void* data) PLUGIN_EXPORT void Finalize(void* data)
@ -123,8 +123,8 @@ PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args)
{ {
HWND hwnd = FindWindow( HWND hwnd = FindWindow(
measure->windowClass.empty() ? NULL : measure->windowClass.c_str(), measure->windowClass.empty() ? nullptr : measure->windowClass.c_str(),
measure->windowName.empty() ? NULL : measure->windowName.c_str()); measure->windowName.empty() ? nullptr : measure->windowName.c_str());
if (hwnd) if (hwnd)
{ {

View File

@ -294,7 +294,7 @@ static bool updateCurrentTrack()
if (0 == lastClock || currentClock - lastClock > CLOCKS_PER_SEC) if (0 == lastClock || currentClock - lastClock > CLOCKS_PER_SEC)
{ {
wsprintf(CurrentTrackArtworkPath, L"%s%s", BaseDir, DefaultTrackArtworkPath); wsprintf(CurrentTrackArtworkPath, L"%s%s", BaseDir, DefaultTrackArtworkPath);
if (CurrentTrack != NULL) if (CurrentTrack != nullptr)
CurrentTrack.Release(); CurrentTrack.Release();
if (FAILED(iTunes->get_CurrentTrack(&CurrentTrack)) || !CurrentTrack) if (FAILED(iTunes->get_CurrentTrack(&CurrentTrack)) || !CurrentTrack)
return false; return false;
@ -316,7 +316,7 @@ static bool updateCurrentTrack()
_bstr_t path; _bstr_t path;
wsprintf(CurrentTrackArtworkPath, L"%s\\iTunesArtwork", BaseDir); wsprintf(CurrentTrackArtworkPath, L"%s\\iTunesArtwork", BaseDir);
CreateDirectory(CurrentTrackArtworkPath, NULL); CreateDirectory(CurrentTrackArtworkPath, nullptr);
switch (artworkFormat) switch (artworkFormat)
{ {
@ -338,7 +338,7 @@ static bool updateCurrentTrack()
} }
} }
} }
return (NULL != CurrentTrack); return (nullptr != CurrentTrack);
} }
static bool iTunesAboutToPromptUserToQuit = false; static bool iTunesAboutToPromptUserToQuit = false;
@ -353,7 +353,7 @@ public:
CiTunesEventHandler() CiTunesEventHandler()
{ {
m_dwRefCount=0; m_dwRefCount=0;
ITypeLib* pITypeLib = NULL ; ITypeLib* pITypeLib = nullptr ;
HRESULT hr = ::LoadRegTypeLib(LIBID_iTunesLib, 1, 5, 0x00, &pITypeLib) ; HRESULT hr = ::LoadRegTypeLib(LIBID_iTunesLib, 1, 5, 0x00, &pITypeLib) ;
// Get type information for the interface of the object. // Get type information for the interface of the object.
hr = pITypeLib->GetTypeInfoOfGuid(DIID__IiTunesEvents, &m_pITypeInfo) ; hr = pITypeLib->GetTypeInfoOfGuid(DIID__IiTunesEvents, &m_pITypeInfo) ;
@ -441,7 +441,7 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
if (!CoInitialized) if (!CoInitialized)
{ {
::CoInitialize(NULL); ::CoInitialize(nullptr);
wcsncpy(BaseDir, iniFile, MAX_PATH); wcsncpy(BaseDir, iniFile, MAX_PATH);
BaseDir[MAX_PATH - 1] = 0; BaseDir[MAX_PATH - 1] = 0;
wchar_t* lastBackslash = wcsrchr(BaseDir, L'\\'); wchar_t* lastBackslash = wcsrchr(BaseDir, L'\\');
@ -452,14 +452,14 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
if (CoInitialized && !InstanceCreated && (FindWindow(L"iTunesApp", L"iTunes") || FindWindow(L"iTunes", L"iTunes"))) if (CoInitialized && !InstanceCreated && (FindWindow(L"iTunesApp", L"iTunes") || FindWindow(L"iTunes", L"iTunes")))
{ {
if (SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER))) if (SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER)))
{ {
InstanceCreated = true; InstanceCreated = true;
initEventHandler(); initEventHandler();
} }
else else
{ {
LSLog(LOG_ERROR, NULL, L"iTunesPlugin.dll: Unable to create instance"); LSLog(LOG_ERROR, nullptr, L"iTunesPlugin.dll: Unable to create instance");
} }
} }
@ -492,14 +492,14 @@ UINT Update(UINT id)
// Check if the iTunes window has appeared // Check if the iTunes window has appeared
if (FindWindow(L"iTunesApp", L"iTunes") || FindWindow(L"iTunes", L"iTunes")) if (FindWindow(L"iTunesApp", L"iTunes") || FindWindow(L"iTunes", L"iTunes"))
{ {
if (!iTunesAboutToPromptUserToQuit && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER))) if (!iTunesAboutToPromptUserToQuit && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER)))
{ {
InstanceCreated = true; InstanceCreated = true;
initEventHandler(); initEventHandler();
} }
else else
{ {
LSLog(LOG_ERROR, NULL, L"iTunesPlugin.dll: Unable to create instance"); LSLog(LOG_ERROR, nullptr, L"iTunesPlugin.dll: Unable to create instance");
return 0; return 0;
} }
} }
@ -773,14 +773,14 @@ void ExecuteBang(LPCTSTR args, UINT id)
} }
else else
{ {
LSLog(LOG_NOTICE, NULL, L"iTunesPlugin.dll: Invalid Command"); LSLog(LOG_NOTICE, nullptr, L"iTunesPlugin.dll: Invalid Command");
return; return;
} }
} }
if (!InstanceCreated) if (!InstanceCreated)
{ {
if (COMMAND_POWER == command && CoInitialized && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER))) if (COMMAND_POWER == command && CoInitialized && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER)))
{ {
IITBrowserWindowPtr browserWindow; IITBrowserWindowPtr browserWindow;
if (SUCCEEDED(iTunes->get_BrowserWindow(&browserWindow))) if (SUCCEEDED(iTunes->get_BrowserWindow(&browserWindow)))

View File

@ -41,7 +41,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
// Avoid loading a dll from current directory // Avoid loading a dll from current directory
SetDllDirectory(L""); SetDllDirectory(L"");
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
InitCommonControls(); InitCommonControls();
if (lpCmdLine[0] == L'"') if (lpCmdLine[0] == L'"')
@ -88,7 +88,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
} }
else else
{ {
HRESULT hr = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, buffer); HRESULT hr = SHGetFolderPath(nullptr, CSIDL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, buffer);
wcscat(buffer, L"\\Rainmeter\\"); wcscat(buffer, L"\\Rainmeter\\");
g_Data.settingsPath = buffer; g_Data.settingsPath = buffer;
wcscat(buffer, L"Rainmeter.ini"); wcscat(buffer, L"Rainmeter.ini");
@ -106,14 +106,14 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
else else
{ {
std::wstring error = L"SkinPath not found.\nMake sure that Rainmeter has been run at least once."; std::wstring error = L"SkinPath not found.\nMake sure that Rainmeter has been run at least once.";
MessageBox(NULL, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR); MessageBox(nullptr, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR);
return 1; return 1;
} }
} }
else else
{ {
std::wstring error = L"Rainmeter.ini not found.\nMake sure that Rainmeter has been run at least once."; std::wstring error = L"Rainmeter.ini not found.\nMake sure that Rainmeter has been run at least once.";
MessageBox(NULL, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR); MessageBox(nullptr, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR);
return 1; return 1;
} }
} }
@ -231,10 +231,10 @@ bool CloseRainmeterIfActive()
bool IsRunning(const WCHAR* name, HANDLE* hMutex) bool IsRunning(const WCHAR* name, HANDLE* hMutex)
{ {
// Create mutex // Create mutex
HANDLE hMutexTmp = CreateMutex(NULL, FALSE, name); HANDLE hMutexTmp = CreateMutex(nullptr, FALSE, name);
if (GetLastError() == ERROR_ALREADY_EXISTS) if (GetLastError() == ERROR_ALREADY_EXISTS)
{ {
*hMutex = NULL; *hMutex = nullptr;
return true; return true;
} }
else else
@ -254,7 +254,7 @@ bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMov
SHFILEOPSTRUCT fo = SHFILEOPSTRUCT fo =
{ {
NULL, nullptr,
bMove ? FO_MOVE : FO_COPY, bMove ? FO_MOVE : FO_COPY,
tmpFrom.c_str(), tmpFrom.c_str(),
tmpTo.c_str(), tmpTo.c_str(),
@ -301,11 +301,11 @@ std::string ConvertToAscii(LPCTSTR str)
if (str && *str) if (str && *str)
{ {
int strLen = (int)wcslen(str); int strLen = (int)wcslen(str);
int bufLen = WideCharToMultiByte(CP_ACP, 0, str, strLen, NULL, 0, NULL, NULL); int bufLen = WideCharToMultiByte(CP_ACP, 0, str, strLen, nullptr, 0, nullptr, nullptr);
if (bufLen > 0) if (bufLen > 0)
{ {
szAscii.resize(bufLen); szAscii.resize(bufLen);
WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, nullptr, nullptr);
} }
} }
return szAscii; return szAscii;
@ -318,7 +318,7 @@ std::wstring ConvertToWide(LPCSTR str)
if (str && *str) if (str && *str)
{ {
int strLen = (int)strlen(str); int strLen = (int)strlen(str);
int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0); int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, nullptr, 0);
if (bufLen > 0) if (bufLen > 0)
{ {
szWide.resize(bufLen); szWide.resize(bufLen);

View File

@ -28,7 +28,7 @@
extern GlobalData g_Data; extern GlobalData g_Data;
DialogInstall* DialogInstall::c_Dialog = NULL; DialogInstall* DialogInstall::c_Dialog = nullptr;
inline bool IsWin32Build() inline bool IsWin32Build()
{ {
@ -107,7 +107,7 @@ void DialogInstall::Create(HINSTANCE hInstance, LPWSTR lpCmdLine)
} }
else else
{ {
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_INSTALL_DIALOG), NULL, (DLGPROC)DlgProc, (LPARAM)lpCmdLine); DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_INSTALL_DIALOG), nullptr, (DLGPROC)DlgProc, (LPARAM)lpCmdLine);
ReleaseMutex(hMutex); ReleaseMutex(hMutex);
} }
} }
@ -143,7 +143,7 @@ INT_PTR CALLBACK DialogInstall::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
case WM_DESTROY: case WM_DESTROY:
delete c_Dialog; delete c_Dialog;
c_Dialog = NULL; c_Dialog = nullptr;
return FALSE; return FALSE;
} }
} }
@ -153,7 +153,7 @@ INT_PTR CALLBACK DialogInstall::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
INT_PTR DialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam) INT_PTR DialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam)
{ {
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED); HICON hIcon = (HICON)LoadImage(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED);
SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
if (GetOSPlatform() >= OSPLATFORM_VISTA) if (GetOSPlatform() >= OSPLATFORM_VISTA)
@ -184,7 +184,7 @@ INT_PTR DialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam)
{ {
HWND control = controlIds[i] ? GetDlgItem(m_Window, controlIds[i]) : m_TabInstall.GetWindow(); HWND control = controlIds[i] ? GetDlgItem(m_Window, controlIds[i]) : m_TabInstall.GetWindow();
GetWindowRect(control, &r); GetWindowRect(control, &r);
MapWindowPoints(NULL, m_Window, (POINT*)&r, sizeof(RECT) / sizeof(POINT)); MapWindowPoints(nullptr, m_Window, (POINT*)&r, sizeof(RECT) / sizeof(POINT));
MoveWindow(control, r.left, r.top - yDiff, r.right - r.left, r.bottom - r.top, TRUE); MoveWindow(control, r.left, r.top - yDiff, r.right - r.left, r.bottom - r.top, TRUE);
} }
@ -204,7 +204,7 @@ INT_PTR DialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam)
m_ErrorMessage += L"\n\nThe Skin Packager tool must be used to create valid .rmskin packages."; m_ErrorMessage += L"\n\nThe Skin Packager tool must be used to create valid .rmskin packages.";
} }
MessageBox(NULL, m_ErrorMessage.c_str(), L"Rainmeter Skin Installer", MB_ERROR); MessageBox(nullptr, m_ErrorMessage.c_str(), L"Rainmeter Skin Installer", MB_ERROR);
EndDialog(m_Window, 0); EndDialog(m_Window, 0);
} }
@ -220,7 +220,7 @@ INT_PTR DialogInstall::OnCommand(WPARAM wParam, LPARAM lParam)
{ {
RECT r; RECT r;
GetWindowRect((HWND)lParam, &r); GetWindowRect((HWND)lParam, &r);
HMENU menu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_INSTALL_MENU)); HMENU menu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_INSTALL_MENU));
HMENU subMenu = GetSubMenu(menu, 0); HMENU subMenu = GetSubMenu(menu, 0);
if (m_PackageSkins.empty() || m_MergeSkins || m_BackupPackage) if (m_PackageSkins.empty() || m_MergeSkins || m_BackupPackage)
@ -251,7 +251,7 @@ INT_PTR DialogInstall::OnCommand(WPARAM wParam, LPARAM lParam)
--r.bottom, --r.bottom,
0, 0,
m_Window, m_Window,
NULL); nullptr);
DestroyMenu(menu); DestroyMenu(menu);
} }
@ -324,7 +324,7 @@ bool DialogInstall::ExtractCurrentFile(const std::wstring& fileName)
return false; return false;
} }
HANDLE hFile = CreateFile(fileName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE hFile = CreateFile(fileName.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
return false; return false;
@ -336,7 +336,7 @@ bool DialogInstall::ExtractCurrentFile(const std::wstring& fileName)
BYTE buffer[16384]; BYTE buffer[16384];
DWORD written; DWORD written;
read = unzReadCurrentFile(m_PackageUnzFile, buffer, 16384); read = unzReadCurrentFile(m_PackageUnzFile, buffer, 16384);
if (read < 0 || !WriteFile(hFile, (LPCVOID)buffer, read, &written, NULL) || read != written) if (read < 0 || !WriteFile(hFile, (LPCVOID)buffer, read, &written, nullptr) || read != written)
{ {
read = UNZ_ERRNO; read = UNZ_ERRNO;
break; break;
@ -407,7 +407,7 @@ bool DialogInstall::ReadPackage()
{ {
char cBuffer[MAX_PATH]; char cBuffer[MAX_PATH];
unz_file_info ufi; unz_file_info ufi;
if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, NULL, 0, NULL, 0) == UNZ_OK) if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, nullptr, 0, nullptr, 0) == UNZ_OK)
{ {
MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH);
while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\'; while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\';
@ -495,7 +495,7 @@ bool DialogInstall::ReadPackage()
return false; return false;
} }
m_HeaderBitmap = (HBITMAP)LoadImage(NULL, tempFileSz, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); m_HeaderBitmap = (HBITMAP)LoadImage(nullptr, tempFileSz, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
DeleteFile(tempFileSz); DeleteFile(tempFileSz);
} }
@ -673,10 +673,10 @@ bool DialogInstall::InstallPackage()
SHFILEOPSTRUCT fo = SHFILEOPSTRUCT fo =
{ {
NULL, nullptr,
FO_DELETE, FO_DELETE,
NULL, nullptr,
NULL, nullptr,
FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO
}; };
@ -690,7 +690,7 @@ bool DialogInstall::InstallPackage()
else else
{ {
std::wstring to = g_Data.skinsPath + L"@Backup\\"; std::wstring to = g_Data.skinsPath + L"@Backup\\";
CreateDirectory(to.c_str(), NULL); CreateDirectory(to.c_str(), nullptr);
// Delete current backup // Delete current backup
to += *iter; to += *iter;
@ -715,7 +715,7 @@ bool DialogInstall::InstallPackage()
{ {
char cBuffer[MAX_PATH]; char cBuffer[MAX_PATH];
unz_file_info ufi; unz_file_info ufi;
if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, NULL, 0, NULL, 0) == UNZ_OK) if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, nullptr, 0, nullptr, 0) == UNZ_OK)
{ {
MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH);
while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\'; while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\';
@ -884,7 +884,7 @@ void DialogInstall::BeginInstall()
{ {
ListView_GetItem(item, &lvi); ListView_GetItem(item, &lvi);
std::set<std::wstring>* component = NULL; std::set<std::wstring>* component = nullptr;
switch (lvi.iGroupId) switch (lvi.iGroupId)
{ {
case 0: component = &m_PackageSkins; break; case 0: component = &m_PackageSkins; break;
@ -902,7 +902,7 @@ void DialogInstall::BeginInstall()
} }
EnableWindow(item, FALSE); EnableWindow(item, FALSE);
m_InstallThread = (HANDLE)_beginthreadex(NULL, 0, InstallThread, this, 0, NULL); m_InstallThread = (HANDLE)_beginthreadex(nullptr, 0, InstallThread, this, 0, nullptr);
if (!m_InstallThread) if (!m_InstallThread)
{ {
MessageBox(m_Window, L"Unable to start install.", L"Rainmeter Skin Installer", MB_ERROR); MessageBox(m_Window, L"Unable to start install.", L"Rainmeter Skin Installer", MB_ERROR);
@ -972,7 +972,7 @@ void DialogInstall::KeepVariables()
{ {
if (keyname[j] == L'=') if (keyname[j] == L'=')
{ {
if (GetPrivateProfileString(L"Variables", currKey.c_str(), NULL, buffer, 4, toPath.c_str()) > 0) if (GetPrivateProfileString(L"Variables", currKey.c_str(), nullptr, buffer, 4, toPath.c_str()) > 0)
{ {
while (keyname[++j] != L'\0') currValue += keyname[j]; while (keyname[++j] != L'\0') currValue += keyname[j];
WritePrivateProfileString(L"Variables", currKey.c_str(), currValue.c_str(), toPath.c_str()); WritePrivateProfileString(L"Variables", currKey.c_str(), currValue.c_str(), toPath.c_str());
@ -1203,7 +1203,7 @@ bool DialogInstall::CreateDirectoryRecursive(const std::wstring& path)
// Temporarily terminate string // Temporarily terminate string
directory[pos] = L'\0'; directory[pos] = L'\0';
failed = CreateDirectory(directorySz, NULL) == 0 && GetLastError() == ERROR_PATH_NOT_FOUND; failed = CreateDirectory(directorySz, nullptr) == 0 && GetLastError() == ERROR_PATH_NOT_FOUND;
// Restore slash // Restore slash
directory[pos] = L'\\'; directory[pos] = L'\\';
@ -1288,7 +1288,7 @@ std::wstring DialogInstall::GetWindowsVersionString()
** Constructor. ** Constructor.
** **
*/ */
DialogInstall::TabInstall::TabInstall(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_INSTALL_TAB, DlgProc) DialogInstall::TabInstall::TabInstall(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_INSTALL_TAB, DlgProc)
{ {
} }
@ -1301,7 +1301,7 @@ void DialogInstall::TabInstall::Initialize()
if (GetOSPlatform() >= OSPLATFORM_VISTA) if (GetOSPlatform() >= OSPLATFORM_VISTA)
{ {
extendedFlags |= LVS_EX_DOUBLEBUFFER; extendedFlags |= LVS_EX_DOUBLEBUFFER;
SetWindowTheme(item, L"explorer", NULL); SetWindowTheme(item, L"explorer", nullptr);
} }
ListView_EnableGroupView(item, TRUE); ListView_EnableGroupView(item, TRUE);

View File

@ -28,7 +28,7 @@
extern GlobalData g_Data; extern GlobalData g_Data;
extern OsNameVersion g_OsNameVersions[]; extern OsNameVersion g_OsNameVersions[];
DialogPackage* DialogPackage::c_Dialog = NULL; DialogPackage* DialogPackage::c_Dialog = nullptr;
DialogPackage::DialogPackage(HWND wnd) : Dialog(wnd), DialogPackage::DialogPackage(HWND wnd) : Dialog(wnd),
m_TabInfo(wnd), m_TabInfo(wnd),
@ -55,7 +55,7 @@ void DialogPackage::Create(HINSTANCE hInstance, LPWSTR lpCmdLine)
} }
else else
{ {
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_PACKAGE_DIALOG), NULL, (DLGPROC)DlgProc, (LPARAM)lpCmdLine); DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_PACKAGE_DIALOG), nullptr, (DLGPROC)DlgProc, (LPARAM)lpCmdLine);
ReleaseMutex(hMutex); ReleaseMutex(hMutex);
} }
} }
@ -108,7 +108,7 @@ INT_PTR CALLBACK DialogPackage::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
case WM_DESTROY: case WM_DESTROY:
delete c_Dialog; delete c_Dialog;
c_Dialog = NULL; c_Dialog = nullptr;
return FALSE; return FALSE;
} }
} }
@ -118,7 +118,7 @@ INT_PTR CALLBACK DialogPackage::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
INT_PTR DialogPackage::OnInitDialog(WPARAM wParam, LPARAM lParam) INT_PTR DialogPackage::OnInitDialog(WPARAM wParam, LPARAM lParam)
{ {
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED); HICON hIcon = (HICON)LoadImage(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED);
SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
if (GetOSPlatform() >= OSPLATFORM_VISTA) if (GetOSPlatform() >= OSPLATFORM_VISTA)
@ -180,7 +180,7 @@ INT_PTR DialogPackage::OnCommand(WPARAM wParam, LPARAM lParam)
ShowWindow(item, SW_SHOWNORMAL); ShowWindow(item, SW_SHOWNORMAL);
SendMessage(item, PBM_SETMARQUEE, (WPARAM)TRUE, 0); SendMessage(item, PBM_SETMARQUEE, (WPARAM)TRUE, 0);
m_PackagerThread = (HANDLE)_beginthreadex(NULL, 0, PackagerThreadProc, this, 0, NULL); m_PackagerThread = (HANDLE)_beginthreadex(nullptr, 0, PackagerThreadProc, this, 0, nullptr);
if (!m_PackagerThread) if (!m_PackagerThread)
{ {
MessageBox(m_Window, L"Unknown error.", L"Rainmeter Skin Packager", MB_ERROR); MessageBox(m_Window, L"Unknown error.", L"Rainmeter Skin Packager", MB_ERROR);
@ -268,7 +268,7 @@ bool DialogPackage::CreatePackage()
auto cleanup = [&]()->bool auto cleanup = [&]()->bool
{ {
zipClose(m_ZipFile, NULL); zipClose(m_ZipFile, nullptr);
return false; return false;
}; };
@ -332,8 +332,8 @@ bool DialogPackage::CreatePackage()
// Add footer // Add footer
FILE* file; FILE* file;
if (zipClose(m_ZipFile, NULL) == ZIP_OK && if (zipClose(m_ZipFile, nullptr) == ZIP_OK &&
(file = _wfopen(m_TargetFile.c_str(), L"r+b")) != NULL) (file = _wfopen(m_TargetFile.c_str(), L"r+b")) != nullptr)
{ {
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
DialogInstall::PackageFooter footer = { _ftelli64(file), 0, "RMSKIN" }; DialogInstall::PackageFooter footer = { _ftelli64(file), 0, "RMSKIN" };
@ -388,7 +388,7 @@ bool DialogPackage::AddFileToPackage(const WCHAR* filePath, const WCHAR* zipPath
} }
} }
int open = zipOpenNewFileInZip(m_ZipFile, zipPathAscii.c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); int open = zipOpenNewFileInZip(m_ZipFile, zipPathAscii.c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
if (open != ZIP_OK) if (open != ZIP_OK)
{ {
return false; return false;
@ -398,7 +398,7 @@ bool DialogPackage::AddFileToPackage(const WCHAR* filePath, const WCHAR* zipPath
if (filePath) if (filePath)
{ {
HANDLE file = CreateFile(filePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFile(filePath, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (file == INVALID_HANDLE_VALUE) if (file == INVALID_HANDLE_VALUE)
{ {
result = false; result = false;
@ -410,7 +410,7 @@ bool DialogPackage::AddFileToPackage(const WCHAR* filePath, const WCHAR* zipPath
const DWORD bufferSize = 16 * 1024; const DWORD bufferSize = 16 * 1024;
BYTE buffer[bufferSize]; BYTE buffer[bufferSize];
DWORD readSize; DWORD readSize;
if (!ReadFile(file, buffer, bufferSize, &readSize, NULL)) if (!ReadFile(file, buffer, bufferSize, &readSize, nullptr))
{ {
result = false; result = false;
} }
@ -448,7 +448,7 @@ bool DialogPackage::AddFolderToPackage(const std::wstring& path, std::wstring ba
FindExInfoStandard, FindExInfoStandard,
&fd, &fd,
FindExSearchNameMatch, FindExSearchNameMatch,
NULL, nullptr,
0); 0);
if (hFind == INVALID_HANDLE_VALUE) if (hFind == INVALID_HANDLE_VALUE)
@ -505,7 +505,7 @@ bool DialogPackage::AddFolderToPackage(const std::wstring& path, std::wstring ba
// Add directory entry if folder is empty. // Add directory entry if folder is empty.
std::wstring zipPath = zipPrefix; std::wstring zipPath = zipPrefix;
zipPath.append(currentPath, path.length(), currentPath.length() - path.length()); zipPath.append(currentPath, path.length(), currentPath.length() - path.length());
AddFileToPackage(NULL, zipPath.c_str()); AddFileToPackage(nullptr, zipPath.c_str());
} }
std::list<std::wstring>::const_iterator iter = folders.begin(); std::list<std::wstring>::const_iterator iter = folders.begin();
@ -529,14 +529,14 @@ void DialogPackage::ShowHelp()
url += L"_beta"; url += L"_beta";
} }
ShellExecute(m_Window, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); ShellExecute(m_Window, L"open", url.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
} }
std::wstring DialogPackage::SelectFolder(HWND parent, const std::wstring& existingPath) std::wstring DialogPackage::SelectFolder(HWND parent, const std::wstring& existingPath)
{ {
LPCWSTR dialog = MAKEINTRESOURCE(IDD_PACKAGESELECTFOLDER_DIALOG); LPCWSTR dialog = MAKEINTRESOURCE(IDD_PACKAGESELECTFOLDER_DIALOG);
std::wstring folder = existingPath; std::wstring folder = existingPath;
if (DialogBoxParam(GetModuleHandle(NULL), dialog, parent, SelectFolderDlgProc, (LPARAM)&folder) != 1) if (DialogBoxParam(GetModuleHandle(nullptr), dialog, parent, SelectFolderDlgProc, (LPARAM)&folder) != 1)
{ {
folder.clear(); folder.clear();
} }
@ -557,7 +557,7 @@ INT_PTR CALLBACK DialogPackage::SelectFolderDlgProc(HWND hWnd, UINT uMsg, WPARAM
*existingPath += L'*'; *existingPath += L'*';
WIN32_FIND_DATA fd; WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFileEx(existingPath->c_str(), FindExInfoStandard, &fd, FindExSearchNameMatch, NULL, 0); HANDLE hFind = FindFirstFileEx(existingPath->c_str(), FindExInfoStandard, &fd, FindExSearchNameMatch, nullptr, 0);
existingPath->pop_back(); existingPath->pop_back();
if (hFind != INVALID_HANDLE_VALUE) if (hFind != INVALID_HANDLE_VALUE)
@ -695,7 +695,7 @@ std::pair<std::wstring, std::wstring> DialogPackage::SelectPlugin(HWND parent)
{ {
LPCWSTR dialog = MAKEINTRESOURCE(IDD_PACKAGESELECTPLUGIN_DIALOG); LPCWSTR dialog = MAKEINTRESOURCE(IDD_PACKAGESELECTPLUGIN_DIALOG);
std::pair<std::wstring, std::wstring> plugins; std::pair<std::wstring, std::wstring> plugins;
if (DialogBoxParam(GetModuleHandle(NULL), dialog, parent, SelectPluginDlgProc, (LPARAM)&plugins) != 1) if (DialogBoxParam(GetModuleHandle(nullptr), dialog, parent, SelectPluginDlgProc, (LPARAM)&plugins) != 1)
{ {
plugins.first.clear(); plugins.first.clear();
plugins.second.clear(); plugins.second.clear();
@ -743,7 +743,7 @@ INT_PTR CALLBACK DialogPackage::SelectPluginDlgProc(HWND hWnd, UINT uMsg, WPARAM
bool x32 = LOWORD(wParam) == IDC_PACKAGESELECTPLUGIN_32BITBROWSE_BUTTON; bool x32 = LOWORD(wParam) == IDC_PACKAGESELECTPLUGIN_32BITBROWSE_BUTTON;
LOADED_IMAGE* loadedImage = ImageLoad(ConvertToAscii(buffer).c_str(), NULL); LOADED_IMAGE* loadedImage = ImageLoad(ConvertToAscii(buffer).c_str(), nullptr);
if (loadedImage) if (loadedImage)
{ {
WORD machine = loadedImage->FileHeader->FileHeader.Machine; WORD machine = loadedImage->FileHeader->FileHeader.Machine;
@ -800,7 +800,7 @@ INT_PTR CALLBACK DialogPackage::SelectPluginDlgProc(HWND hWnd, UINT uMsg, WPARAM
// //
// ----------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------
DialogPackage::TabInfo::TabInfo(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_PACKAGEINFO_TAB, DlgProc) DialogPackage::TabInfo::TabInfo(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_PACKAGEINFO_TAB, DlgProc)
{ {
} }
@ -824,7 +824,7 @@ void DialogPackage::TabInfo::Initialize()
if (GetOSPlatform() >= OSPLATFORM_VISTA) if (GetOSPlatform() >= OSPLATFORM_VISTA)
{ {
extendedFlags |= LVS_EX_DOUBLEBUFFER; extendedFlags |= LVS_EX_DOUBLEBUFFER;
SetWindowTheme(item, L"explorer", NULL); SetWindowTheme(item, L"explorer", nullptr);
} }
ListView_EnableGroupView(item, TRUE); ListView_EnableGroupView(item, TRUE);
@ -1052,7 +1052,7 @@ INT_PTR DialogPackage::TabInfo::OnNotify(WPARAM wParam, LPARAM lParam)
// //
// ----------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------
DialogPackage::TabOptions::TabOptions(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_PACKAGEOPTIONS_TAB, DlgProc) DialogPackage::TabOptions::TabOptions(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_PACKAGEOPTIONS_TAB, DlgProc)
{ {
} }
@ -1061,7 +1061,7 @@ void DialogPackage::TabOptions::Initialize()
m_Initialized = true; m_Initialized = true;
WCHAR buffer[MAX_PATH]; WCHAR buffer[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, buffer); SHGetFolderPath(nullptr, CSIDL_DESKTOPDIRECTORY, nullptr, SHGFP_TYPE_CURRENT, buffer);
c_Dialog->m_TargetFile = buffer; c_Dialog->m_TargetFile = buffer;
c_Dialog->m_TargetFile += L'\\'; c_Dialog->m_TargetFile += L'\\';
@ -1292,7 +1292,7 @@ INT_PTR DialogPackage::TabOptions::OnCommand(WPARAM wParam, LPARAM lParam)
// //
// ----------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------
DialogPackage::TabAdvanced::TabAdvanced(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_PACKAGEADVANCED_TAB, DlgProc) DialogPackage::TabAdvanced::TabAdvanced(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_PACKAGEADVANCED_TAB, DlgProc)
{ {
} }