It is currently March 29th, 2024, 12:47 am

Title active window

Get help with creating, editing & fixing problems with skins
hikamurachi
Posts: 10
Joined: August 17th, 2019, 5:14 pm

Title active window

Post by hikamurachi »

How to create a skin with dynamic title active window?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Title active window

Post by jsmorley »

I don't follow you at all.
hikamurachi
Posts: 10
Joined: August 17th, 2019, 5:14 pm

Re: Title active window

Post by hikamurachi »

I see
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Title active window

Post by jsmorley »

hikamurachi wrote: August 19th, 2019, 11:46 amI see
What I'm saying is that I don't understand your question. We need some more details on what you are trying to do.
hikamurachi
Posts: 10
Joined: August 17th, 2019, 5:14 pm

Re: Title active window

Post by hikamurachi »

https://imgur.com/dRlAhOU

Title active window on the skin.

I make plugin now, but problem with other languages. Need utf 8 for wstring or somthing else
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Title active window

Post by jsmorley »

I'm sorry, I don't understand at all what you are trying to do. If you can't elaborate, I'm afraid I can't help.
hikamurachi
Posts: 10
Joined: August 17th, 2019, 5:14 pm

Re: Title active window

Post by hikamurachi »

i have open window. This window have a name, like "New Folder 1" ... This name i'm need in rainmeter widget.
How to explain differently, idk.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Title active window

Post by jsmorley »

I imagine you will want something like this in your plugin...

Code: Select all

#include <windows.h>
#include <string>
using std::string;

string GetActiveWindowTitle()
{
 char wnd_title[256];
 HWND hwnd=GetForegroundWindow(); // get handle of currently active window
 GetWindowText(hwnd,wnd_title,sizeof(wnd_title));
 return wnd_title;
}
hikamurachi
Posts: 10
Joined: August 17th, 2019, 5:14 pm

Re: Title active window

Post by hikamurachi »

yep
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Title active window

Post by jsmorley »

Code: Select all

#include <Windows.h>
#include "../../API/RainmeterAPI.h"

struct Measure
{
	Measure() {}
};

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;
}

PLUGIN_EXPORT double Update(void* data)
{
	Measure* measure = (Measure*)data;
	return 0.0;
}

PLUGIN_EXPORT LPCWSTR GetString(void* data)
{
	Measure* measure = (Measure*)data;
	WCHAR wnd_title[1024];
	HWND hwnd = GetForegroundWindow(); // get handle of currently active window
	GetWindowText(hwnd, wnd_title, sizeof(wnd_title));
	return wnd_title;
}

//PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args)
//{
//	Measure* measure = (Measure*)data;
//}

//PLUGIN_EXPORT LPCWSTR (void* data, const int argc, const WCHAR* argv[])
//{
//	Measure* measure = (Measure*)data;
//	return nullptr;
//}

PLUGIN_EXPORT void Finalize(void* data)
{
	Measure* measure = (Measure*)data;
	delete measure;
}

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[PluginTest]
Measure=Plugin
Plugin=Empty

[MeterOne]
Meter=String
MeasureName=PluginTest
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1

1.jpg
You do not have the required permissions to view the files attached to this post.