如何在不重新启动资源管理器进程的情况下删除桌面带并删除其 dll? [英] how can i remove a deskband and delete its dll without restart the explorer process?

查看:37
本文介绍了如何在不重新启动资源管理器进程的情况下删除桌面带并删除其 dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在任务栏上创建了一个桌带.当我想更新deskband的DLL时,我隐藏了它,注销了它,但不幸的是资源管理器仍然把这个DLL保留在内存中.

I created a deskband on taskbar. When I want to update the DLL of the deskband, I hide it , unregister it,but unfortunately the explorer still keeps this DLL in the memory.

如何在不重启资源管理器进程的情况下更新 dll?有没有针对这种情况的 Windows api?

How can I update the dll without restart the explorer process? There is any Windows api for such a case?

推荐答案

不支持"(又名 hack)解决方案 (C/C++):

"Unsupported" (aka hack) solution (C/C++):

HWND hWnd = FindWindowW(L"Shell_TrayWnd", NULL);
if (hWnd != NULL)
    PostMessageW(hWnd, WM_TIMER, 0x18, 0);

这将强制在资源管理器进程中调用 CoFreeUnusedLibraries 函数.

This will force the call of CoFreeUnusedLibraries function in the explorer process.

在 Windows 7 Ultimate SP1 64 位和 Windows XP Professional SP3 32 位上测试.

Tested on Windows 7 Ultimate SP1 64-bit and Windows XP Professional SP3 32-bit.

顺便说一句,您可以按 Windows+D(最小化所有窗口)并等待 3 分钟.程序化黑客基于此行为.它只是在资源管理器进程中调用计时器处理程序.处理程序代码(C/C++)是:

BTW, you can hit Windows+D (to minimize all windows) and wait for 3 minutes. The programmatic hack is based on this behaviour. It just calls the timer handler inside explorer process. And the handler code (C/C++) is:

KillTimer(hWnd, 0x18);
CoFreeUnusedLibraries();

为不存在的定时器调用KillTimer函数没有坏处.

There is no harm in calling of KillTimer function for non-existent timer.

这篇关于如何在不重新启动资源管理器进程的情况下删除桌面带并删除其 dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆