{"id":99575,"date":"2018-08-27T07:00:00","date_gmt":"2018-08-27T21:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=99575"},"modified":"2019-03-13T00:38:45","modified_gmt":"2019-03-13T07:38:45","slug":"20180827-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20180827-00\/?p=99575","title":{"rendered":"How do I force the Task Manager window closed whenever it opens?"},"content":{"rendered":"<p>A customer wanted to close (or at least hide) the Task Manager window whenever it opens. They did so by setting a timer and periodically running this code: <\/p>\n<pre>\nvoid FindAndCloseTaskManager()\n{\n  HWND taskManagerWindow = FindWindow(nullptr, \"Windows Task Manager\");\n  if (taskManagerWindow) {\n    PostMessage(taskManagerWindow, WM_CLOSE, 0, 0);\n  }\n}\n<\/pre>\n<p>This code worked on Windows 7, but stopped working on Windows 8. <\/p>\n<p>Well, yeah, because you&#8217;re searching for a window by name. The name of the Task Manager window in Windows 7 was <i>Windows Task Manager<\/i>: <\/p>\n<p> <img WIDTH=\"424\" HEIGHT=\"426\" SRC=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/BlogFileStorage\/blogs_technet\/virtualization\/WindowsLiveWriter\/DynamicMemoryComingtoHyperVPart3_A923\/Win%207%20Task%20Manager%20_2_thumb_bcd1746d-4a8f-4e5b-b83d-19d89dfbff6f.png\"> <\/p>\n<p>On the other hand, in Windows 8, the window was named simply <i>Task Manager<\/i>. <\/p>\n<p> <img WIDTH=\"467\" HEIGHT=\"427\" SRC=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/54\/33\/metablogapi\/1488.clip_image004_thumb_6633EC51.jpg\"> <\/p>\n<p>And of course, those names apply only to English. If the user&#8217;s UI language is German, the name will be <i>Task-Manager<\/i> with a hyphen. <\/p>\n<p>Whether a user can or cannot run Task Manager is an administrative decision, not an application decision. Use the &#8220;Remove Task Manager&#8221; group policy.  <\/p>\n<p><b>Bonus chatter<\/b>: Note that if this customer had their way, the name of Task Manager would be a compatibility constraint. <\/p>\n<p><b>Bonus bonus chatter<\/b>: Don&#8217;t think you can rely on the window class name either. <a HREF=\"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/20070725-00\/?p=25863\">That is also subject to change<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Um, that&#8217;s not really your decision.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-99575","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Um, that&#8217;s not really your decision.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=99575"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99575\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=99575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=99575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=99575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}