It is currently March 28th, 2024, 9:55 am

[Suggestion]!Focus bang

Report bugs with the Rainmeter application and suggest features.
Post Reply
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

[Suggestion]!Focus bang

Post by death.crafter »

I know it can be done through StealFocus.exe but it would be good if we could directly bring a skin to focus. So that we can use OnUnfocusAction without having to click the skin.

This doesn't need more explanation I guess. Can this be done?

Possible bang: [!Focus] or [!Focus "config"]
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Suggestion]!Focus bang

Post by Brian »

User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: [Suggestion]!Focus bang

Post by death.crafter »

Brian wrote: July 21st, 2021, 9:18 pm This has been discussed before.

https://forum.rainmeter.net/viewtopic.php?f=14&t=32520&p=162993&hilit=focus#p162993

-Brian
Ohh I see.

Btw, do you have any idea about which win32 api function is used to bring focus to skins? I tried to use SetFocus() and SetForegroundWindow() but they didn't work. Well, SetFocus() didn't work with Notepad either. But it returned the handles all right(the previous one in focus or foreground).

Here is the code I tried to use:

Code: Select all

param (
	[Parameter(mandatory)]
	$processTitle
)

$winApi = '
    	[DllImport("user32.dll")] public static extern int SetForegroundWindow(IntPtr hwnd);
'

$type = Add-Type -MemberDefinition $winApi -Name WindowAPI -PassThru

$hwnd = (Get-Process | Where MainWindowTitle -eq $processTitle | Select MainWindowHandle).MainWindowHandle

$type::SetForegroundWindow($hwnd)
The code here is not mine. I just copied some website.

Thanks in advance.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: [Suggestion]!Focus bang

Post by death.crafter »

Okay the ps1 above works.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany
Contact:

Re: [Suggestion]!Focus bang

Post by Active Colors »

Have you got your hands on trying this? https://forum.rainmeter.net/viewtopic.php?f=128&t=22839
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: [Suggestion]!Focus bang

Post by death.crafter »

User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany
Contact:

Re: [Suggestion]!Focus bang

Post by Active Colors »

This doesn't answer my question because "The requested topic does not exist" :d
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: [Suggestion]!Focus bang

Post by death.crafter »

Active Colors wrote: July 23rd, 2021, 8:25 pm This doesn't answer my question because "The requested topic does not exist" :d
https://forum.rainmeter.net/viewtopic.php?f=128&p=194080#p194080

Sorry, I had that post removed because the plugin was faulty.
Post Reply