ウィンドウ内のブラウザのタスクバーのアイコンを変更する方法はありますか?

StackOverflow https://stackoverflow.com/questions/356883

質問

ウィンドウで、ブラウザのタスクバーアイコンを変更する方法はありますか?

私は、ブラウザウィンドウをたくさん開いて、私は窓によってグループ同様のウェブサイト(タブで)したいです。あなたがより簡単に区別できるように、彼らに、タスクバーのアイコンを割り当てる方法があったのであれば、私は思っていました。

役に立ちましたか?

解決

ここで私は特定のウィンドウ上のアイコンを変更するには5分以内にまとめ何か。あなたは簡単に、現在開いているウィンドウを列挙し、それらに任意のアイコンを割り当てることができるようになるWinフォームを作成するには、このコードを使用することができます。 (以下のC#コード)

[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr FindWindow(string strClassName, string strWindowName);

[DllImport("user32.dll",CharSet=CharSet.Auto)]  
private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam); 

[DllImport("user32.dll")] 
public static extern int DrawMenuBar(int currentWindow);


const int WM_GETICON = 0x7F;
const int WM_SETICON = 0x80;
const int ICON_SMALL = 0; //16
const int ICON_BIG = 1; //32

public static void SetIcon()
{
    //Load an icon. This has to be a *.ico.
    System.Drawing.Icon i = new Icon("path\to\icon");
    //Find the target window. The caption must be entered exactly 
    //as it appears in the title bar
    IntPtr hwnd = FindWindow(null, "Caption of Target Window");
    //Set the icon
    SendMessage(hwnd, WM_SETICON, (IntPtr)ICON_SMALL, (IntPtr)i.Handle);
    //Update the title bar with the new icon. Note: the taskbar will
    //update without this, you only need this if you want the title
    //bar to also display the new icon
    DrawMenuBar((int)hwnd);
}

他のヒント

私はタスクバーが実行可能ファイルに埋め込まれたアイコンリソースを使用しています信じています。私は、Internet Explorer、独自のショートカットアイコンとそれぞれに複数のショートカットを作成しようとしたが、それらはすべて、タスクバー上で開いたときに同じアイコンを持っています。

私は、ブラウザの実行可能ファイルの複数のインスタンスを実行する必要があるだろうと思うし、それぞれが異なる埋め込まれたアイコンリソースを持っている必要があります。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top