diff --git a/Application/Application.rc b/Application/Application.rc index 6f1691cc..a6651a7b 100644 --- a/Application/Application.rc +++ b/Application/Application.rc @@ -28,8 +28,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,0,448 - PRODUCTVERSION 1,3,0,448 + FILEVERSION 1,3,0,451 + PRODUCTVERSION 1,3,0,451 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BLOCK "040b04b0" BEGIN VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter" - VALUE "FileVersion", "1, 3, 0, 442" + VALUE "FileVersion", "1, 3, 0, 451" VALUE "InternalName", "Rainmeter" VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy" VALUE "OriginalFilename", "Rainmeter.exe" VALUE "ProductName", "Rainmeter" - VALUE "ProductVersion", "1, 3, 0, 442" + VALUE "ProductVersion", "1, 3, 0, 451" END END BLOCK "VarFileInfo" diff --git a/Library/RainmeterQuery.h b/Library/RainmeterQuery.h index 06948175..c574fd10 100644 --- a/Library/RainmeterQuery.h +++ b/Library/RainmeterQuery.h @@ -19,6 +19,7 @@ /* Rainmeter query interface based on Window Message +The majority of the queries work as detailed below, other queries are explained along with their definitions. Usage: 1) Post the query to Rainmeter (E.g. QueryRainmeterSkinsPath function) * target window : Rainmeter(TrayWindow) @@ -28,7 +29,7 @@ Usage: 2) Retrieve the data received from Rainmeter, on WM_COPYDATA * COPYDATASTRUCT->dwData : QUERY ID (RAINMETER_QUERY_ID_XXXXX) - * COPYDATASTRUCT->lpData : requested string in wide char + * COPYDATASTRUCT->lpData : requested information. Form depends on you request. * COPYDATASTRUCT->cbData : size of lpData ----- @@ -79,10 +80,56 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) #define RAINMETER_QUERY_WINDOW_NAME NULL #define WM_QUERY_RAINMETER WM_APP + 1000 +#define WM_QUERY_RAINMETER_RETURN WM_APP + 1001 -// QUERY IDs +/* +QUERY IDs +These Queries return a string in a wide char format +*/ #define RAINMETER_QUERY_ID_SKINS_PATH 4101 #define RAINMETER_QUERY_ID_SETTINGS_PATH 4102 #define RAINMETER_QUERY_ID_PLUGINS_PATH 4103 +#define RAINMETER_QUERY_ID_PROGRAM_PATH 4104 +#define RAINMETER_QUERY_ID_LOG_PATH 4105 +#define RAINMETER_QUERY_ID_CONFIG_EDITOR 4106 +#define RAINMETER_QUERY_ID_COMMAND_LINE 4107 +#define RAINMETER_QUERY_ID_STATS_DATE 4108 +#define RAINMETER_QUERY_ID_TRAY_EX_L 4109 +#define RAINMETER_QUERY_ID_TRAY_EX_R 4110 +#define RAINMETER_QUERY_ID_TRAY_EX_M 4111 +#define RAINMETER_QUERY_ID_TRAY_EX_DL 4112 +#define RAINMETER_QUERY_ID_TRAY_EX_DR 4113 +#define RAINMETER_QUERY_ID_TRAY_EX_DM 4114 + +/* +These Queries return a numerical value in a direct message, the data +is stored in the lParam of the message sent to your window, and the msg section +will contain WM_QUERY_RAINMETER_RETURN +*/ +#define RAINMETER_QUERY_ID_VERSION_CHECK 4115 //0 for disabled, 1 for checking, 2 for new version available +#define RAINMETER_QUERY_ID_IS_DEBUGGING 4116 +#define RAINMETER_QUERY_ID_IS_LITESTEP 4117 + +/*QUERY IDs used with WM_COPYDATA +Usage: Send a WM_COPYDATA message to rainmeter via SendMessage(). +Rainmeter will set the return value depending on the contents +of the COPYDATASTRUCT. +*/ +#define RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE 5101 + +/* +This Retuns the Window Handle of the active skin requested by config name in cds.lpData, +or NULL if the config is not loaded. Currently, the config name is Case-Sensitive. + +To requst the data, send a message to Rainmeter in a way similar to this example. +COPYDATASTRUCT cds; +LPWSTR SkinName = L"Gnometer\\Clock"; + +cds.dwData = 5101; +cds.lpData = SkinName; +cds.cbData = (wcslen(SkinName) + 1) * 2; + +HWND hWndMeter = (HWND) SendMessage(hWndRainmeter, WM_COPYDATA, (WPARAM) hWndYourWindow, (LPARAM) &cds); +*/ #endif diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index ec0d2af6..02419022 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -665,6 +665,202 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA return 0; } + else if(wParam == RAINMETER_QUERY_ID_PROGRAM_PATH) + { + std::wstring path = Rainmeter->GetPath(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_PROGRAM_PATH; + cds.cbData = (path.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) path.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_LOG_PATH) + { + std::wstring path = Rainmeter->GetLogFile(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_LOG_PATH; + cds.cbData = (path.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) path.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_CONFIG_EDITOR) + { + std::wstring editor = Rainmeter->GetConfigEditor(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_CONFIG_EDITOR; + cds.cbData = (editor.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) editor.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_COMMAND_LINE) + { + std::wstring commandline = Rainmeter->GetCommandLine(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_COMMAND_LINE; + cds.cbData = (commandline.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) commandline.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_VERSION_CHECK) + { + UINT versioncheck = (Rainmeter->GetDisableVersionCheck() * (Rainmeter->GetDisableVersionCheck() + Rainmeter->GetNewVersion())); + + SendMessage((HWND)lParam, WM_QUERY_RAINMETER_RETURN, (WPARAM)hWnd, (LPARAM) versioncheck); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_IS_DEBUGGING) + { + BOOL debug = Rainmeter->GetDebug(); + + SendMessage((HWND)lParam, WM_QUERY_RAINMETER_RETURN, (WPARAM)hWnd, (LPARAM) debug); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_STATS_DATE) + { + std::wstring date = Rainmeter->GetStatsDate(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_STATS_DATE; + cds.cbData = (date.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) date.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_L) + { + std::wstring tray = Rainmeter->GetTrayExecuteL(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_L; + cds.cbData = (tray.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) tray.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_R) + { + std::wstring tray = Rainmeter->GetTrayExecuteR(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_R; + cds.cbData = (tray.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) tray.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_M) + { + std::wstring tray = Rainmeter->GetTrayExecuteM(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_M; + cds.cbData = (tray.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) tray.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DL) + { + std::wstring tray = Rainmeter->GetTrayExecuteDL(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DL; + cds.cbData = (tray.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) tray.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DR) + { + std::wstring tray = Rainmeter->GetTrayExecuteDR(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DR; + cds.cbData = (tray.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) tray.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DM) + { + std::wstring tray = Rainmeter->GetTrayExecuteDM(); + + COPYDATASTRUCT cds; + + cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DM; + cds.cbData = (tray.size() + 1) * sizeof(wchar_t); + cds.lpData = (LPVOID) tray.c_str(); + + SendMessage((HWND)lParam, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); + + return 0; + } + else if(wParam == RAINMETER_QUERY_ID_IS_LITESTEP) + { + BOOL islitestep = !Rainmeter->GetDummyLitestep(); + + SendMessage((HWND)lParam, WM_QUERY_RAINMETER_RETURN, (WPARAM)hWnd, (LPARAM) islitestep); + + return 0; + } + } + return 1; + + case WM_COPYDATA: + if(Rainmeter) + { + COPYDATASTRUCT *cds = (COPYDATASTRUCT*) lParam; + if(cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE) + { + std::wstring SkinName((LPTSTR) cds->lpData); + std::map MeterWindows = Rainmeter->GetAllMeterWindows(); + std::map::const_iterator iter = MeterWindows.find(SkinName); + if(iter != MeterWindows.end()) + { + return (LRESULT) iter->second->GetWindow(); + } + return NULL; + } } return 1; diff --git a/revision-number.h b/revision-number.h index 19ae5ea7..e3ce7547 100644 --- a/revision-number.h +++ b/revision-number.h @@ -1,2 +1,2 @@ #pragma once -const int revision_number = 448; \ No newline at end of file +const int revision_number = 451; \ No newline at end of file