关闭Windows资源管理器的特定实例 [英] Closing a Specific Instance of Windows Explorer

查看:226
本文介绍了关闭Windows资源管理器的特定实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在试图 WM_CLOSE A窗口Explorer进程中的一个问题,那么发送该消息会尝试关闭Windows Shell中的Explorer进程,并提示用户关闭下来的窗口。这不是预期的行为,我想知道我怎么能解决呢?



如何关闭单个资源管理器窗口摆好,而不在同一关闭整个PC时间?其目标是拥有相同的行为,如果用户点击了的X按钮本身



编辑:我发现,我能得到所有explorer进程,但是从这一点我不知道如何辨别哪个窗口是实际的,用户可见/相互作用性资源管理器窗口的子窗口。

  2012年11月21日16时27分49秒[12] DEBUG  - 关闭进程PID:2680 
2012年11月21日16时27分49秒[12] DEBUG - 窗口有11个子孙窗口
2012年11月21日16时27分49秒[12] DEBUG - 发现子窗口:HWND:590746窗口状态:正常
2012年11月21日16时27分49秒[12] DEBUG - 发现子窗口:下午4时27分的hWnd:656010窗口状态:正常
2012年11月21日16点27分49秒[12] DEBUG - 发现子窗口:HWND:2294392窗口状态:正常
11 /二千零十二分之二十一16时27分49秒[12] DEBUG - 发现子窗口:HWND:1245586窗口状态:正常
2012年11月21日16时27分49秒[12] DEBUG - 发现子窗口:用户通知晋升区的hWnd:2949496窗口状态:正常
2012年11月21日16时27分49秒[12] DEBUG - 发现子窗口:系统促进通知区域的hWnd:1245548窗口状态:正常
11月21日/ 2012 16点27分49秒[12] DEBUG - 发现子窗口:HWND:852646窗口状态:正常
2012年11月21日16点27分49秒[12] DEBUG - 发现子窗口:HWND:918356窗口状态:正常
2012年11月21日16时27分49秒[12] DEBUG - 发现子窗口:运行应用程序的hWnd:1769950窗口状态:正常
2012年11月21日16时27分49秒[12 ] DEBUG - 发现子窗口:运行应用程序的hWnd:1179980窗口状态:正常
2012年11月21日16点27分49秒[12] DEBUG - 发现子窗口:TF_FloatingLangBar_WndTitle的hWnd:458926窗口状态:正常


解决方案

你是如何得到的窗口?您可以获取与文本WINAPI调用句柄因此,或许在桌面浏览器也没有标题。 http://msdn.microsoft。 COM / EN-US /库/窗/台式机/ ms633499(v = vs.85)的.aspx 看lpWindowName参数。



另外,和我只是猜测这里,你可以看看桌面资源管理器,只要它们之间的关系由GetDesktopWindow(返回喊得其他探险实例之间的关系)的 http://msdn.microsoft.com/en-us/library/windows/desktop/ms633504( v = vs.85)的.aspx


I'm having a problem trying to WM_CLOSE a Window Explorer process in that sending that message will then try to close the Windows Shell explorer process and prompt the user to shut down windows. This is not the intended behaviour and I was wondering how I could work around it?

How can I close individual explorer windows gracefully, without shutting down the whole PC at the same time? The goal is to have the same behaviour as if the user had clicked on the X button themselves.

EDIT: I've found that I'm able to get all the child windows of the explorer process but from that point I'm not sure how to identify which windows are the actual, user visible / interactable Explorer windows.

11/21/2012 16:27:49 [12]  DEBUG - Closing process with PID: 2680
11/21/2012 16:27:49 [12]  DEBUG - Window has 11 descendant windows
11/21/2012 16:27:49 [12]  DEBUG - Found child window:  hWnd: 590746 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window: 4:27 PM hWnd: 656010 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window:  hWnd: 2294392 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window:  hWnd: 1245586 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window: User Promoted Notification Area hWnd: 2949496 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window: System Promoted Notification Area hWnd: 1245548 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window:  hWnd: 852646 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window:  hWnd: 918356 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window: Running applications hWnd: 1769950 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window: Running applications hWnd: 1179980 Window State: Normal
11/21/2012 16:27:49 [12]  DEBUG - Found child window: TF_FloatingLangBar_WndTitle hWnd: 458926 Window State: Normal

解决方案

How are you getting the window? You can obtain handles with winapi calls by text so perhaps the desktop explorer has no caption. http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499(v=vs.85).aspx Look at the lpWindowName parameter.

Also, and I am just guessing here, you might look at the relationship between the desktop explorer and the other explorer instances as far as how they are related to the hande returned by GetDesktopWindow() http://msdn.microsoft.com/en-us/library/windows/desktop/ms633504(v=vs.85).aspx

这篇关于关闭Windows资源管理器的特定实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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