优雅地退出资源管理器(以编程方式) [英] Gracefully Exit Explorer (Programmatically)

查看:84
本文介绍了优雅地退出资源管理器(以编程方式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何优雅地以编程方式关闭资源管理器?

How do you gracefully close Explorer programmatically?

我的意思是,您如何以编程方式调用此函数:

By that I mean, how do you invoke this function programmatically:

在图片中输入错字,应该说"Ctrl-Shift-右键"而不是"Shift-点击".

Typo in the picture, it should say "Ctrl-Shift-Right-Click" instead of "Shift-Click".

推荐答案

出于好奇,我对此进行了调试.它所做的只是将消息发布到资源管理器的窗口之一:

I debugged this out of curiosity. All it does is post a message to one of explorer's windows:

BOOL ExitExplorer()
{
    HWND hWndTray = FindWindow(_T("Shell_TrayWnd"), NULL);
    return PostMessage(hWndTray, 0x5B4, 0, 0);
}

当然,这是一条未记录的WM_USER消息,因此将来很有可能会改变行为.

Of course this is an undocumented WM_USER message so the behavior could quite possibly change in the future.

这篇关于优雅地退出资源管理器(以编程方式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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