Some minor fixes.

This commit is contained in:
Birunthan Mohanathas 2012-02-16 17:38:45 +00:00
parent bf27206d8c
commit b48791dd58
4 changed files with 13 additions and 13 deletions

View File

@ -43,5 +43,5 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
//_CrtSetBreakAlloc(000); //_CrtSetBreakAlloc(000);
return RainmeterMain(hInstance, lpCmdLine); return RainmeterMain(lpCmdLine);
} }

View File

@ -490,7 +490,7 @@ void CDialogAbout::CTabLog::AddItem(int level, LPCWSTR time, LPCWSTR message)
break; break;
case LOG_WARNING: case LOG_WARNING:
if (!m_Error) return; if (!m_Warning) return;
item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX); item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX);
vitem.iImage = 1; vitem.iImage = 1;
break; break;

View File

@ -50,7 +50,7 @@ CRainmeter* Rainmeter; // The module
** Initializes Rainmeter. ** Initializes Rainmeter.
** **
*/ */
int RainmeterMain(HINSTANCE hInstance, LPWSTR cmdLine) int RainmeterMain(LPWSTR cmdLine)
{ {
HWND wnd = NULL; HWND wnd = NULL;
while (wnd = FindWindowEx(NULL, wnd, RAINMETER_CLASS_NAME, RAINMETER_WINDOW_NAME)) while (wnd = FindWindowEx(NULL, wnd, RAINMETER_CLASS_NAME, RAINMETER_WINDOW_NAME))
@ -101,7 +101,7 @@ int RainmeterMain(HINSTANCE hInstance, LPWSTR cmdLine)
{ {
try try
{ {
ret = Rainmeter->Initialize(hInstance, cmdLine); ret = Rainmeter->Initialize(cmdLine);
} }
catch (CError& error) catch (CError& error)
{ {
@ -739,13 +739,15 @@ CRainmeter::~CRainmeter()
** May throw CErrors !!!! ** May throw CErrors !!!!
** **
*/ */
int CRainmeter::Initialize(HINSTANCE hInstance, LPCWSTR szPath) int CRainmeter::Initialize(LPCWSTR szPath)
{ {
int result = 0; int result = 0;
m_Instance = GetModuleHandle(L"Rainmeter");
WNDCLASS wc = {0}; WNDCLASS wc = {0};
wc.lpfnWndProc = (WNDPROC)MainWndProc; wc.lpfnWndProc = (WNDPROC)MainWndProc;
wc.hInstance = hInstance; wc.hInstance = m_Instance;
wc.lpszClassName = RAINMETER_CLASS_NAME; wc.lpszClassName = RAINMETER_CLASS_NAME;
RegisterClass(&wc); RegisterClass(&wc);
@ -760,13 +762,11 @@ int CRainmeter::Initialize(HINSTANCE hInstance, LPCWSTR szPath)
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL,
NULL, NULL,
hInstance, m_Instance,
NULL); NULL);
if (!m_Window) return 1; if (!m_Window) return 1;
m_Instance = hInstance;
WCHAR* tmpSzPath = new WCHAR[MAX_LINE_LENGTH]; WCHAR* tmpSzPath = new WCHAR[MAX_LINE_LENGTH];
GetModuleFileName(m_Instance, tmpSzPath, 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 // Test that the Rainmeter.ini file is writable
TestSettingsFile(bDefaultIniLocation); TestSettingsFile(bDefaultIniLocation);
CSystem::Initialize(hInstance); CSystem::Initialize(m_Instance);
CMeasureNet::InitializeNewApi(); CMeasureNet::InitializeNewApi();
if (m_Debug) if (m_Debug)

View File

@ -120,7 +120,7 @@ public:
CRainmeter(); CRainmeter();
~CRainmeter(); ~CRainmeter();
int Initialize(HINSTANCE hInstance, LPCWSTR szPath); int Initialize(LPCWSTR szPath);
int MessagePump(); int MessagePump();
void SetNetworkStatisticsTimer(); void SetNetworkStatisticsTimer();
@ -332,6 +332,6 @@ private:
#define EXPORT_PLUGIN EXTERN_C __declspec(dllimport) #define EXPORT_PLUGIN EXTERN_C __declspec(dllimport)
#endif #endif
EXPORT_PLUGIN int RainmeterMain(HINSTANCE Instance, LPWSTR cmdLine); EXPORT_PLUGIN int RainmeterMain(LPWSTR cmdLine);
#endif #endif