Code: Select all
"C:\Program Files\Rainmeter\Rainmeter.exe" !RainmeterWriteKeyValue Variables State1 Show "#SKINSPATH#Enigma\Taskbar\Toggle\Toggle.ini"
Code: Select all
"C:\Program Files\Rainmeter\Rainmeter.exe" !RainmeterWriteKeyValue Variables State1 Show "#SKINSPATH#Enigma\Taskbar\Toggle\Toggle.ini"
The easiest (and path independent) method would be to first find the Rainmeter tray window and then query the state of the skin from it. In the C++ code below, I'm checking if "Gnometer\Clock" is active.NictraSavios wrote:Edit: Okay, I'm halfway through writing this, and I hit a snag. How do I verify that the toggle widget is active and being used? (That way if enigma isn't being used, they won't turn it off.... [ and useless action] which may cause bugs for other themes, or they will be wondering why the one or two parts of enigma they use just disappeared)
Code: Select all
HWND hWndRainmeter = FindWindow(L"RainmeterTrayClass", NULL);
if (hWndRainmeter)
{
LPWSTR skinName = L"Gnometer\\Clock";
COPYDATASTRUCT cds;
cds.dwData = 5101; // RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE
cds.lpData = SkinName; cds.cbData = (wcslen(skinName) + 1) * 2;
HWND hWndSkin = (HWND)SendMessage(hWndRainmeter, WM_COPYDATA, (WPARAM) hWndYourWindow, (LPARAM) &cds);
if (hWndSkin)
{
// Skin active
}
}
poiru wrote: The easiest (and path independent) method would be to first find the Rainmeter tray window and then query the state of the skin from it. In the C++ code below, I'm checking if "Gnometer\Clock" is active.To get the skins path and/or path to Rainmeter.ini directly from Rainmeter, you can use the RAINMETER_QUERY_ID_SKINS_PATH and RAINMETER_QUERY_ID_SETTINGS_PATH messages (check this page). This requires that you create a window and process the WM_COPYDATA in its window procedure.Code: Select all
HWND hWndRainmeter = FindWindow(L"RainmeterTrayClass", NULL); if (hWndRainmeter) { LPWSTR skinName = L"Gnometer\\Clock"; COPYDATASTRUCT cds; cds.dwData = 5101; // RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE cds.lpData = SkinName; cds.cbData = (wcslen(skinName) + 1) * 2; HWND hWndSkin = (HWND)SendMessage(hWndRainmeter, WM_COPYDATA, (WPARAM) hWndYourWindow, (LPARAM) &cds); if (hWndSkin) { // Skin active } }
poiru wrote: The easiest (and path independent) method would be to first find the Rainmeter tray window and then query the state of the skin from it. In the C++ code below, I'm checking if "Gnometer\Clock" is active.To get the skins path and/or path to Rainmeter.ini directly from Rainmeter, you can use the RAINMETER_QUERY_ID_SKINS_PATH and RAINMETER_QUERY_ID_SETTINGS_PATH messages (check this page). This requires that you create a window and process the WM_COPYDATA in its window procedure.Code: Select all
HWND hWndRainmeter = FindWindow(L"RainmeterTrayClass", NULL); if (hWndRainmeter) { LPWSTR skinName = L"Gnometer\\Clock"; COPYDATASTRUCT cds; cds.dwData = 5101; // RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE cds.lpData = SkinName; cds.cbData = (wcslen(skinName) + 1) * 2; HWND hWndSkin = (HWND)SendMessage(hWndRainmeter, WM_COPYDATA, (WPARAM) hWndYourWindow, (LPARAM) &cds); if (hWndSkin) { // Skin active } }