How to get value from a custom made plugin
Posted: July 4th, 2021, 11:17 am
Hi, I tried to write a plugin that returns a string Hour: Minutes
I don't know how to get it to my ini file
I believe this is the API to call ?
RmReadString(rm, measure->Str.c_str(), L"Not Working");
The code is under:
PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) Function
Short Explanation Of The Code:
1. Getting Hours and Minute with window API
2.Store it into Measure struct as wide string
3.call RmReadString function using WideString inside Struct as a argument
Thank you.
I don't know how to get it to my ini file
I believe this is the API to call ?
RmReadString(rm, measure->Str.c_str(), L"Not Working");
The code is under:
PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) Function
Short Explanation Of The Code:
1. Getting Hours and Minute with window API
2.Store it into Measure struct as wide string
3.call RmReadString function using WideString inside Struct as a argument
Code: Select all
#include <Windows.h>
#include "../../API/RainmeterAPI.h"
#include <string>
struct Measure
{
SYSTEMTIME lt;
std::wstring Str;
Measure()
{
GetLocalTime(<);
}
};
PLUGIN_EXPORT void Initialize(void** data, void* rm)
{
Measure* measure = new Measure;
*data = measure;
}
PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
{
Measure* measure = (Measure*)data;
unsigned short Hours = measure->lt.wHour;
unsigned short Minutes = measure->lt.wMinute;
measure->Str = std::wstring(Hours + L":" + Minutes);
LPCWSTR value = RmReadString(rm, measure->Str.c_str(), L"Not Working");
}
PLUGIN_EXPORT double Update(void* data)
{
Measure* measure = (Measure*)data;
return 0.0;
}
PLUGIN_EXPORT LPCWSTR GetString(void* data)
{
Measure* measure = (Measure*)data;
return L"";
}
PLUGIN_EXPORT void Finalize(void* data)
{
Measure* measure = (Measure*)data;
delete measure;
}