Win XBMCLauncher / Launcher4Kodi - All in One Tool for Change Shell, Set Focus and more
(2013-06-08, 14:50)regi100 Wrote: Thank you verry much, working now for me for xbmc in windowed mode! Blush

But when i switch xbmc to fullscreen and reboot my machine, xbmc stays in the taskbar marked as active. I have to click on it once, then it shows up.
Why so? Why will it not be presented in fullscreen mode by default?
(i am not starting in shell mode.)Huh

I was recently seeing this problem as well, but don't recall changing my screen mode for XBMC (always had it set to fullscreen mode). I wasn't really sure what was going on, but was seeing the same exact issue: you see the window become "active" in the taskbar (indented, slightly darker grey), but XBMC never goes full screen. I confirmed that every time XBMCLauncher checked focus, this occurred for me - i.e. it failed to bring XBMC in to focus.

I've been playing with the script and read some threads about the "WinActivate" call being flaky at times. The suggested solution was to use a Windows API call instead to bring the window in to focus. I also found another suggestion to use the "#WinActivateForce" directive (goes at the top of the script file with the other "#" directives), but I decided not to use this unless I found that my solution below was not enough to fix things.

In the end, I modified the "SendFocus()" routine to first try the original method of bringing XBMC in to focus, and if that fails, it attempts another method. I believe this will be a more robust method of focusing XBMC. I also tested this with both windowed and the "regular" fullscreen mode for XBMC.

Code:
SendFocus()
{
    Process, Exist, xbmc.exe ; check to see if xbmc.exe is running
    If (ErrorLevel >= 1 and BreakFocus = 0)
    {
        IfWinNotActive, ahk_class XBMC ;if xbmc is not active
        {
            WinActivate, ahk_class XBMC ;activate xbmc

            ; Try a second method if the previous method did not work
            IfWinNotActive, ahk_class XBMC ;if xbmc is not active
            {
                ; This is supposed to be a more reliable way of bringing the window to the foreground
                WinGet, hWnd, ID, ahk_class XBMC
                WinRestore, ahk_class XBMC
                DllCall("SetForegroundWindow", UInt, hWnd)
            }
        }
    }
            
}

I'll leave it to the XBMCLauncher author to decide if he wants to pull this in to the official XBMCLauncher code base and approve it for release.
Reply


Messages In This Thread
green start button remapping - by Cassiel - 2013-02-12, 21:44
RE: XBMC Launcher - by Govnah - 2013-02-16, 06:32
RE: XBMCLauncher - by MBulli - 2013-02-17, 12:20
RE: XBMCLauncher - All in One Tool for Change Shell, Set Focus and more - by onyx00 - 2013-07-16, 00:34
Launcher4Kodi - by baijuxavior - 2015-02-17, 15:27
lack of focus - by runey71 - 2015-02-18, 07:53
black screen problem - by -CraZed- - 2015-03-18, 06:36
RE: XBMCLauncher / Launcher4Kodi - by TB4875 - 2015-03-25, 11:49
RE: XBMCLauncher / Launcher4Kodi - by kmarq - 2015-05-19, 14:41
Error - by liamp - 2015-05-31, 23:03
RE: XBMCLauncher / Launcher4Kodi - by gitman - 2015-06-07, 21:40
RE: XBMCLauncher / Launcher4Kodi - by RockerC - 2015-06-16, 16:28
RE: Using Tweak UAC - by berkhornet - 2015-07-13, 19:04
RE: - by alsergo - 2015-11-25, 00:11
W10 and netflix - by Cassiuss - 2016-01-10, 15:50
netflix - by Cassiuss - 2016-01-11, 09:11
netflix - by Cassiuss - 2016-01-11, 11:12
netflix - by Cassiuss - 2016-01-11, 13:04
netflix - by Cassiuss - 2016-01-11, 11:44
Reverse shell to explorer - by shayosef - 2016-01-17, 14:24
Launcher4Kodi improvement - by kalhimeo - 2016-01-27, 20:20
resume during recording kodi - by eddedrukker - 2016-04-03, 08:58
RE: XBMCLauncher / Launcher4Kodi - by leezy88 - 2017-02-06, 09:41
Might be of use to someone... - by Grumpy - 2017-09-19, 04:18
Logout Mark Read Team Forum Stats Members Help
XBMCLauncher / Launcher4Kodi - All in One Tool for Change Shell, Set Focus and more20