internet-explorer - 有没有办法改变windows浏览器任务栏图标?

标签 internet-explorer firefox browser add-in taskbar

有没有办法改变Windows浏览器的任务栏图标?

我打开了很多浏览器窗口,并且喜欢按窗口对类似的网站(在选项卡中)进行分组。所以我想知道是否有一种方法可以为它们分配任务栏图标,以便您可以更轻松地区分它们。

最佳答案

这是我在 5 分钟内完成的内容,用于更改特定窗口上的图标。您可以轻松地使用此代码创建一个 winform,它将枚举当前打开的窗口并允许您为它们分配任意图标。 (下面是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 - 有没有办法改变windows浏览器任务栏图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/356883/

相关文章:

javascript - 模拟 onChange 事件在 HTML 输入框上触发

javascript - 通过关注 URL 栏触发操作

javascript - 适用于浏览器和 Node.js 的 XML 解析器?

javascript - 在 Internet Explorer 中的打印页面模板中设置纸张大小

html - Bootstrap 字形图标未在 IE 和 Safari 中显示

html - 为什么 Internet Explorer 8 中没有底部填充?

javascript - window.open 在 Firefox 中无法正常工作

javascript - 选择对象在 Chrome contentEditable 元素中表现异常

firefox - 将脚本制作成 SSH 的最佳方法?

concurrency - 浏览器中的最大并发连接数到底意味着什么?