我在尝试WM_CLOSE
窗口资源管理器进程时遇到问题,因为发送该消息将尝试关闭 Windows Shell 资源管理器进程并提示用户关闭窗口。这不是预期的行为,我想知道如何解决它?
如何优雅地关闭单个资源管理器窗口,而不同时关闭整个 PC?目标是具有与用户自己单击 X 按钮相同的行为。
编辑:我发现我能够获取资源管理器进程的所有子窗口,但从那时起,我不确定如何识别哪些窗口是实际的、用户可见/可交互的资源管理器窗口。
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