diff --git a/Application/Application.cpp b/Application/Application.cpp index c22b53a0..d8554c33 100644 --- a/Application/Application.cpp +++ b/Application/Application.cpp @@ -43,5 +43,5 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); //_CrtSetBreakAlloc(000); - return RainmeterMain(hInstance, lpCmdLine); + return RainmeterMain(lpCmdLine); } diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index 4cb48800..2e135bb8 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -490,7 +490,7 @@ void CDialogAbout::CTabLog::AddItem(int level, LPCWSTR time, LPCWSTR message) break; case LOG_WARNING: - if (!m_Error) return; + if (!m_Warning) return; item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX); vitem.iImage = 1; break; diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 9388e169..1359b301 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -50,7 +50,7 @@ CRainmeter* Rainmeter; // The module ** Initializes Rainmeter. ** */ -int RainmeterMain(HINSTANCE hInstance, LPWSTR cmdLine) +int RainmeterMain(LPWSTR cmdLine) { HWND wnd = NULL; while (wnd = FindWindowEx(NULL, wnd, RAINMETER_CLASS_NAME, RAINMETER_WINDOW_NAME)) @@ -101,7 +101,7 @@ int RainmeterMain(HINSTANCE hInstance, LPWSTR cmdLine) { try { - ret = Rainmeter->Initialize(hInstance, cmdLine); + ret = Rainmeter->Initialize(cmdLine); } catch (CError& error) { @@ -110,7 +110,7 @@ int RainmeterMain(HINSTANCE hInstance, LPWSTR cmdLine) if (ret == 0) { - ret = Rainmeter->MessagePump(); + ret = Rainmeter->MessagePump(); } delete Rainmeter; @@ -739,13 +739,15 @@ CRainmeter::~CRainmeter() ** May throw CErrors !!!! ** */ -int CRainmeter::Initialize(HINSTANCE hInstance, LPCWSTR szPath) +int CRainmeter::Initialize(LPCWSTR szPath) { int result = 0; + m_Instance = GetModuleHandle(L"Rainmeter"); + WNDCLASS wc = {0}; wc.lpfnWndProc = (WNDPROC)MainWndProc; - wc.hInstance = hInstance; + wc.hInstance = m_Instance; wc.lpszClassName = RAINMETER_CLASS_NAME; RegisterClass(&wc); @@ -760,13 +762,11 @@ int CRainmeter::Initialize(HINSTANCE hInstance, LPCWSTR szPath) CW_USEDEFAULT, NULL, NULL, - hInstance, + m_Instance, NULL); if (!m_Window) return 1; - m_Instance = hInstance; - WCHAR* tmpSzPath = new WCHAR[MAX_LINE_LENGTH]; GetModuleFileName(m_Instance, tmpSzPath, MAX_LINE_LENGTH); @@ -1007,7 +1007,7 @@ int CRainmeter::Initialize(HINSTANCE hInstance, LPCWSTR szPath) // Test that the Rainmeter.ini file is writable TestSettingsFile(bDefaultIniLocation); - CSystem::Initialize(hInstance); + CSystem::Initialize(m_Instance); CMeasureNet::InitializeNewApi(); if (m_Debug) diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index f39a1503..4a1a14f4 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -120,7 +120,7 @@ public: CRainmeter(); ~CRainmeter(); - int Initialize(HINSTANCE hInstance, LPCWSTR szPath); + int Initialize(LPCWSTR szPath); int MessagePump(); void SetNetworkStatisticsTimer(); @@ -332,6 +332,6 @@ private: #define EXPORT_PLUGIN EXTERN_C __declspec(dllimport) #endif -EXPORT_PLUGIN int RainmeterMain(HINSTANCE Instance, LPWSTR cmdLine); +EXPORT_PLUGIN int RainmeterMain(LPWSTR cmdLine); #endif