首页
社区
课程
招聘
[求助]360如何做到在win7下默认显示托盘图标的
发表于: 2015-7-22 19:24 11208

[求助]360如何做到在win7下默认显示托盘图标的

2015-7-22 19:24
11208
Win7下为了不让程序托盘侵占太多的右下角空间,默认把托盘图标隐藏在小箭头下。 有时候用户不知道某程序已经启动,
且隐藏在小箭头下了,所以就需要提示用户,比如QQ,酷狗都会弹出一个框框告诉用户把QQ的托盘设置出来。 但是有些
程序做到了默认显示,比如360,dropbox.

Ps:  小箭头打开后的用来保持隐藏的icon的控件是NotifyIconOverflowWindow控件下的ToolbarWindow32
        正常显示的控件是TrayNotifyWnd控件Syspager控件下的ToolbarWindow32控件
        两个都支持拖拽,感觉可以模拟拖拽,但是不知道怎么弄、。

此外国外还有一篇操作注册表(HKEY_Current_User\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify)的,
操作完后要重启explorer.exe这肯定不好,不知道大家有没有方法解决。

[课程]FART 脱壳王!加量不加价!FART作者讲授!

收藏
免费 0
支持
分享
最新回复 (18)
雪    币: 1088
活跃值: (30)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
2
啥?程序在操作系统上第一次运行都是默认隐藏在三角里面的
2015-7-22 19:32
0
雪    币: 3202
活跃值: (1917)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
大牛,你的 Mdebug 有没有最新版本下载?
2015-7-22 19:56
0
雪    币: 135
活跃值: (106)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
4
据说,.net提供了相关的api可以操作。
2015-7-22 21:58
0
雪    币: 209
活跃值: (138)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
分析一下拖动到外边的时候操作系统有哪些调用,然后自行达到这种效果,对360来说不算太难
2015-7-23 10:10
0
雪    币: 16
活跃值: (100)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
6
我记得我的程序可以做到,你找找
2015-7-23 10:58
0
雪    币: 44
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
7
什么程序?怎么做到的?
2015-7-23 15:32
0
雪    币: 44
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
8
360现在做到了。不知道他是怎么弄的
2015-7-23 15:34
0
雪    币: 6876
活跃值: (2738)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
控制面板里 通知区域图标  可以设的嘛  抓消息或者注册表的看下
2015-7-23 16:38
0
雪    币: 44
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
10
我说用程序实现。
2015-7-23 17:12
0
雪    币: 402
活跃值: (342)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
11
这是将qq的图标挪到前面显示的..真搞不懂qq还专门弄个提示框叫用户手动改..各大im还纷纷效仿.

#include "stdafx.h"

#include <conio.h>
#include <windows.h>
#include <Shlwapi.h>

#pragma comment(lib, "shlwapi.lib")

typedef struct tagNOTIFYITEM
{
    PWSTR pszExeName;
    PWSTR pszTip;
    HICON hIcon;
    HWND hWnd;
    DWORD dwPreference;
    UINT uID;
    GUID guidItem;
} NOTIFYITEM, *PNOTIFYITEM;

class __declspec(uuid("D782CCBA-AFB0-43F1-94DB-FDA3779EACCB")) INotificationCB : public IUnknown
{
    virtual HRESULT __stdcall Notify (ULONG, NOTIFYITEM *) = 0;
};

class __declspec(uuid("FB852B2C-6BAD-4605-9551-F15F87830935")) ITrayNotify : public IUnknown
{
public:
    virtual HRESULT __stdcall RegisterCallback(INotificationCB* callback) = 0;
    virtual HRESULT __stdcall SetPreference(const NOTIFYITEM* notify_item) = 0;
    virtual HRESULT __stdcall EnableAutoTray(BOOL enabled) = 0;
};

class __declspec(uuid("D133CE13-3537-48BA-93A7-AFCD5D2053B4")) ITrayNotifyWindows8 : public IUnknown
{
public:
    virtual HRESULT __stdcall RegisterCallback(INotificationCB* callback, unsigned long*) = 0;
    virtual HRESULT __stdcall UnregisterCallback(unsigned long*) = 0;
    virtual HRESULT __stdcall SetPreference(NOTIFYITEM const*) = 0;
    virtual HRESULT __stdcall EnableAutoTray(BOOL) = 0;
    virtual HRESULT __stdcall DoAction(BOOL) = 0;
};

const CLSID CLSID_TrayNotify = {0x25DEAD04, 0x1EAC, 0x4911, {0x9E, 0x3A, 0xAD, 0x0A, 0x4A, 0xB5, 0x60, 0xFD}};

class NotificationMgr : public INotificationCB
{
public:
    NotificationMgr(){
        m_pTrayNotify = NULL;
    }

    HRESULT __stdcall QueryInterface (
        REFIID riid,
        PVOID *ppv)
    {
        if (ppv == NULL) 
            return E_POINTER;

        if (riid == __uuidof (INotificationCB)) {
            *ppv = (INotificationCB *) this;
        }else if (riid == IID_IUnknown) {
            *ppv = (IUnknown *) this;
        }else{
            return E_NOINTERFACE;
        }

        ((IUnknown *) *ppv) -> AddRef ();

        return S_OK;
    }

    ULONG __stdcall AddRef (VOID)
    {
        return 1;
    }

    ULONG __stdcall Release (VOID)
    {
        return 1;
    }
    HRESULT __stdcall Notify (ULONG Event, NOTIFYITEM * NotifyItem){
        printf("event:%d Preference:%d id:%d path:%ls\n", Event, NotifyItem->dwPreference, NotifyItem->uID, NotifyItem->pszExeName);
        if (StrStrIW(NotifyItem->pszExeName, L"qq.exe")){
            if (m_pTrayNotify){
                NotifyItem->dwPreference = 2;
                m_pTrayNotify->SetPreference(NotifyItem);
            }
        }
        return S_OK;
    }

public:
    ITrayNotify * m_pTrayNotify;
};

int _tmain(int argc, _TCHAR* argv[])
{
    ITrayNotify *pTrayNotify;
    NOTIFYITEM NotifyItem = {0};
    NotificationMgr NotiMgr;

    CoInitialize(NULL);

    //
    // for win7
    //
    
    HRESULT hr = CoCreateInstance (
       CLSID_TrayNotify,
       NULL,
       CLSCTX_LOCAL_SERVER,
       __uuidof(ITrayNotify),
       (PVOID *)&pTrayNotify);
    
    if (!SUCCEEDED(hr)){
        printf("create instance of ITrayNotify error\n");
        return -1;
    }
    
    //
    // register callback
    //
    
    NotiMgr.m_pTrayNotify = pTrayNotify;
    hr = pTrayNotify->RegisterCallback(&NotiMgr);
    
    printf("over\n");

    pTrayNotify->RegisterCallback(NULL);
    pTrayNotify->Release();
    
    _getch();

	return 0;
}


2015-7-24 10:38
0
雪    币: 402
活跃值: (342)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
12
膜拜下写mingqq的大神..
2015-7-24 10:42
0
雪    币: 485
活跃值: (78)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
13
thx for share it ~~ but this code does not work
2015-7-24 11:54
0
雪    币: 402
活跃值: (342)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
14
把NotifyItem->dwPreference = 1;改成NotifyItem->dwPreference = 2;就好了
1是隐藏 2 是显示
2015-7-24 12:41
0
雪    币: 44
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
15
我测试了。怎么没效果,没办法把图标移动到前面
2015-7-24 12:44
0
雪    币: 44
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
16
果真可以,牛逼。谢谢了啊。大神
2015-7-24 12:46
0
雪    币: 402
活跃值: (342)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
17
我刚试了呀..可以呀..

之前


之后
上传的附件:
2015-7-24 12:50
0
雪    币: 44
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
18
厉害。。。我终于查到这资料了。其实chrome 里面已经有现成的代码,只是我们没发现。。。。
2015-7-24 13:15
0
雪    币: 22
活跃值: (52)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
19
MARK一下
2015-7-24 13:58
0
游客
登录 | 注册 方可回帖
返回
//