2014-12-08 20 views
0

我使用工具欄按鈕在常規和專用窗口之間切換。 下面是代碼:Firefox - 使用ITaskbarList :: ActivateTab

OpenBrowserWindow({private: !PrivateBrowsingUtils.isWindowPrivate(window)}); 
setTimeout(BrowserTryToCloseWindow, 80); 

我爲了防止一些閃爍使用「setTimeout的」。

當新窗口打開時,它將獲得焦點。 執行命令'BrowserTryToCloseWindow'時,焦點返回到舊窗口。 當舊窗口關閉時,新窗口確實有焦點,但它在Windows任務欄中未被「檢查/激活」。

我想我需要使用ITaskbarList :: ActivateTab來激活任務欄中的新窗口。 我有(非常)基本方向:

Components.utils.import("resource://gre/modules/ctypes.jsm"); 
var lib = ctypes.open("shell32.dll"); 
var taskBar = lib.declare(--- 
taskBar--- 
lib.close(); 

我會很感激你的幫助。

贏7,32位經典主題。

Posted here too

回答

0

解決方案:

function togglePB(click) 

{ VAR爲newwin = OpenBrowserWindow({私人:PrivateBrowsingUtils.isWindowPrivate(窗口)});

if(click.button == 0) 
    newWin.addEventListener("focus", function switchWindows() { window.focus(); BrowserTryToCloseWindow(); newWin.removeEventListener("focus", switchWindows); }); 

}

http://forums.mozillazine.org/viewtopic.php?f=19&t=2895755