2013-07-16, 00:34
(2013-06-08, 14:50)regi100 Wrote: Thank you verry much, working now for me for xbmc in windowed mode!
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.)
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.