mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Reduced system resource usage.
This commit is contained in:
parent
e1aafc9705
commit
6dd79c451d
@ -71,7 +71,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
|
||||
HANDLE hMutex = NULL;
|
||||
MSG msg;
|
||||
BOOL bRet;
|
||||
HWND hWnd;
|
||||
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
// _CrtSetBreakAlloc(5055);
|
||||
@ -93,26 +92,11 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
|
||||
return RetSuccess;
|
||||
}
|
||||
|
||||
if (!hPrevInstance)
|
||||
{
|
||||
if (!InitApplication(hInstance, WinClass)) return RetError;
|
||||
}
|
||||
if (!InitApplication(hInstance, WinClass)) return RetError;
|
||||
|
||||
hWnd=InitInstance(hInstance, WinClass, WinName);
|
||||
HWND hWnd = InitInstance(hInstance, WinClass, WinName);
|
||||
if (!hWnd) return RetError;
|
||||
|
||||
// Remove quotes from the commandline
|
||||
WCHAR Path[MAX_PATH+1] = {0};
|
||||
if (lpCmdLine)
|
||||
{
|
||||
size_t Pos = 0;
|
||||
for (size_t i = 0, len = wcslen(lpCmdLine); i <= len && Pos < MAX_PATH; ++i)
|
||||
{
|
||||
if (lpCmdLine[i] != L'\"') Path[Pos++] = lpCmdLine[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check that the DLL is available and initialize it
|
||||
HMODULE module = GetModuleHandle(L"Rainmeter.dll");
|
||||
if (module == NULL || Initialize(hWnd, module, lpCmdLine) == 1)
|
||||
@ -149,17 +133,9 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
|
||||
*/
|
||||
BOOL InitApplication(HINSTANCE hInstance, const WCHAR* WinClass)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = (WNDPROC) MainWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
WNDCLASS wc = {0};
|
||||
wc.lpfnWndProc = (WNDPROC)MainWndProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_RAINMETER));
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = WinClass;
|
||||
|
||||
return RegisterClass(&wc);
|
||||
|
@ -230,11 +230,10 @@ CMeterWindow::~CMeterWindow()
|
||||
*/
|
||||
int CMeterWindow::Initialize(CRainmeter& Rainmeter)
|
||||
{
|
||||
WNDCLASSEX wc = {sizeof(WNDCLASSEX)};
|
||||
|
||||
m_Rainmeter = &Rainmeter;
|
||||
|
||||
// Register the windowclass
|
||||
WNDCLASSEX wc = {sizeof(WNDCLASSEX)};
|
||||
wc.style = CS_NOCLOSE | CS_DBLCLKS;
|
||||
wc.lpfnWndProc = WndProc;
|
||||
wc.hInstance = m_Rainmeter->GetInstance();
|
||||
|
@ -53,17 +53,9 @@ CTrayWindow::CTrayWindow(HINSTANCE instance) : m_Instance(instance),
|
||||
m_TrayPos(),
|
||||
m_TrayIconEnabled(true)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
wc.style = 0;
|
||||
WNDCLASS wc = {0};
|
||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = instance;
|
||||
wc.hIcon = LoadIcon(instance, MAKEINTRESOURCE(IDI_WINDOW));
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = L"RainmeterTrayClass";
|
||||
|
||||
RegisterClass(&wc);
|
||||
|
Loading…
Reference in New Issue
Block a user