It is currently July 27th, 2021, 3:04 pm

[Suggestion]!Focus bang

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

[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"]
from the Realm of Death
My Current Desktop
User avatar
Brian
Developer
Posts: 2210
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Suggestion]!Focus bang

Post by Brian »

User avatar
death.crafter
Posts: 501
Joined: April 24th, 2021, 8:13 pm

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.
from the Realm of Death
My Current Desktop
User avatar
death.crafter
Posts: 501
Joined: April 24th, 2021, 8:13 pm

Re: [Suggestion]!Focus bang

Post by death.crafter »

Okay the ps1 above works.
from the Realm of Death
My Current Desktop
User avatar
Active Colors
Moderator
Posts: 807
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

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
Posts: 501
Joined: April 24th, 2021, 8:13 pm

Re: [Suggestion]!Focus bang

Post by death.crafter »

from the Realm of Death
My Current Desktop
User avatar
Active Colors
Moderator
Posts: 807
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

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
Posts: 501
Joined: April 24th, 2021, 8:13 pm

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.
from the Realm of Death
My Current Desktop