{"id":20913,"date":"2008-09-11T10:00:00","date_gmt":"2008-09-11T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/09\/11\/suggestion-box-3-short-answers-part-2-of-who-knows-how-many\/"},"modified":"2008-09-11T10:00:00","modified_gmt":"2008-09-11T10:00:00","slug":"suggestion-box-3-short-answers-part-2-of-who-knows-how-many","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20080911-00\/?p=20913","title":{"rendered":"Suggestion Box 3, short answers (part 2 of who knows how many)"},"content":{"rendered":"<p> Another round of short answers to questions in the suggestion box. <\/p>\n<dl>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#444980\">How does Windows choose the monitor a window maximizes to?<\/a> <\/dt>\n<dd>\n<p>     The window maximizes to the monitor selected by     <code>MonitorFromWindow<\/code>.     The algorithm the <code>MonitorFromWindow<\/code> uses to select     the monitor is documented in MSDN. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#448559\">How do you make your Win32 application safe from keyloggers?<\/a> <\/dt>\n<dd>\n<p>     You can&#8217;t.     In the battle between kernel mode and user mode,     user mode loses.     That&#8217;s why we have a distinction between kernel mode and user mode     in the first place. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#449229\">Why should you ever call MessageBox from inside a message handler     that is re-entrant?<\/a>     &#8220;I&#8217;m having a hard time explaining to people that it isn&#8217;t a blocking     call.&#8221; <\/dt>\n<dd>\n<p>     I don&#8217;t even understand the question.     And it <i>is<\/i> a blocking call.     The function doesn&#8217;t return until the user responds to the message box. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#451920\">What happens when you pass NULL to ShellExecute, like you did     in one of your articles?<\/a>     &#8220;Is UI suppressed if I pass NULL?&#8221; <\/dt>\n<dd>\n<p>     The window handle is used as the parent for any dialogs or messages     that the <code>ShellExecute<\/code> function may need to display.     If you pass <code>NULL<\/code>, then you get the same effect as if     you had passed <code>NULL<\/code> to, say, <code>MessageBox<\/code>.     In the article, the thread has no UI active, so any error messages     displayed by the <code>ShellExecute<\/code> function will appear     as top-level unowned windows.     <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/02\/24\/379635.aspx\">     I discussed this issue in detail a few years ago<\/a>.     If you want to suppress UI, then pass the <code>SEE_MASK_FLAG_NO_UI<\/code>     flag to <code>ShellExecuteEx<\/code>. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#452436\">Is there some way to use Explorer&#8217;s filename sort function?<\/a> <\/dt>\n<dd>\n<p>     It&#8217;s called <code>StrCmpLogical<\/code>.     <a href=\"http:\/\/blogs.msdn.com\/michkap\/\">     Michael Kaplan<\/a> discussed this function     <a href=\"http:\/\/blogs.msdn.com\/michkap\/archive\/2005\/01\/05\/346933.aspx\">     two years ago<\/a>     with     <a href=\"http:\/\/blogs.msdn.com\/michkap\/archive\/2006\/10\/02\/783066.aspx\">     a follow-up last year<\/a>.     Of course, if you want to mimic Explorer exactly,     you also need to respect the     <code>REST_NOSTRCMPLOGICAL<\/code> policy. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#453133\">Is there a way to sleep for less than one millisecond?<\/a> <\/dt>\n<dd>\n<p>     I don&#8217;t know either. I&#8217;ve never needed to do that.     (I try to get eight hours each night.) <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#454063\">Why are notification icons limited to 16 colors in Windows 95 and 2000?<\/a> <\/dt>\n<dd>\n<p>     They were limited to 16 colors on Windows&nbsp;95 to conserve memory.     Windows&nbsp;2000 inherited that code and by default,     each version of Windows works the same as the previous one.     There are millions of lines of code in the shell.     It&#8217;s not like somebody goes through every single one of them     and says, &#8220;Gosh, should we change this line in the next version     of Windows?&#8221; <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#458121\">Does Raymond use _alloca?<\/a> <\/dt>\n<dd>\n<p>     Nope. It wasn&#8217;t in K&amp;R C, so it&#8217;s not part of my world view.     And incautious use of <code>_alloca<\/code> can result in     security vulnerabilities. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#458331\">Windows can only handle 64 threads<\/a>. <\/dt>\n<dd>\n<p>     This statement is patently false.     We&#8217;ve seen that even without taking any special precautions,     we were able to     <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/07\/29\/444912.aspx\">     pack about 2000 threads into a process before     running out of address space<\/a>.     What the person probably meant to write is that 32-bit Windows     supports a maximum of 32 <i>processors<\/i>.     The reason is that the functions that manage sets of processors     (such as <code>SetThreadAffinity<\/code>)     use a 32-bit value to represent processor masks.     Note that for 64-bit Windows, these masks were expanded to 64-bit     integers, so 64-bit Windows supports up to 64 processors in principle. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#479950\">How does that Temporary Internet Files thing work?<\/a> <\/dt>\n<dd>\n<p>     It&#8217;s a shell namespace extension junction point. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#484017\">Why are some count parameters declared as signed integers?<\/a> <\/dt>\n<dd>\n<p>     I don&#8217;t think there&#8217;s a profound reason for it.     Each API designer is empowered to decide how     their functions will work.     After all, the original <code>strlen<\/code> function returned     a signed integer, too.     You might want to ask Brian Kernighan; he was doing it before Windows.     (Signed integers do have the slight advantage of being resilient     to integer underflow.     If <code>a<\/code> and <code>b<\/code> are both non-negative     integers, then <code>a - b<\/code> will never underflow.) <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#496950\">Why does the desktop lose track of icons, so it has to refresh them?<\/a> <\/dt>\n<dd>\n<p>     I&#8217;m not sure what you mean by &#8220;lose track of icons&#8221;.     Maybe you&#8217;re asking about lost change notifications     (in which case redirected folders can cause problems with     lost network notifications).     Or maybe you&#8217;re talking about icon repositioning     (maybe the previous icon locations weren&#8217;t saved). <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#515657\">Questions about DLL imports, exports, and cross-module memory<\/a> <\/dt>\n<dd>\n<p>     I inadvertently answered this question in     <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/07\/27\/680250.aspx\">     a rather long series of articles<\/a> on DLL imports and exports,     and     <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/09\/15\/755966.aspx\">     a discussion of cross-module memory allocation<\/a>. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#688640\">     I want to see your blog stats<\/a>. <\/dt>\n<dd>\n<p>     I thought that too, until I saw them.     When you get over a million hits a month,     a list of all the referrals is just a giant pile of noise.     I haven&#8217;t bothered analyzing the referrals because I have     other things to do in my spare time that are more interesting. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#705378\">     I&#8217;d love to see a series of things that are obvious to you     but not obvious to everyone<\/a>. <\/dt>\n<dd>\n<p>     How do I know what is obvious to me and not obvious to everyone? <\/p>\n<\/dd>\n<\/dl>\n<p> The next category is, of course, the people who ask questions on things that I listed as topics I am not inclined to cover. <\/p>\n<dl>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#443420\">     I have a problem (describes problem)<\/a>. <\/dt>\n<dd>\n<p>     I don&#8217;t think your problem really is of general interest.     But it&#8217;s clear that     <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/02\/28\/381591.aspx\">     you&#8217;re not respecting the modality of the window<\/a>. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#471747\">I&#8217;m trying to improve the performance of my specific scenario<\/a>. <\/dt>\n<dd>\n<p>     This doesn&#8217;t strike me as a topic of general interest. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#489215\">What are your thoughts on this research project?<\/a>     <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#530728\">What are your thoughts on this Microsoft product?<\/a> <\/dt>\n<dd>\n<p>     I think you confused me with Robert Scoble. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#490974\">I have a problem (describes problem)<\/a>. <\/dt>\n<dd>\n<p>     This doesn&#8217;t strike me as a topic of general interest. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#501636\">Why does Internet Explorer do X?<\/a> <\/dt>\n<dd>\n<p>     Internet Explorer is explicitly on the list of things I am unlikely     to cover. <\/p>\n<\/dd>\n<\/dl>\n<p> Or the people who ask questions I&#8217;ve already answered or questions I&#8217;ve chosen to answer elsewhere. <\/p>\n<dl>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#503431\">Help me modify files that I didn&#8217;t write<\/a>. <\/dt>\n<dd>\n<p>     <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/08\/05\/54603.aspx\">Doing this breaks servicing<\/a>.     <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#508754\">What is the long pause after listing a directory the first time?<\/a> <\/dt>\n<dd>Answered in     <a href=\"http:\/\/www.microsoft.com\/technet\/technetmag\/issues\/2006\/07\/WindowsConfidential\/\">     A brief and incomplete history of FAT32<\/a>. <\/dd>\n<\/dl>\n<p> And then there are the questions I can&#8217;t or choose not to answer. <\/p>\n<dl>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#456664\">Why does the window manager force windows fully on-screen     when the workstation is unlocked?<\/a> <\/dt>\n<dd>\n<p>     I don&#8217;t know either.     It makes sense to force windows on-screen after a change in     resolution, but if the resolution didn&#8217;t change between the lock     and the unlock, there&#8217;s really no need to go around &#8220;fixing up&#8221;     window positions. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#478576\">What did Apple copy from Microsoft and vice versa?<\/a> <\/dt>\n<dd>\n<p>     I&#8217;m not going to touch this one.     I don&#8217;t see any upside to my answering it, only downside,     and I don&#8217;t welcome the flamewar that will doubtless ensue. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#480923\">Do you know anything about this?<\/a> <\/dt>\n<dd>\n<p>     No. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#491759\">Something about defragmenting<\/a>. <\/dt>\n<dd>\n<p>     I have no special knowledge about defragmentation.     Try     <a href=\"http:\/\/blogs.technet.com\/filecab\/\">     The Filing Cabinet<\/a>.     They answered a few questions     <a href=\"http:\/\/blogs.technet.com\/filecab\/archive\/2007\/01\/26\/don-t-judge-a-book-by-its-cover-why-windows-vista-defrag-is-cool.aspx\">     in one blog entry<\/a>     and even have a     <a href=\"http:\/\/blogs.technet.com\/filecab\/articles\/440717.aspx\">     Defrag FAQ<\/a>.     Personally, I&#8217;ve been happy with     <a href=\"http:\/\/www.flexomizer.com\/PermaLink,guid,ce99367e-158c-487a-879d-b32145cc1957.aspx\">     Dave Whitney&#8217;s defragmenter<\/a> to defragment specifically-targeted     files.     (I don&#8217;t defragment my entire drive because it seems like a waste of time.) <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#493250\">A question about Aero glass<\/a> <\/dt>\n<dd>\n<p>     I have no special knowledge about Aero glass. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#497703\">How about an under-the-hood look at the Windows Vista Start menu?<\/a> <\/dt>\n<dd>\n<p>     I didn&#8217;t work on the Windows Vista Start menu,     so I don&#8217;t know how it works. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#498519\">Do you have any insights into the evolution of WinHelp?<\/a> <\/dt>\n<dd>\n<p>     Sorry, I&#8217;m an outsider just like you when it comes to help technologies. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#505849\">Long rambling question about <code>ACCESS_DENIED<\/code><\/a> <\/dt>\n<dd>\n<p>     I quickly lost interest. <\/p>\n<\/dd>\n<dt><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#510557\">Please explain the subtleties of the ScrollWindowEx function     when scrolling child windows<\/a>. <\/dt>\n<dd>\n<p>     I don&#8217;t know the answer and I don&#8217;t feel like doing the     research necessary to find out.     Sorry.     The fact that I left it unanswered from the previous suggestion box     should have been a clue. <\/p>\n<\/dd>\n<\/dl>\n<p> That&#8217;s all for this year. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another round of short answers to questions in the suggestion box. How does Windows choose the monitor a window maximizes to? The window maximizes to the monitor selected by MonitorFromWindow. The algorithm the MonitorFromWindow uses to select the monitor is documented in MSDN. How do you make your Win32 application safe from keyloggers? You can&#8217;t. [&hellip;]<\/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-20913","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Another round of short answers to questions in the suggestion box. How does Windows choose the monitor a window maximizes to? The window maximizes to the monitor selected by MonitorFromWindow. The algorithm the MonitorFromWindow uses to select the monitor is documented in MSDN. How do you make your Win32 application safe from keyloggers? You can&#8217;t. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/20913","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=20913"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/20913\/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=20913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=20913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=20913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}