Partly reverted r975 (restored Rainmeter.dll).

This commit is contained in:
Birunthan Mohanathas
2011-09-29 06:04:20 +00:00
parent a087fbe5f8
commit 1493aec2a1
14 changed files with 640 additions and 106 deletions

View File

@ -1,356 +0,0 @@
/*
Copyright (C) 2001 Kimmo Pekkola
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define _CRTDBG_MAP_ALLOC
#include "StdAfx.h"
#include "resource.h"
#include "Rainmeter.h"
#include "TrayWindow.h"
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
extern CRainmeter* Rainmeter;
void Bang(const WCHAR* command);
BOOL InitApplication(HINSTANCE hInstance, const WCHAR* WinClass);
HWND InitInstance(HINSTANCE hInstance, const WCHAR* WinClass, const WCHAR* WinName);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
BOOL IsRunning(HANDLE* hMutex);
const WCHAR* WinClass = L"DummyRainWClass";
const WCHAR* WinName = L"Rainmeter control window";
enum RetValue
{
RetSuccess = 0,
RetError = 1
};
/*
** WinMain
**
** The Main-function
**
*/
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
HANDLE hMutex = NULL;
MSG msg;
BOOL bRet;
HWND hWnd;
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
// _CrtSetBreakAlloc(5055);
// Avoid loading a dll from current directory
SetDllDirectory(L"");
if (lpCmdLine && lpCmdLine[0] == L'!')
{
// It's a !bang
Bang(lpCmdLine);
return RetSuccess;
}
// Check whether Rainmeter.exe is already running
if (IsRunning(&hMutex))
{
//MessageBox(NULL, L"Rainmeter.exe is already running.", L"Rainmeter", MB_ICONWARNING | MB_TOPMOST | MB_OK);
return RetSuccess;
}
if (!hPrevInstance)
{
if (!InitApplication(hInstance, WinClass)) return RetError;
}
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];
}
}
int result = 1;
try
{
Rainmeter = new CRainmeter;
if (Rainmeter)
{
result = Rainmeter->Initialize(hWnd, hInstance, lpCmdLine);
}
}
catch (CError& error)
{
MessageBox(hWnd, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
}
if (result == 1)
{
DestroyWindow(hWnd);
}
else
{
// Run the standard window message loop
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
{
if (bRet == -1) // error
{
CRainmeter::Quit();
break;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
if (hMutex) ReleaseMutex(hMutex);
return (int)msg.wParam;
}
/*
** InitApplication
**
** Creates the windowclass
**
*/
BOOL InitApplication(HINSTANCE hInstance, const WCHAR* WinClass)
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOW));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = WinClass;
return RegisterClass(&wc);
}
/*
** InitInstance
**
** Creates the window. This is just an invisible window. The real window
** is created by the DLL.
**
*/
HWND InitInstance(HINSTANCE hInstance, const WCHAR* WinClass, const WCHAR* WinName)
{
return CreateWindowEx(
WS_EX_TOOLWINDOW,
WinClass,
WinName,
WS_POPUP | WS_DISABLED,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL
);
}
/*
** Bang
**
** Sends bangs to the DLL
**
*/
void Bang(const WCHAR* command)
{
// Check if Rainmeter is running
HWND wnd = FindWindow(WinClass, WinName);
if (wnd != NULL)
{
COPYDATASTRUCT copyData;
copyData.dwData = 1;
copyData.cbData = (DWORD)((wcslen(command) + 1) * sizeof(WCHAR));
copyData.lpData = (void*)command;
// Send the bang to the Rainmeter window
SendMessage(wnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&copyData);
}
else
{
if (_wcsicmp(L"!rainmeterquit", command) != 0 &&
_wcsicmp(L"!quit", command) != 0)
{
MessageBox(NULL, L"Rainmeter is not running.\nUnable to send the !bang to it.", L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONERROR);
}
}
}
/*
** RmLoadSystemLibrary
**
** Loads a system dll from system32 directory.
**
*/
HMODULE RmLoadSystemLibrary(LPCWSTR lpLibFileName)
{
WCHAR buffer[MAX_PATH];
std::wstring path;
if (GetSystemDirectory(buffer, MAX_PATH))
{
path = buffer;
path += L"\\";
path += lpLibFileName;
return LoadLibrary(path.c_str());
}
return NULL;
}
/*
** IsRunning
**
** Checks whether Rainmeter.exe is running.
**
*/
BOOL IsRunning(HANDLE* hMutex)
{
typedef struct
{
ULONG i[2];
ULONG buf[4];
unsigned char in[64];
unsigned char digest[16];
} MD5_CTX;
typedef void (WINAPI *FPMD5INIT)(MD5_CTX *context);
typedef void (WINAPI *FPMD5UPDATE)(MD5_CTX *context, const unsigned char *input, unsigned int inlen);
typedef void (WINAPI *FPMD5FINAL)(MD5_CTX *context);
// Create MD5 digest from command line
HMODULE hCryptDll = RmLoadSystemLibrary(L"cryptdll.dll");
if (!hCryptDll) // Unable to check the mutex
{
*hMutex = NULL;
return FALSE;
}
FPMD5INIT MD5Init = (FPMD5INIT)GetProcAddress(hCryptDll, "MD5Init");
FPMD5UPDATE MD5Update = (FPMD5UPDATE)GetProcAddress(hCryptDll, "MD5Update");
FPMD5FINAL MD5Final = (FPMD5FINAL)GetProcAddress(hCryptDll, "MD5Final");
if (!MD5Init || !MD5Update || !MD5Final) // Unable to check the mutex
{
FreeLibrary(hCryptDll);
*hMutex = NULL;
return FALSE;
}
std::wstring cmdLine = GetCommandLine();
std::transform(cmdLine.begin(), cmdLine.end(), cmdLine.begin(), ::towlower);
MD5_CTX ctx = {0};
MD5Init(&ctx);
MD5Update(&ctx, (LPBYTE)cmdLine.c_str(), cmdLine.length() * sizeof(WCHAR));
MD5Final(&ctx);
FreeLibrary(hCryptDll);
// Convert MD5 digest to mutex string (e.g. "Rainmeter@0123456789abcdef0123456789abcdef")
const WCHAR szHexTable[] = L"0123456789abcdef";
WCHAR szMutex[64] = {0};
wcscpy(szMutex, L"Rainmeter@");
WCHAR* pos = szMutex + wcslen(szMutex);
for (size_t i = 0; i < 16; ++i)
{
*(pos++) = *(szHexTable + ((ctx.digest[i] >> 4) & 0xF));
*(pos++) = *(szHexTable + (ctx.digest[i] & 0xF));
}
// Create mutex
HANDLE hMutexTemp = CreateMutex(NULL, FALSE, szMutex);
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
// Rainmeter.exe is already running
*hMutex = NULL;
return TRUE;
}
// Rainmeter.exe is not running
*hMutex = hMutexTemp;
return FALSE;
}
/*
** WndProc
**
** The main window procedure
**
*/
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
{
CRainmeter::Quit();
PostQuitMessage(0);
}
break;
case WM_COPYDATA:
{
COPYDATASTRUCT* cds = (COPYDATASTRUCT*)lParam;
if (Rainmeter && cds && (cds->dwData == 1) && (cds->cbData > 0) && cds->lpData)
{
ExecuteBang((LPCWSTR)cds->lpData);
}
}
break;
default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}

View File

@ -31,11 +31,11 @@ BEGIN
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileDescription", "Rainmeter"
VALUE "FileDescription", "Rainmeter Core Library"
VALUE "FileVersion", STRFILEVER
VALUE "InternalName", "Rainmeter"
VALUE "LegalCopyright", "Copyright (C) 2011 - All authors"
VALUE "OriginalFilename", "Rainmeter.exe"
VALUE "OriginalFilename", "Rainmeter.dll"
VALUE "ProductName", "Rainmeter"
#ifdef _WIN64
VALUE "ProductVersion", STRPRODUCTVER " (64-bit)"

View File

@ -20,30 +20,29 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BE9D2400-7F1C-49D6-8498-5CE495491AD6}</ProjectGuid>
<ProjectName>Application</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(SolutionDir)\Rainmeter.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>$(COMPILER64)</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>$(COMPILER64)</PlatformToolset>
@ -96,7 +95,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>lua/include;lua/lua;lua/tolua++;lua/glue;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;HAVE_CONFIG_H;SUPPORT_UTF8;LIBRARY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;SUPPORT_UTF8;LIBRARY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@ -117,14 +116,12 @@
</ResourceCompile>
<Link>
<AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../TestBench/x32/Debug/Rainmeter.exe</OutputFile>
<OutputFile>../TestBench/x32/Debug/Rainmeter.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\x32/Debug/Rainmeter.pdb</ProgramDatabaseFile>
<ImportLibrary>.\x32/Debug/Rainmeter.lib</ImportLibrary>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
@ -141,7 +138,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>lua/include;lua/lua;lua/tolua++;lua/glue;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;HAVE_CONFIG_H;SUPPORT_UTF8;LIBRARY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;SUPPORT_UTF8;LIBRARY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@ -162,14 +159,12 @@
</ResourceCompile>
<Link>
<AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../TestBench/x64/Debug/Rainmeter.exe</OutputFile>
<OutputFile>../TestBench/x64/Debug/Rainmeter.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\x64/Debug/Rainmeter.pdb</ProgramDatabaseFile>
<ImportLibrary>.\x64/Debug/Rainmeter.lib</ImportLibrary>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
@ -187,7 +182,7 @@
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>lua/include;lua/lua;lua/tolua++;lua/glue;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBRARY_EXPORTS;HAVE_CONFIG_H;SUPPORT_UTF8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBRARY_EXPORTS;HAVE_CONFIG_H;SUPPORT_UTF8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -203,7 +198,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4018;4090;4114;4267;4334;4351;4786;4800;4996</DisableSpecificWarnings>
<AdditionalOptions>/GL /GA %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/GL %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -211,14 +206,12 @@
</ResourceCompile>
<Link>
<AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../TestBench/x32/Release/Rainmeter.exe</OutputFile>
<OutputFile>../TestBench/x32/Release/Rainmeter.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>lua/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\x32/Release/Rainmeter.pdb</ProgramDatabaseFile>
<ImportLibrary>.\x32/Release/Rainmeter.lib</ImportLibrary>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
<MergeSections>.rdata=.text</MergeSections>
<OptimizeReferences>true</OptimizeReferences>
@ -236,11 +229,11 @@
</HeaderFileName>
</Midl>
<ClCompile>
<AdditionalOptions>/GL /GA %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/GL %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<AdditionalIncludeDirectories>lua/include;lua/lua;lua/tolua++;lua/glue;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBRARY_EXPORTS;HAVE_CONFIG_H;SUPPORT_UTF8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBRARY_EXPORTS;HAVE_CONFIG_H;SUPPORT_UTF8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -261,13 +254,11 @@
<Link>
<AdditionalOptions>/LTCG %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>../TestBench/x64/Release/Rainmeter.exe</OutputFile>
<OutputFile>../TestBench/x64/Release/Rainmeter.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>.\x64/Release/Rainmeter.pdb</ProgramDatabaseFile>
<ImportLibrary>.\x64/Release/Rainmeter.lib</ImportLibrary>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
<TargetMachine>MachineX64</TargetMachine>
<MergeSections>.rdata=.text</MergeSections>
<OptimizeReferences>true</OptimizeReferences>
@ -275,7 +266,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Application.cpp" />
<ClCompile Include="ConfigParser.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>

View File

@ -357,9 +357,6 @@
<ClCompile Include="DialogManage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Application.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ConfigParser.h">

View File

@ -134,6 +134,48 @@ std::vector<std::wstring> CRainmeter::ParseString(LPCTSTR str)
return result;
}
/*
** Initialize
**
** Initializes Rainmeter
**
*/
int Initialize(HWND hWnd, HINSTANCE hInstance, LPCWSTR lpCmdLine)
{
int result = 1;
try
{
Rainmeter = new CRainmeter;
if (Rainmeter)
{
result = Rainmeter->Initialize(hWnd, hInstance, lpCmdLine);
}
}
catch (CError& error)
{
MessageBox(hWnd, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
}
return result;
}
/*
** Quit
**
** Quits Rainmeter.
**
*/
void Quit()
{
if (Rainmeter)
{
delete Rainmeter;
Rainmeter = NULL;
}
}
/*
** ExecuteBang
**
@ -1161,21 +1203,6 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
return result; // Alles OK
}
/*
** Quit
**
** Quits Rainmeter.
**
*/
void CRainmeter::Quit()
{
if (Rainmeter)
{
delete Rainmeter;
Rainmeter = NULL;
}
}
/*
** CreateDefaultConfigFile
**

View File

@ -94,7 +94,6 @@ public:
~CRainmeter();
int Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath);
static void Quit();
CConfigParser* GetCurrentParser() { return m_CurrentParser; }
void SetCurrentParser(CConfigParser* parser) { m_CurrentParser = parser; }
@ -274,6 +273,17 @@ private:
GlobalConfig m_GlobalConfig;
};
void ExecuteBang(LPCTSTR szBang);
#ifdef LIBRARY_EXPORTS
#define EXPORT_PLUGIN __declspec(dllexport)
#else
#define EXPORT_PLUGIN __declspec(dllimport)
#endif
extern "C"
{
EXPORT_PLUGIN int Initialize(HWND hWnd, HINSTANCE hInstance, LPCWSTR lpCmdLine);
EXPORT_PLUGIN void Quit();
EXPORT_PLUGIN void ExecuteBang(LPCTSTR szBang);
}
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -474,7 +474,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
else if (wParam == ID_CONTEXT_QUIT)
{
PostQuitMessage(0);
CRainmeter::Quit();
Quit();
}
else if (wParam == ID_CONTEXT_OPENSKINSFOLDER)
{