Page 1 of 1
[Suggestion]!Focus bang
Posted: July 21st, 2021, 7:08 am
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"]
Re: [Suggestion]!Focus bang
Posted: July 21st, 2021, 9:18 pm
by Brian
Re: [Suggestion]!Focus bang
Posted: July 22nd, 2021, 3:29 am
by death.crafter
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.
Re: [Suggestion]!Focus bang
Posted: July 22nd, 2021, 6:10 pm
by death.crafter
Okay the ps1 above works.
Re: [Suggestion]!Focus bang
Posted: July 23rd, 2021, 7:31 am
by Active Colors
Re: [Suggestion]!Focus bang
Posted: July 23rd, 2021, 6:04 pm
by death.crafter
Re: [Suggestion]!Focus bang
Posted: July 23rd, 2021, 8:25 pm
by Active Colors
This doesn't answer my question because "The requested topic does not exist" :d
Re: [Suggestion]!Focus bang
Posted: July 24th, 2021, 1:18 pm
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.