Suggestion Box 3


Post suggestions for future topics here instead of posting off-topic comments. Note that the suggestion box is emptied and read periodically so don't be surprised if your suggestion vanishes. (Note also that I am under no obligation to accept any suggestion.)

Topics I are more inclined to cover:

  • Windows history (particularly the Windows 95 era).
  • Windows user interface programming in Win32, and shell programming in particular.
  • General programming topics (selectively).
  • Issues of general interest.
  • My personal hobbies.

Topics I am not inclined to cover:

  • The blog software itself. You can visit the Community Server home page and cruise their support forums.
  • Internet Explorer. You can try the IE folks.
  • Visual Studio. You can try one of the Visual Studio blogs.
  • Managed code. This is not a .NET blog. I do not work on .NET technologies. As far as .NET is concerned, I'm just another programmer like you. Occasionally I touch a .NET-related topic, but I do not bring any expertise to the subject.
  • Non-software Microsoft topics, such as product support policies, marketing tactics, jobs and careers, legal issues.
  • Microsoft software that isn't Windows. (Exchange, Office, ...)
  • Windows topics outside user interface programming. (Plug and Play, Terminal Services, Windows Messenger, Outlook Express, SQL, IIS, remoting, SOA...)
  • User interface programming in anything other than Win32. (Because I know nothing about it.)
  • Debugging a specific problem. (Not of general interest.)
  • Predictions for the future. (What's the title of this blog again?)
  • Participation in Internet memes.

You can also send feedback on Microsoft products directly to Microsoft. All the feedback gets read, even the death threats.

Suggestions should be between two and four sentences in length. As you can see, there are hundreds of them already, so you have three seconds to get your point across. Please also search the blog first because your suggestion may have already been covered. And remember, questions aren't suggestions.

Note the enormous topic backlog. Consequently, the suggestion box has been closed temporarily and will reopen once the existing backlog has cleared, which I estimate will happen sometime in early 2010. If your suggestion is that important, I'm sure you'll remember it when the suggestion box reopens.

Comments (469)
  1. How about DLL details? I’m interesting in history of DLL’s and the way you use them. What’s the difference between dllimport and dllexport? Why dllimport in declaration of method that will be used others?

    Thank you.

    [The difference is that they are completely unrelated. Here’s
    what dllimport does and here’s what dllexport does. -Raymond
    ]
  2. Craig Ward says:

    What form do application hacks usually take in Windows? Are there statememts like the following littered throughout the source-code:

    if (<app caption> == “BuggyButPopularProgram”) {
    // do something…
    }

    [Response. -Raymond]
  3. Craig Ward says:

    Does Microsoft internally use MFC for writing Windows apps? How about VB?

    [Response. -Raymond]
  4. Dominic Self says:

    I’ve always wanted to know why Control Panel applets don’t show up on the taskbar. It’s very easy to lose track of them – I don’t use Alt+Tab so I have to minimise all my windows to find them sometimes. Was there a good reason for this once upon a time?

    [Topic accepted. -Raymond]
  5. PathFileExists() seems obvious. But it doesn’t work for a remote drive without a drive letter.
    (Why is it so, BTW ? What’s the problem with UNCs ?)
    Failure of GetFileAttributes() remains the method I use but I have never been comfortable with it.

    TIA.

    [Response. -Raymond]
  6. Robert M. Shaw says:

    Dear Raymond,

    I get a kick out watching self appointed education Gods.

    For your information under Title 20 of the U S Eduation Code 1093 Distance Learning and Diminstration Programs are legal.

    In fact the U S Goverment like the idea so much they created Western Gobernors University just to monitor the programs.

    I also noted that you seem to think Kennedy-Western University is a DEgree Mill?

    Would you please note that the Oregon State Education Dept also thought so and Kennedy-Western sued them and won the case.

    I to enjoy people that display their ignorance in frount of all of us.

    Robert M. Shaw

    [First, I never claimed that diploma mills are illegal. Second, I never claimed that distance learning was bogus. Furthermore, unlike Kennedy-Western, Western Governors University is accredited (and as far as I can tell, was not created by the US government, as you claimed). Third, Kennedy-Western did not win the case. The case was settled out of court. -Raymond]
  7. There seems to be very little documentation for handling multiple monitors. For example, I wrote a program that randomly changes the desktop wallpaper and I would like it to able to set a different one for each monitor. Ultramon is able to do it: http://www.realtimesoft.com/ultramon/tour/wallpaper.asp

    Is there a supported way to do this with Win32, or does that program use fancy tricks?

    [The program is pulling some sort of trick because the built-in wallpaper support uses the same wallpaper on all monitors. -Raymond]
  8. cmonachan says:

    Could you perhaps explain why CPropertySheet::DoModal() has documented “it may cause a first-chance exception”?

    I’m assuming this is another backward compatibility fix, where people are passing in dialog resources of the wrong style and wanting them to work?

    [Response. -Raymond]
  9. Mike Petry says:

    Why can you dereference a COM interface pointer and pass it to a function with a Com interface reference.

    The call.
    OutputDebugString(_T(“IntfByRef::Execute – Beginn”));
    BadBoy badone;
    CComPtr<IDoer> Doer;
    Doer.CoCreateInstance(CLSID_Doer, NULL, CLSCTX_INPROC_SERVER);

    // created a raw pointer – maybe the
    // smart pointer was effecting it some how.
    IDoer* Doer2;
    Doer.CopyTo(&Doer2);

    badone.stupid_method(*Doer2);
    Doer2->Release();
    // no still works.

    The function called.

    void stupid_method(IDoer& IDoerRef)
    {
    IDoerRef.Do();
    CComQIPtr<IDispatch> WatchIt(&IDoerRef);

    if( WatchIt )
    OutputDebugString(_T(“QI the address of the ref works – this is weirdn”));
    else
    OutputDebugString(_T(“At least trying to QI the address of the ref failsn”));
    }

    I found some code written like this during a code review. It is wrong but it seems to work.

    [Response. -Raymond]
  10. According to the docs of the API, UNCs are not supported even though remote mounted drives are.

    What makes UNCs so special ?

    What is the alternative to check for existence of a file given a UNC path ?
    I used to check that GetFileAttributes() fails, but it looks like a dirty trick at best.

    TIA.

    [Response. -Raymond]
  11. Oops! Sorry for the duplicate. I, too, start to recycle my old suggestions ! :-D

  12. Why are the copy/cut/paste buttons not disabled when there’s nothig to copy/cut/paste ?

    Why do different buttons have different behaviours ? e.g.: The back and forward buttons are disabled when you can’t go back/forward, as opposed to the copy/cut/paste buttons.

    [Response. -Raymond]
  13. Spoon says:

    I would really like to see how to focus a window without bringing it to the top. I’ve learned that I can send a WM_NCACTIVATE to my windows to change their window borders to active or inactive. However, I can’t see to figure out how to actually chance the focus. As far as I can tell, there is no API call in Windows to focus a window without bringing it to top.
    Thanks.

    [Response. -Raymond]
  14. Kirk Israel says:

    A while back I wrote up a list of grievences against the new(ish) file-search-as-sidebar paradigm and implementation in Windows explorer…I tried to be detailed and clear when I was just being subjective and I hoped as a UI / Windows internals guy you could speak about some of this…

    1. You lose your place. Often, I’m still interested in keeping the current explorer view open when I hit Ctrl-F to conduct a search, but now my whole window becomes dedicated to this one search task.
    2. Often in NT2K it takes a few seconds for the “Look in” field to be automatically field in with the location of the current Folder. Type in a quick search term, hit return, you get a message “A valid folder name must be entered”
    3. The only way to know if you’re looking at a “real folder” or search results is to look at the window caption. And even when the caption indicates “Search Results”, it gives you no hint of what you were searching for. (Admittedly, a detailed description could get wordy, but still, having 3 windows that say “Search Results” in the task bar isn’t that useful in refinding a specific window.)
    4. To get your normal explorer view again you have to hit an IE like “back” button. This seems like a broken paradigm to me, that viewing a folder is one “task location”, viewing search results is another “task location”. To my mental model, an explorer view represents a “noun”, and a search is more of a “verb”, results and all. It’s not like search results are really making up a “virtual folder”.
    5. When you hit “back” to return to your folder view, the sidebar stays up. But the “Look in” field doesn’t get filled in with the new folder location unless you close the sidebar and reopen it. Conversely, if you close the sidebar, your search results remain…it looks just like a regular folder though! Also, the “Look in ” field changes, but the main search fields remain filled with the old data, which is useful but inconsistent.
    6. To start a search you either have to know the Ctrl-F mnemonic or use a graphical icon, there doesn’t seem to be a regular menu option for it.
    7. If you accidentally hit “Up Folder” instead of “Back”, you get taken to a folder view of the Desktop. Why isn’t the “Folder Up” option greyed out while conducting a search? It’s not like it’s an easy way of backing up to the parent folder to redo the current search…that requires all the steps I outline in complaint 5…
    8. Don’t get me started on XP’s default “File Searching For Dummies” mode. Maybe it’s good for novice users, and it can be turned off, but for exerienced users it’s just a pain in the butt, and we become amazed that other people who seem otherwise to be pretty bright always use it…or even worse, with the goofy animated assistant.

    I suppose my main problem is I don’t share the idea I describe in complaint 4, and I really miss the old “hit Ctrl-F to launch a seperate simple find application that keeps your place here” . And maybe it’s sightly easier for them to give the options to view details, thumbnails, etc in the results. (Though Photo thumbnails are often very sluggish to load.)

    Maybe they were looking for a way of letting someone repeat a carefully constructed search from a different location (hence the inconsistency in complaint 5) but it seems like a poor tradeoff to me.

    This app is something I use on a daily basis, and not liking its forced browser model (probably some offshoot of that whole “oh but you can’t seperate the browser from the OS!”) is a constant low-level thorn in my side.

    If anyone knows a way of getting back the old behavior when I hit ctrl-F, I’d love to hear about it. Even some registry setting that causes a Ctrl-F search to open up a new window rather than overtaking the current one would be a HUGE improvement.


    since I wrote that, I also ran into the thing where you have to fiddle with a registry setting in order to get it to search through all files, not just file types explorer kind of knows about. I hate firing up textpad just to go hunting for a string in a directory tree!

    [Response. -Raymond]
  15. Brian says:

    Not exactly a GUI programming question, but I’m curious as to whether you have any insight on the “tooltips underneath other windows” problem. As an example, quite often (for no apparent reason), status icons will display their tooltips underneath the taskbar. Turning “always on top” for the taskbar off and then on again sometimes fixes it, but not always. Sometimes the tooltips get ‘stuck’ under other windows. It is very frustrating, with a small enough tip string it can appear that tooltips are not working at all.

    [Response. -Raymond]
  16. Rune Moberg says:

    I’ve already nagged about this via private e-mail (sorry! :) ), but I’ll post here as well in case you feel like attacking this topic.

    While giving 64-bit Windows a spin, I decided to test some of its limitations. In 32-bit Windows, the default DesktopHeapSize is 3MB. In 64-bit it is 20MB (!). So far so good. (excellent in fact! Very happy camper right now)

    Then I checked out the USERProcessHandleQuota value. It is still 10000, but can now be set to a much higher value (max used to be 18000 in XPSP2). I mistakenly thought that this was because the system limit used to be 65536 handles, but after testing I came up with a slightly different answer.

    Creating 20000 invisible windows is fast, but the trouble starts when destroying those handles. I tried two ways: Call DestroyWindow() myself or simply leak the handles and leave the cleanup to the OS.

    The first way is extremely slow. I tried with 30000 handles and using Task Manager I could see it count down slowly from 30000. Roughly 30 handles per second were released.

    The second way is also slow, but faster than alternative #1. The downside is that instead of making the UI sluggish, it completely stalled UI interaction for a solid half minute (this time testing only 20000 handles).

    My test rig was a dual Xeon. It kept on servicing network requests fine, but the UI went AWOL. Task Manager showed no spike afterwards and simply pretended nothing had ever happened. (I used to think TM could be trusted — but it clearly has limitations of its own)

    The sweet spot is somewhere between 10000 and 18000 handles. Any more than that and the window manager goes bananas.

    So I guess my question is: Why is it so hard to release 30000 window handles? (significantly harder than creating them in the first place!) :)


    Rune

    [Topic and again. -Raymond]
  17. mantra says:

    SendInputSendKeys works on a window that has focus. In general, SetFocus and SendInputSendKeys isn’t considered as a reliable way. Is it possible to pump keys to a specific window without going thru SendInput etc?

    [Old topic. -Raymond]
  18. Phil Quirk says:

    How exactly does Windows compute which windows appear in the ALT+TAB list? I have never found any documentation on this. I have seen alot of problems involving a window owned by a dummy window sometimes disappearing from the list.

    For example, if you have window A owns window B owns window C, they are all visible, and C is modal to the rest, then suddenly all three disappear from the ALT+TAB.

    [Response. -Raymond]
  19. Darren says:

    I’m curious – are there still lurking parts of the Windows OS that don’t grok long filenames? If you look in System32, even in Server 2003, the system DLLs still have 8.3 filenames. Since every long filename has a corresponding short filename for backward compatibility, why do we need this restriction? Even the .NET bootstrap DLL (mscoree.dll or something) is an 8.3 name. Is this superstition on the part of Microsoft, or is there some good reason to hang on to 8.3 for backwards compatibility? I just noticed that even the Office programs for Office 2003 are 8.3 – “Winword.exe”, “Powerpnt.exe” etc.

    [Response. -Raymond]
  20. kokorozashi says:

    In response to the previous suggestion about 8.3 filenames, I’ve been thinking about this issue lately as well. With regard to files in the boot hierarchy, it would seem that all the file systems from which XP can boot do support long filenames (even FAT16, to my surprise). On the other hand, I would not envy the person tasked with scouring all the code in the OS for buffers which assume 8.3 filenames. And I’m not talking about the parts of the system which manage volumes; obviously those must support long filenames. I mean all the little utility apps and various higher-level APIs which scan a directory for DLLs and what-have-you.

  21. Bart Willems says:

    As a suggestion for a short item: why isn’t there some sort of 5-minute timer in the power-off dialog. You know, when you power off and one of your programs is still open, you’ll get the dialog “are you sure you want to shut down”. – and why does it override standby/hibernate?

    I’ve had a couple of times where I’ve clicked on “Power Off” on my laptop, and when it’s starting to shut down I’ll close it and put it in my bag (I don’t always have the luxury to wait three minutes for the power down) – only to get home with a laptop that resembles an iron since it’s been running all that time waiting for my reply – or the same for getting home after a night out and finding the computer still on.

    If the question isn’t answered in a few minutes, then the user obviously went away assuming the PC powered down, right?

    [Vista does this. -Raymond]
  22. Gareth says:

    I’m using SystemParametersInfo to set the scroll bar width when our application starts (we support a touch screen interface we need big fat scroll bars), but when we use this on an XP pc using XP themes calling the API also enlarges the system tray icons and several other height settings (even if when we reset the scrollbar width to the original value when the application closes). Any ideas why it does this?

    [Response. -Raymond]
  23. Kishorep says:

    I would like to know if you can post any samples on how to implement Context Menu handlers for IE.

    My scenario is that I would like to extend the context menu such that, whenever a text is selected, the popup menu shown on right click – has a menu – Save to a specified location.

    How can I implement this feature so as to enable by scenario in IE.

    [Response. -Raymond]
  24. In the comments on http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx, you said you’d discuss the difference between manually posting WM_QUIT and calling PostQuitMessage.

    I have renewed curiosity about this, because I’ve just found an app where PostQuitMessage doesn’t work, but PostMessage(WM_QUIT) does….. (and of course the docs say not to use PostMessage, but not why…)

    [Response. -Raymond]
  25. JF Lefebvre says:

    Hi.
    I would like to know more about how the dialog manager handle the default key (ENTER) when a dialog box contains a modeless child dialog. It seems to me that even when the focus is on a child dialog’s button, the default key is still send to the parent dialog.

    I would like to know why it works this way? And what is the clean way to redirect the message to the child window.

    Thanks!

    [I covered this in my PDC 2005 talk. -Raymond]
  26. James says:

    Not a topic suggestion, but a suggestion for improving your weblog:

    The post categories are pretty useless. There are no “next page” links, so you see only the last 20 posts in that category and can’t access any more. Browsing through old topics using the date links is tedious.

    There used to be a way to list all of the post titles in a category, and that was really great for browsing.

    [Response. -Raymond]
  27. piers says:

    here’s a simple question related to explorer drag/drop:

    I’m a DropSource and the user is dragging items to explorer. how can i found out where they dragged them to?

    the items the user is dragging aren’t files (yet) they’re just virtual representations of files. when the user drags the items out of my application i want to start a long-running process that wil eventually create the files in the location he specified.

    the only way i can find to do this is to create a uniquely-named folder in the temp directory, and use an ICopyHook to cancel explorer’s SHFileOperation and notify my app of the location of the copy.

    there /has/ to be a better way to do such a simple thing, doesn’t there?

    [Response -Raymond]
  28. piers says:

    I should add that I’d like a way to do this so that user can quit my application between doing the drag and the completion of the copy operation and have the copy operation complete some time after restarting the application. The TYMED_ISTREAM method obviously isn’t going to work here…

  29. Francisco Moraes says:

    Can the SendInput function be used to cause a DirectX application that reads the keyboard via DirectInput notice the simulated key typing?

    Francisco

  30. Ivan Leo says:

    Hello, have there been any changes in behaviour in DialogBox/DialogBoxParam between windows server 2003 service pack 1 and windows xp service pack 2?

  31. estee says:

    Raymond, once you’ll be in a philosophical mood, could you please tell some words regarding MSF, MOF and the like? Thank you

    [Response. -Raymond]
  32. Norman Diamond says:

    Several times you’ve blogged about how the shell finds programs to execute (and how each other part of Windows has its own separate inconsistent set of rules). Pathnames in the registry should be full path names and should have quotation marks around them for obvious reasons.

    Well, then there’s:
    HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionControl PanelCpls
    containing values:
    Internet Connection Firewall
    NetSetupWizard
    Speech

    I thought I was going to prove a security risk in the value of the Speech value by creating a program C:Program.exe … hmm, maybe by creating a link C:Program.lnk that points to the actual program … hmm, so much for those experiments. How come Control Panel always opened the actual Speech applet instead of executing the program that I put at the place where the registry said to look?

    I can kind of figure out why the other two items aren’t security risks, since the default paths now have the System32 directory ahead of other places where the shell would look.

    By the way the reason I was poking around that neighbourhood is that a driver signed by Microsoft creates values in the Run key that also don’t specify full pathnames, and I thought that was going to be a security risk, but now wonder if maybe it isn’t.

    Also a ton of subkeys of App Paths have pathnames with embedded blanks but without quotation marks. How come they avoid executing a Trojan C:Program something or other.

    [Response. -Raymond]
  33. Pete says:

    I just had some trouble creating a thread from a DLL. In the process of banishing said trouble, I scoured Google Groups. I searched for CreateThread and DLL. Over and over and over and over again I saw people trying to call CreateThread from DllMain, which doesn’t work because DllMain is serialized and CreateThread implies DLL_THREAD_ATTACHED. It seemed like a common enough error that it’d be worth describing.

    [Response. -Raymond]
  34. Pete says:

    Oh, and my problem? I managed to inflict a subtler variant on myself. I had declared a global instance of a class whose constructor was calling CreateThread, which means the CRT was calling me during DllMainCRTStartup, which of course is the caller of DllMain and of which I was unaware until tonight.

    One thing I still don’t understand is that calling CreateThread from DllMain (or, presumably, DllMainCRTStartup) is supposed to deadlock according to Usenet. All I saw was that my thread entry proc was never called.

    [Response. -Raymond]
  35. Tom Grelinger says:

    I’ve quickly scanned some of the topics (found by doing an initial Google search), and I’m curious if there has been information on the following: if I have a modal CDialog that is visible and usable to the user. Let’s say I receive an event somewhere else in the program and I call DestroyWindow on the modal CDialog from within the event. I notice that the OnDestroy is called on the CDialog, but DoModal never exits until a WM_QUIT is posted to the modal’s message pump. What are the pitfalls to this? Unfortunately, there is really no way to avoid this situation.

    [Response. -Raymond]
  36. alanjmcf says:

    On why 109 audit records are logged when Explorer opens a folder with audit enabled.
    <http://www.sysinternals.com/blog/2005/06/explosion-of-audit-records.html%3E

    [Mark answered that question in a comment to that same entry on 6/24/2005 so I don’t have to. -Raymond]
  37. David Hall says:

    Two suggestions, sorry if they’ve been covered before;

    1) Why does Windows start services in the correct order yet not shut them down in the reverse order?

    2) Why is it that the “hide the least used programs” feature on the Start Menu tends to hide programs I *do* use :)

    [Here’s the start of a two-week series for you. -Raymond]
  38. Kai Backman says:

    My space station game does a cute waltz with a friendly utility named HotCopy. The game is self-patching over the net and needs to change it’s running executable so it does a: start process – wait for finish – copy files – restart exe. But that’s not the point.

    The point is that changing the executable messes up the icon cached by the Shell. I use a separate icon file for the standard shortcuts, but my lovely players tend to run the game so often that it ends up in the "most frequently used" programs list. And duly has a non-descript icon on it.

    Eveything gets OK after a while, but I sense a hidden mystery here. I’d like to make this right and just give the Shell a nice hint that the cache needs updating. There is the Shell_GetCachedImageIndex, which seems like a hackish way of reloading the image into the cache (using GIL_DONTCACHE). The official documentation claims Win2000 but unofficial tells me it’s been around since 95. What’s going on here? Can an app refresh an entry programmatically? What’s the proper way?

    I’m intrigued .. :)

  39. mabster says:

    Hi Raymond,

    I found out today that Window-D does the same thing (show desktop/minimize all windows) as Window-M.

    Or does it?

    Is there a reason that both key combinations exist?

    Cheers,

    Matt

    [I already covered this topic last year. -Raymond]
  40. macbirdie says:

    Here’s the situation. Some Important App is doing something more or less important in the background. I’m typing something in some other app. Then suddenly a dialog pops up from the Important App giving me options of Yes, No and Cancel. But the millisecond the dialog pops up and gains focus, it so happens that the “n” key on my keyboard is already on its way to be pressed and eventually I end up hitting “No” in the Important Background App, not the one I’m typing in. Was such case ever considered during Windows UI design? If not, why? If yes, why wasn’t it implemented? Thanks!

    [The foreground lock timeout is supposed to prevent this. -Raymond]
  41. GreekGoddess says:

    On keyboards with an “AltGr” key that translates to a simultaneous keypress of Ctrl+Alt, why doesn’t AltGr+Del show the task manager?

    [Response. -Raymond]
  42. ThalesC says:

    I’d like to know how dlls linked as “delay loaded” get unloaded by the application and other dlls.

    [I don’t know. But you should be smart enough to figure this out on your own. (Hint: Read the documentation.) -Raymond]
  43. woodart says:

    Hi Raymond,

    I remember a while back when I was messing with Windows settings a software called “Xteq X-setup” that had this surprising “setting” described as follows:
    “Windows includes a “feature” (?) that lets you blue-screen (crash) the OS simply by holding the right CTRL key and pressing the “Scroll Lock” key twice.

    After activating this option, reboot your system. Then hold the right CTRL key and press the “Scroll Lock” key twice.

    Windows will react with a nice MANUALLY_INITIATED_CRASH (0xE2) blue-screen…

    Enjoy!”

    I’d like to hear the story behind it if you happen to know anything.

    I discovered your log recently (read today, shame on me :p) and I like it very much, keep the nice stories coming :)

    [Response. -Raymond]
  44. Ramesh says:

    Hi Raymond,

    Is it possible to programatically determine / change the Folder type (template) setting for a particular folder in XP?

    Thanks

  45. macbirdie says:

    Hey,
    I’ve been always tought that using “goto” statements in C/C++ is just bad and ugly. What’s with all those goto’s doing in many, many MSDN C code examples?
    Thanks!

    [Response. -Raymond]
  46. Daniel Chait says:

    Hi Raymond,

    Was wondering – what’s the reason for some messages being prefixed with WM_ and others with EM_ ? The logic is opaque to me (especially looking at things like EM_UNDO vs. WM_UNDO).

    Thanks! – Daniel

    [Response. -Raymond]
  47. JM says:

    SHMessageBoxCheck places a key in HKEY_CURRENT_USER for every user who checks the “don’t show this dialog again” checkbox. However, suppose we have an all-users install of a program and 4 of the users check the box. If one of the users uninstalls the program, we cannot remove the registry key for the other 3 users during the uninstall.

    I don’t understand what anyone can do about this scenario without leaking registry keys. Am I missing something, or is this behavior as designed?

    [Response. -Raymond]
  48. Mike says:

    Hey Raymond,

    I’m wondering why windows doesn’t ship multilingual. Resource files can – as most people know – contain several languages, and depending on the user’s preference the system could appear in his or her native language. It’d help a lot in multilingual environments where people from all sort of countries logon with their own profile and get their familiar environment. Also, it’s difficult to obtain a copy of windows in your native language when living abroad.

    So, why doesn’t MS just ship multilingual versions of windows? This is one of the things that I really don’t understand.

    – Mike

    [Um, Windows has done this since 2000. -Raymond]
  49. Andrew M says:

    Raymond:
    I was hoping you could address how to properly code Unicode character input. It seems like a lot of applications don’t support it correctly.
    Andrew

    [Response -Raymond]
  50. dingo says:

    I’ve always been curious why Windows shortcuts are such a pain to handle programmatically (comparing to unix links).

    [Response. -Raymond]
  51. Vig says:

    Dear Raymond
    What are your suggestions for students who have just joined their Bachelors course in computer science or about to complete the course.
    What books do you suggest are good for becoming a good software engineer? What courses to take etc? can you please share some advice? Thanks

    [My suggestions are to read the “Topics I’m not inclined to cover” in the base article. -Raymond]
  52. Vitaly says:

    Could you explain why Windows start browser if file name passing to ShellExecute is starting from “home”. You can test it just by pressing Win-R and then typing home<anything>. Just <anything> or just “home” will result an error message, but “home<anything>” will open browser with that page.

    Why?

    [Response. -Raymond]
  53. I’ve been trying to write an application which allows to drag and drop documents from lotus notes. If I just drag and drop a document from lotus notes to Windows explorer, it creates a .shb file (regular windows document link file). Therefore I think it is possible to simulate this in a custom application as well.

    BTW: I found that lotus notes uses following list of clipboard formats for OLE drag drop.
    Notes Private Data
    Notes Private Link
    Link Source Descriptor
    Link Source

    I also think only the last two formats will be enough for the task I want to accomplish. In fact they are more likely to be windows OLE clipboard formats. However, these clipboard formats are not documented.

    I would be grateful if you could send me the definitions of data structures I could use to access data from these CFs.

    [Response. -Raymond]
  54. praful says:

    If you drag My Computer to the Start button in XP, you get an expanding menu that lets you see all files and folders as submenus.

    1. Is this menu available to applications via an API, or do you have to build it yourself? For example, can an application have a pop-up menu, with the My Computer menu in it?

    2. If the My Computer menu is available as an API, is it customisable so that, for example, only folders are displayed and items can be added to the menu?

    [Response. -Raymond]
  55. TC says:

    Not sure if this is within your ambit of interest, but: I’d be interested in some comment as to why INI files & so on were deprecated in favour of the registry, but then it all changed back; ie. the registry is now deprecated in favour of XML files, or whatever.

    The reason I ask is that I have been relatively blind-sided by this; I only realized it a short time ago! So I’ll have to change my app accordingly. It’s easy to say “read the guidelines”, but as a 1-man shop, I have little enough time to write the code in the first pace!

    Cheers,
    TC

    [Response. -Raymond]
  56. TC says:

    (hoping this stays immediately below my other post)

    My question is in relation to application-specific values (currently stored below HKLM/Software/MyCorp/MyProd).

    TC

  57. Phil Quirk says:

    Why can’t you call SetFocus() on a window in another thread?

    [This is one of the five things every Win32 programmer should know. I consider it a prerequisite for reading this blog. -Raymond]
  58. Mihir Gore says:

    I implemented the IContextMenu using Visual Studio 2003.Net by creating a ATL project. In the QueryContextMenu interface I add three menu items but only the first one is visible.

    If use the same piece of code with a project created using Visual Studio 6.0 , it works…

    If I import the same project in Visual Studio 2003 it works.. but If I create something from scratch it does not… I am pasting the code which I use to create the menus

    if (CMF_DEFAULTONLY & uFlags)

    return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,0);

    UINT currentCmdIdx = 0;

    UINT idCmdCurrent = iCmdFirst;

    BOOL bSuccess;

    bSuccess = InsertMenu(hMenu,indexMenu,MF_STRING | MF_BYPOSITION,iCmdFirst,__TEXT("First menu"));

    currentCmdIdx++;

    bSuccess = InsertMenu(hMenu,indexMenu+1,MF_STRING | MF_BYPOSITION,iCmdFirst + 1,__TEXT("Second menu"));

    currentCmdIdx++;

    bSuccess = InsertMenu(hMenu,indexMenu+2,MF_STRING | MF_BYPOSITION,iCmdFirst + 2,__TEXT("Third menu"));

    return MAKE_HRESULT(SEVERITY_SUCCESS,0,3);

    Any help will be very useful.

  59. Sean says:

    I keep on getting people saying that Win9x is merely an extension over dos. Is this true? and how much of Win95 is still based on dos?

    [Response. -Raymond]
  60. Arno says:

    Hi !

    The problem I got is the following :

    * I have an application with its main window and a modal dialog box activated.

    * I have another application that manages the other and sent a WM_DESTROY to it.

    The application crashes when WM_DESTROY is received while the modal is on.

    Obviously it hangs in the code after the call to the modal box creation because all resources where released in the WM_DESTROY treament of the main window.

    How can I avoid this problem ? I mean, what is the standard way for an application to close wheter it has a modal box or not ?

    Should I send an application message different from WM_DESTROY to the main window (in order just to call PostQuitMessage) – but in this case, when will I be called for the WM_DESTROY ???

    Thank you, my mind is a littlely shaked !

    Thanks you for your wonderful blog I follow since two years now

    Arnaud TOURNIER

    Paris, FRANCE

  61. Dewi Morgan says:

    Here’s some fun insanity: it’s generally accepted (by keyboard manufacturers, computer manufacturers, etc) to be IMPOSSIBLE to disable or remap the power/sleep/suspend buttons under Win32.

    Why is this?

    This knowledgebase article has a link to code for a filter driver that would solve this problem. However, there is no trustworthy compiled version of this software anywhere on the net, so far as I can see.

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q302092#kb1

    The control panel gives you the option to change the actions of these keys, between "Standby, Hibernate or Power Off" – there is no "disable" option, nor an "open ‘shut down’ dialog" option. However, closing a laptop screen CAN be mapped to "nothing", so clearly this would have been possible.

    So what is the solution that everyone has adopted? Physically remove the keys. Or buy a new keyboard without those keys (increasingly difficult nowadays).

    These keys tend to be internal, rather than keycaps, which means opening the keyboard. Removing these keys hae been responsible for more keyboard warranty voidings than any other cause.

    WHY? Sure, remapping them is tricky, because ACPI is handled at a lower level than the scan codes. But it’s not a remapping issue: it’s an "ACPI options" issue.

    If we could make them do "nothing" for the ACPI, then we could also remap their scancodes to perform useful functions.

    But as it is, these keys simply perform an undesired and actively dangerous action: shutting down the machine and all applications without saving anything, and without ANY PROMPTING WHATSOEVER.

    Evil, I say.

  62. Dewi Morgan says:

    Update to my prior note, I found a for-pay tool here:

    http://www.bytegems.com/ihatethiskey.shtml … but who wants to pay for something that should just BE THERE?

    And there’s http://eugeb.narod.ru/Keyboards.zip claims to be a compiled version of the MS driver code. But for my USB keyboard, it caused all keys EXCEPT the ACPI ones to stop working. Good thing changing the driver back can be done completely by mouse :)

  63. Hexar says:

    When you maximize a window in a multiple-monitor environment, how does windows know which monitor to maximize it to, especially when the window overlaps monitor boundaries? Does it compute the pixel area of the part of the window overlapping each monitor, and pick the one with the biggest area?

  64. Jules says:

    In the article "Why do files and directories with no time/date mess up sorting in Explorer?", you commented that "you need the help of an external file system" to cause the sorting problem to happen.

    I thought you’d be interested that it can happen without such a system… I was able to achieve similar results by installing XP on a system with a buggy BIOS that had the year set to 16,488 yet displayed it as 2004 in the settings screen. This seemingly resulted in dates being written to the XP file system that were apparently correct but outside of the range that could be handled by explorer’s date handling, so it fell back on ‘no last modified’ time for these. The dates could be seen on the properties pages of the files, but were conspicuously missing from the ‘details’ view. The file sorting bug you mention appeared, and I was also unable to persuade .NET applications to run (they threw an exception in their startup code because the date of one of the system files they examined was out of range).

  65. Sandor says:

    Hi Raymond,

    We’re developing an win32 application where the safety of a password input field is critical. I googled around but haven’t found any comprehensive description about how can you make password input safe from keyloggers. Any advices on this topic?

  66. I’ve often wondered why it’s not possible to use drag and drop to re-arrange the order applications are shown in the Taskbar.

    I like to keep certain applications that I always have running at the left, and in a certain order. (Applications like Outlook, bug tracking software, Visual Studio, a TS session to a test machine, etc).

    After that I tend to have a lot of what I think of as "transient windows" things like cmd prompts, IE windows, etc.

    The problem is that if I ever need to shutdown and restart one of the long running applications, I also need to shut down all of the transient windows in order to get the newly started long running application back into it’s normal place. A lot of other people I’ve spoken to work in the same way, and are also frustrated by the fact that you can’t re-arrange the applications in the Taskbar.

    What is the reasoning behind not allowing apps to be re-ordered in the Taskbar?

  67. Luther says:

    You often talk about Dialog Boxes. I am building a window in code (not via RC or dialog templates) and attaching edit controls to it. There may be 10 windows with 25 edit controls each when I’m done.

    Within each window (one displayed at a given time) I’d like to TAB between the edit controls. Unfortunately, the only examples I can find on the net (http://blogs.msdn.com/oldnewthing/archive/2003/10/21/55384.aspx)
    want me to change my message loop to something like this:

    if (IsDialogMessage(hwnd, &msg)) {
    /* Already handled by dialog manager */
    } else {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }

    My message loop is in a completely different C++ file/class. For this to work as described, I’d need to pass the application (or make it global) to every single EDIT control – and I’d have to keep updating the “hwnd” used in the IsDialogMessage method above every time focus changed since that method works on a specific EDIT control at a time …

    Is that really necessary? I’ve built the EDIT controls with WS_TABSTOP style, and naturally, they are eating the TAB key. I can manually catch and GetNextDlgTabItem myself, but I wasn’t sure if that was normal.

    Is there a cleaner way I’ve overlooked?

    Many thanks,

    -Luther

    [Response. -Raymond]
  68. Bouzouki Mike says:

    I’d love to hear your thoughts about Vista’s break in backwards compatability wrt OpenGL 2.0. Aren’t you concerned about user perceptions, given that OpenGL 2.0 apps that worked fine on XP and 2000 will suddenly refuse to run on Vista?

  69. Dave says:

    The forum link at “Contact Me” has an extra char tagged at the end causing it to 404.

    [Hm, works for me. Maybe it got fixed in the meantime. -Raymond]
  70. FigBug says:

    Two topics I’d like to see covered:

    What goes on inside a call to MessageBox/DialogBox and why you should ever call MessageBox from inside a message handler that is re-entrant. I’m having a hard time explaining to people that it isn’t a blocking call.

    Why you can click on Explorer (to drag a file) and it doesn’t come to the foreground.

    [Response. -Raymond]
  71. Matt says:

    Speaking of errors, could you talk about handling errors generated by the Windows API? For example, according to MSDN, a list box can return LB_ERR or LB_ERRSPACE if LB_ADDSTRING fails. LB_ERRSPACE I assume is handled like a malloc error, but what about LR_ERR? What could cause an add to fail? What could I do to recover if it fails? Should I pop up an error message? What should the error message say? “I’m sorry, Windows refuses to add an item to a list box on your screen” doesn’t seem appropriate.

    Another example would be fclose or CloseHandle. Aside from passing it an invalid handle, what kind of situation could arise that would make that operation fail?

    I hope I’m not suggesting something you’ve covered already, but I don’t think you’ve covered this.

    [Response. -Raymond]
  72. Arno says:

    You have covered both ShellExecute (don’t use anything else to launch IE) and modal dialogs and the need to pass a owner HWND to ShellExecute. But in the first article you don’t do the latter. So do I need to pass a window to ShellExecute or not? When is it used? Yeah, when UI is displayed, but when does this happen, modally? Is UI suppressed if I pass NULL? Help!

    [Response. -Raymond]
  73. Gabe says:

    Is there some way to use Explorer’s filename sort function? Now that files are sorted based on their interpretation as integers, there is no simple way to meet user expectations of the order files should show up.

    Similarly, is there any historical reason for why files dragged from Explorer are not passed to the dropee in the order in which they’re selected or listed?

    [Response. -Raymond]
  74. Jon Potter says:

    I’d love to read a series on how you got into this job in the first place. How you ended up at Microsoft, your history there, etc. What it’s actually like working at Microsoft. How accurate was "Microserfs", etc..

    Not a full life history but a few articles along those lines would be really interesting!

  75. Brien says:

    Hi Raymond,

    I’d like to know if there is any way to sleep (or yield or have an event signalled) with a granularity under 1 millisecond under windows
    xp.

    Thanks,
    Brien

    [Response. -Raymond]
  76. Michael B says:

    Why isn’t SMB_COM_COPY implemented? It’s documented in the specification, why isn’t it actually implemented?

    To copy a file around inside a share, explorer drags the file down to the local host only to send it right back to the remote host.

  77. Alberto Martinez says:

    I always was a bit curious about why the tray… I mean, notification area icons were limited to only 16 colors in Win9x/2000. Also, I heard of patches for allowing 256 color icons in that systems, but I never liked the idea of patch or replace explorer.exe (I dont’t like the idea of having explorer.exe crashing).

    But this week I found a page that in addition to offering a patch, it also offered the list of bytes you need to change (for suspicious minds like me). I was shocked after discovering that after changing only 3 bytes from 0x1 to 0x11 you can get 256 color icons in Win2000. So I fired up an hex editor, changed the bytes, killed explorer.exe, replaced it, and voila, a nice Winamp notify icon in Win2000 (apart from the logical protests of Windows File Protection).

    I always thought that the patches added some code to explorer, or that replaced some structures, but if you only have to change 3 bytes it leads me to think that the feature was always available but disabled for some reason. Maybe a strange compatibiliby issue behind this?

    [Response. -Raymond]
  78. Andrej Budja says:

    Do you have any details why cmd.exe is not themed in Windows XP? There a KB 306509 on this, but it’s very short:

    The Command Prompt window runs under the Client Server Runtime System (CSRSS), which cannot be themed. ”

    Do you have more details on this?

    [Response. -Raymond]
  79. Nawak says:

    I would like to know why WinXP’s winlogon.exe has open handles on “C:Program Filesmicrosoft frontpageversion3.0bin”, “C:Program FilesFichiers communsMicrosoft Sharedweb server extensions40isapi_vti_adm” and other folders that do not seem to belong to winlogon’s business…

    (Found that with sysinternal’s ProcessExplorer after wondering why i couldn’t remove FrontPage’s “bin” folder even after uninstalling FrontPage)

    [Old topic. -Raymond]
  80. Adam Russell says:

    Why does CTRL-Scroll Lock cancel dialogs? Or, at least, regular Windows dialogs? (Office’s, for instance, are unaffected, despite their support for things like the double-click radio button behavior.) I don’t see it listed in KB301583 and couldn’t find it documented elsewhere. And are there any other weird keyboard shortcuts like this one?

    [Response. -Raymond]
  81. carlos says:

    Would it be too much for you to take a look at the problem described at http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/28073 ? Thanks.

  82. Fredrik Hesse says:

    How about explaining this:
    If I start an application, let’s take notepad as an example, and then move part of it off of the desktop (so only half of it is visible). And then lock my workstation, when I later unlock it, the entire window has been moved into the desktop, why is that? A precaution so you won’t have any not-visible windows?

    [Response. -Raymond]
  83. Stefan Kuhr says:

    Raymond,

    I would like to know if Raymond uses _alloca for smallish stack based copies of some string or some such. VS2005 with prefast turned on discourages the use of _alloca. I think this is because you never know if memory can really be committed. How do user land developers at MS cope with stack space possibly not being committed?


    Stefan

    [Response. -Raymond]
  84. taken from http://www.itjungle.com/tlb/tlb083005-story02.html

    “Windows can only handle 64 threads”

    In other Itanium news, Intel confirmed that the future “Tukwila” Itanium, due about 2007 or so, would indeed have four cores and would employ a new architecture. This is the Itanium chip that will plug into the same Reidland Xeon platforms that are being called “Richford” when an Itanium chip plugs in. Tukwila will have HyperThreading, by the way, because those extra virtual threads mean something to customers deploying databases on Itanium iron. While this is true, the fact is Intel just retrofitted it onto Montecito, and taking it out in the Tukwila design would probably cost as much as putting it into Montecito in the first place. Considering that Windows can only handle 64 threads, a four-socket Tukwila box will be maxxed out on the thread count, which means Microsoft (and indeed other operating system suppliers) had better get their operating systems tweaked to support more threads. Because more threads are indeed coming than they can now use.

    [Response. -Raymond]
  85. Mike Williams says:

    Two niggling questions:
    1. Why does Explorer often show a + tree expander button next to folders that don’t have any subfolders? And why doesn’t clicking it make it go away?

    2. If I’m renaming a file in Explorer, why does it lose focus (and any mid-edit changes) if Explorer finishes another task? Isn’t the UI multi-threaded?

    [Response. -Raymond]
  86. Diego says:

    Hi

    The more I’ve thinking about it….so we will have soon dualcore CPUs everywhere (Good)…but then, there’s a problem: programming drivers for multiprocessor machines. Not easy to program, not always easy to reproduce and find that kind of bugs, very easy to hang a box if not done well….

    I wanted to as you: Do you expect dualcore boxes to become a new world blue screens? Of course, people who writes drivers for win2003 etc. cares about this…but consumers? I bet my ass that many windows setups will die as soon as you put a s*itty driver on them. I don’t bet…I know! I had a windomodem which deadlocked on my face (I had to remove one cpu to be able to dialup and update the driver – I didn’t knew about /onecpu then! ;)

    IOW: Have you had some interesting, anecdotical experience with this issue? Do you expect this to become a problem for microsoft? (everyone will blame microsoft for it even if they don’t do the drivers, etc…)

  87. Roland Persson says:

    I’d be interested to get an account of the interesting aspects of DLL/EXE loading (as you see them).

    Especially things related to bad performance due to relocation, paging etc. I’m currently building something rather large. The build process basically invokes a compiler a large number of times and when looking with performance monitor the average CPU privileged time is 75%. So I guess this means the system is only doing “useful” work (such as actually compiling) 25% of the time.

    The disk does not appear to be really strained and there is a lot of free memory.

    How does windows handle an executable that is started repeatedly but always terminates in between runs. If it needs relocation (maybe this cannot happen?) will that relocation be cached somehow?

    [Response. -Raymond]
  88. TC says:

    This is probably not in your sphere of interest, but: how about telling us why Access 97 does not register itself correctly (in the registry) if the PC has the Hattenschweiler font installed?(!) It seems like such a goofy problem; surely this appeals to you! One of my users just got it recently, which reminded me. It is issue http://support.microsoft.com/?id=141373

  89. Rick Scott says:

    You mentioned that Win32 always passes null for hprevinst to winmain ( http://blogs.msdn.com/oldnewthing/archive/2004/06/15/156022.aspx )

    However, VB6 still has this functionality in 32 bit windows. If the topic sparks your interest at all, I would enjoy a post about this.

    OT: I love your blog so much that I want to have your man-babies.

  90. TC says:

    Heavens! There’s devotion for you!

  91. Jason says:

    Dear sir,

    This is probably the dumbest question listed in this suggestion box, however, I have not been using the Windows API for very long and some things still vex me. I am writing a DLL which is to be used as an extension to an interpreted scripting language called "Dialect". To make a long story short, I am trying to create a PEN object (on Windows 98) that uses a bitmap. I have done many a search using "bitmap", "bs_pattern", "extcreatepen", etc, etc..

    So far the most successful attempt has been to create a geometric pen, create a pattern brush, begin a path, draw the line, then use WidenPath and FillPath. When I say it was successful, I meant that the bitmap was, indeed, used and the line was drawn exactly as I had wanted it… HOWEVER.. the bitmap used still appears to be 8×8. The API documentation has the following quote:

    "Windows 98/Me and Windows NT/2000/XP: Brushes can be created from bitmaps or DIBs larger than 8 by 8 pixels"

    Is that an error in the documentation (does Win98 suffer the same restriction, or only certain versions of Win98)? I only ask because every attempt that I have made results in the bitmap being no larger than 8×8. By the way, if it matters, I am using LoadImage to make the bitmap (with the LR_LOADFROMFILE and LR_VGACOLOR flags), CreatePatternBrush and ExtCreatePen. I know that this is a simple question that you may never have the time to answer, but, I thank you, anyway; the time and information you have provided here has been so much more useful than you may ever know.

    -Jason

    moffittj@mailbox.darton.edu

  92. Jason says:

    I made a mistake in my previous post. What I meant to say was "does Win98 suffer the same restrictions as Win95, or do only certain versions of Win98, if any". I realize that bitmaps larger than 8×8 CAN be used, but will they always be clipped (or is it shrunken, I cannot tell) to 8×8 (I am using Win98 second edition to test this, by the way). Also, to clarify things, it does not matter what values I use in LoadImage for the width and height (unless I use extreme positive or negative values, of course… ;)).

  93. TC says:

    Hm, from the top of this page:

    "Topics I am not inclined to cover: … Debugging a specific problem. (Not of general interest.)"

    Jason, try asking here:

    http://groups.google.com/groups/dir?q=microsoft.public.programmer.gdi

  94. Diego Barros says:

    Hi Raymond,

    Recently while dealing with some VB code I found out that VB does not have short-circuit evaluation by default. I didn’t believe this at first. It just doesn’t make sense to my. Why would I want to not have it?

    I posted about it here: http://www.radioactivecode.com/?p=20

    I was wondering if you knew anything as to why it is the way it is?

    Great blog.

    Regards,

    Diego

  95. Michael Puff says:

    The UpAndDown Control.

    I mean this control with which you can increment or decrement numbers in an edit control. Hasn’t anybody at Microsoft yet noticed that it isn’t working the way you expect it to work? If I click the “up” arrow button, I expect the numbers to increment: up, upwards, increase, numbers getting bigger. Well, the guys at Microsoft didn’t seem to share this expectation, because the numbers are decremented if you click the “up” arrow button. And if you click the “down” arror button they become bigger and increment. It’s like as if the buttons in a lift where numbered up side down: First story: ‘#25’, last story ‘#1’ of a 25 story building.

    I just realised it, when I used such an control in a dialog resource with the properties ‘Auto’ and ‘SetBuddy’ set to True.

    [Response. -Raymond]
  96. orcmid says:

    I remember that you had this nice collection of spam statistics, and I thought you might be delighted by something I stumbled on over a year ago and gave up reporting to people. It came up again in a note I wrote, and I mentioned you, so here it is.

    – – – – Easy Phish Detection – – – –

    There is a particularly sneaky kind of phish message that takes advantage of HTML formatted mail, GIF images of what appear to be legitimate notices, and some image-map bugs for hiding the hook.

    Oddly, these messages also give themselves away.

    First, if you can look at the SMTP headers, there is usually something amiss with the routing and the origination of the messages. (My mail reader lets me see those by clicking View | Options.) And many times, of course, the phisher impersonates an institution for which you have no account or for which you do not use the email address that the phish is sent to.

    But, even funnier is the fact that the messages have material in them that completely gives them away. And it takes about two key-clicks to see the gimmick, as explained at <http://orcmid.com/blog/2004/08/candling-phish.asp&gt;. Why the mystery text? Is it phisher bragging rights or what? Well, no, it is a lame effort to confuse any spam filter and have the phish make it into your in box. This is a kind of catch-22 problem for phishers.

    Most of the phish that I have received lately (I’ve been getting one a day pretending to be from amazon.com, and now a round of eBay and PayPal ones are showing up) are very lame. There seems to be decreasing effort at disguising the origin of the message. And when viewed in plaintext, as my email always shows them to me, the hook, the URL that links to the bogus site, is apparent. These are easy to report to the appropriate security centers, and I’ve been doing that.

    It’s not quite so simple, however, with the one that I received yesterday and promptly forwarded to eBay. In this case, the image map trick was accomplished in a way where the exploit was not visible in the plaintext that Outlook 2003 showed me. I had to view in HTML, save the message in HTML, and then display the HTML in Notepad as text. It’s very simple and appears to be based on a browser bug, but I can’t be sure. Here’s the text, which isn’t much without the GIF file that is used to cover it all over:

    (HTML follows. Not sure what this comment form will do with it.)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <HTML><HEAD>

    <META http-equiv=Content-Type content="text/html; charset=us-ascii"><MAP

    name=oyijmf><AREA shape=RECT coords=0,0,646,569

    href="http://2xx.6y.1zz.1q:680/rock/eBayIsap/"></MAP&gt;

    <META content="MSHTML 6.00.2900.2722" name=GENERATOR></HEAD>

    <BODY><B>From:</B> eBay [custservice_ref_8455227744846@ebay.com]<BR><B>Sent:</B>

    Thursday, October 06, 2005 02:02<BR><B>To:</B>

    orcmid@xxyyzz.qqq<BR><B>Subject:</B> Update Your Account Records [Thu, 06

    Oct 2005 02:03:26 -0700]<BR>

    <P><FONT face=Arial><A

    href="https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&amp;sid=verify&amp;co_partnerId=2&amp;siteid=0"><IMG

    src="cid:part1.07010605.05090703@support_ref_2672388@ebay.com" useMap=#oyijmf

    border=0></A></A></FONT></P>

    <P><FONT color=#fffff9>Let’s face facts. Cliff Notes driving at? in 1986 Mac

    </FONT></P></BODY></HTML>

    I have neutered the hook, using IP address 2xx.6y.1zz.1q in place of the actual one. What’s nasty is that when you mouse over the image, you’ll see the https URL, but if you click on the image, the link in the <MAP> is the one that is used. You can also see the anti-spam text near the end and how it is made invisible (but not to Select All). I don’t know where they get these. They are all pretty funny.

    Of course, the fact that the phish is entirely in an image is a giant giveaway to start with. And the Edit | Select All will make that apparent too, if cursor shape-changing doesn’t attract your notice first.

    Now, I detected this over a year ago and I’ve reported it to some security authorities, but I have never seen it discussed except on my blog. I wonder about that. I think it is a phenomenon that Feynman loved to observe. Technologists have eyes only for technological solutions, and simple things seem uninteresting. (I should have sent this to Raymond Chen. He’d get it.) We don’t think of simple kitchen science (O-rings in ice water, for example) and there are many other ways that we overlook the obvious. I do that too. What I liked about this is that anyone can do it. You can candle all the phish you want. You won’t catch them all, and you do need to be suspicious enough at the outset. Maybe that’s the key.

    – orcmid

  97. Jason says:

    TC,

    I was already aware of the Google newsgroups, but thank you for

    the effort to help me, anyway. I followed your link (the correct one);

    unfortunately, it was one of the many threads that I have already read

    on the subject (which is not really that important in the first place).

    I did, indeed, read the "topics I am not inclined to cover" list.

    Maybe I did not express myself clearly enough, or perhaps I used the wrong

    terminology; I was not looking to debug a specific problem.

    The MSDN documentation states the following:

    "Windows 98/Me and Windows NT/2000/XP Brushes can be created from bitmaps

    or DIBs larger than 8 by 8 pixels". I, however, always end up with an

    8×8 sample of whatever bitmap I try to use.

    I was not sure if I was reading the documentation wrong, if there

    were some mistake in the documentation, or if this was just some common Win32

    knowledge that I lack. It is true that I was looking for some clarification on that

    statement. It is also true that it was "specific" b/c I gave my own situation

    as an example. I was not, however, looking for anyone to debug for me.

    This is a "suggestion box". Given the lack of information

    I was able to find with my search, I accept the fact that I have probably been

    doing something wrong. I simply thought that my example, or

    lack of knowledge, might provide anyone more knowledgeable on the subject

    of the Win32 GDI with something to write about. I apologize for wasting anyone’s time.

    -Jason

  98. ion says:

    Dear Raymond Chen,

    I’m a developer from Hungary, Europe. I would like to read some stories about what Apple “copied” from Microsoft and what Microsoft “copied” from Apple (in the Windows 95 era, etc). There’s a growing Apple community in my country but they became extra-fanatic as time goes on. Sometimes it’s very hard to discuss exact topics with them because they think everything was invented in Cupertino… it’s very hard to find good resources.
    If you won’t tell anything it’s ok. I understand. It’s not really interesting i know.

    [Response. -Raymond]
  99. Darren says:

    I remember in a post a while back you had been asked a question about how to hide files and folders from Explorer. You mentioned how that wouldn’t be very good because it would allow malicious users to hide things very effectively.

    I recently noticed that in the Office suite, it saves temporary files to… C:Documents and Settings<myusername>Local SettingsTemporary Internet FilesOLKD (varies).

    When I open up Windows Explorer and go down to the Temporary Internet Files directory, I cannot see the OLKD folder anywhere unless I type it directly in the Address bar, which proves that the folder exists.

    Question is…. How does Office hide OLKD from me? I’ve unchecked hide hidden folders/files and hide system protected files. Is there another mystery switch somewhere to allow everything to be seen?

    [Response. -Raymond]
  100. David Candy says:

    There are some problems, not that common, where cut and paste stop working. I thought about it and came to the conclusion that an app has opened but not closed the clipboard. So I wrote a program to examine the clipboard. I didn’t know how to test it (I don’t have that problem) so I wrote some programs to open and close the clipboard and confirmed that symptons people report match that of a locked clipboard (in notepad copy is available but does nothing and paste in not available).

    Because VB is such a UI dog and you won’t tell us the correct size of UI elements in pixels (VB makes everything wrong sizes and dlg units are useless) I tend to write windowless programs (because I’m really tired of counting pixels in paint of screenshots). This lead to a discovery (and the discovery gives me this excuse to rant).

    If a invalid hwnd (and GetActiveWindow is invalid in this sense but not GetDesktopWindow() but this might be because I’m passing someone’s else’s hwnd) is passed to openclipboard() then any attempt by another program to open it will fail but will unlock the clipboard so a second call will work.

    I have a sense and so do others that one frequently has to copy data twice.

    Do you know anything about this?

    * All references to lock is the state of the clipboard not memory lock functions a la 16 bit clipboard.

    [Response. -Raymond]
  101. David Candy says:

    What do the stars mean?

    What’s the deal here between PSDK docs on RichEdit Hex to Unicode IME and XP’s Help and Support. Does XP’s apply to non richedit 3 (so wouldn’t apply to Wordpad) and PSDK to RE3.

    I had thought prior to XP that it was 3 digit or 4 digit the IBM/ANSI. Is this still true. Will we get in trouble for calling it IBM.

    Do all these rules resolve to the same thing.

    From Hex to Unicode IME topic
    =============================
    2nd paragrapgh.
    The second method involves the number pad. Here the user types ALT+NumPad numbers (with values greater than 255) to enter Unicode characters using decimal values. This method is not as useful as the first method because you cannot see what hexadecimal digits you typed. Also, you cannot correct them except by reentering them all again.

    Platform SDK Release: August 2001 What did you think of this topic?
    Let us know. Order a Platform SDK CD Online
    (U.S/Canada) (International)

    FROM HELP

    If the first digit you type is 0, the value is recognized as a code point, or character value, in the current input language. For example, when your current input language is US-English (Code page 1252: Windows Latin-1), pressing ALT and then typing 0163 on the numeric keypad produces £, the pound sign (U+00A3). When your current input language is Russia (code page 1251: Windows Cyrillic), the same key sequence produces the Cyrillic capital letter JE (U+0408).
    If the first digit you type is any number from 1 through 9, the value is recognized as a code point in the system’s OEM code page. The result differs depending on the Windows system language specified in Regional and Language Options in Control Panel. For example, if your system language is English (US), the code page is 437 (MS-DOS Latin US), so pressing ALT and then typing 163 on the numeric keypad produces ú (U+00FA, Latin lowercase letter U with acute). If your system language is Greek (OEM code page 737 MS-DOS Greek), the same sequence produces the Greek lowercase letter MU (U+03BC).

    I came across this while trying to confirm that Insert (vs Overtype) is not a global state. Why don’t gui apps change the caret like terminal windows (command/cmd/any dos prog).

    [Response. -Raymond]
  102. I would like to know the history behind the earth map at the Date and Time properties, at the Time Zone tab.
    I cannot click the map to change the time zone, there is no feedback whenever I change the Time Zone through the combo box.
    It seems that the Map is there for cosmetic purpose.

    [Response. -Raymond]
  103. ivan says:

    Is there a way to get the current full path from an explorer window?

    [Response. -Raymond]
  104. Nathan Baker says:

    Hello, Raymond. I have been curious for a while now about why API functions seem to always use signed values, even when the value cannot logically ever be a negative number. Not just APIs, but also data structures (since when can a queue have a negative length?) and that sort of thing.
    Maybe this question isn’t deep enough to warrant a post of its own, but it is something I have been curious about.
    Thanks,
    Nathan

    [Response. -Raymond]
  105. Travis Owens says:

    What ever happened to the ram drive?

    I’m sure there’s a great reason why ram drive was removed around the time Windows 95 shipped, but being DOS based, why was the ramdrive commant removed?

    I know they serve more as a nerd toy for specific problems back in the day (ex: a small program that had to do excessive read/writes would get a huge boost from using a ram drive) but at times I’ve thought they could be usefull on a small scale.

    So, why did ramdrive get the axe after DOS?

    [Response. -Raymond]
  106. This may be too much like “topics I’m not inclined to cover”, but I figured I should ask just in case. I just learned about Singularity http://research.microsoft.com/os/singularity/ yesterday, and read some of the overview white paper ftp://ftp.research.microsoft.com/pub/tr/TR-2005-135.pdf. I think it looks really interesting and promising, and I was wondering what you think about it.

    [Response. -Raymond]
  107. Nawak says:

    I don’t know if it’s caused by other applications or not, but it just happened to me now (just after the boot), so I am curious about this:

    Is there a particular reason why, sometimes, a left click (on the desktop, but maybe in other applications) is interpreted as a right click and pops up a context menu. It persists for every left clicks until you decide to right click (to make the computer understand the difference, of course! :) ), then everything is in order again.

    Is there a specific code (a workaround for something else maybe) that is triggered by error and cause the button ‘permutation’?
    If so, what is its purpose?

    [Response. -Raymond]
  108. Sencer says:

    It looks like the defragmentation programs available for WinXP are worse than those for Win98. See this discussion (with comments from Vendors):

    http://www.experts-exchange.com/Operating_Systems/WinXP/Q_20323201.html

    I remember using Defragmentation Software on Win98 and having consolidated free space (in one big large chunk). But I, too, have made the observation, that with WinXP this is not possible anymore. Since I have a lot of Cygwin and Java related stuff installed, which uses many, many directories and small files, it seems I can never consolidate the 4 GB free space of my 15 GB partition. There are always the “folders” all over the free space fragmenting it into small pieces.

    Is it true (as suggested in the link above) that Software for Win98 used to “lie”? Or did it in fact become (practically) impossible in WinXP to move all olders together and thus consolidate all free space into one chunk?

    [Response. -Raymond]
  109. Jeff Atwood says:

    In reference to your post about how Calc and Notepad barely change..

    http://blogs.msdn.com/oldnewthing/archive/2004/05/25/141253.aspx

    Why not buy and bundle the “lite” versions of popular third-party solutions? Very little MS coding time (some QA), much happier customers:

    http://www.codinghorror.com/blog/archives/000441.html

    [Response. -Raymond]
  110. Kevin says:

    Windows XP lets me do pretty much anything I want to the system: install applications, delete files, move files, etc. and it never asks for my user account password… except when I create a new task using the Task Scheduler and then it asks for a password. I’ve often wondered about this…

    [Response. -Raymond]
  111. PiersH says:

    How can I get the Aero glass effect to extend into the client area of my app (like IE & Explorer on vista#5231)?

    [Response. -Raymond]
  112. Radhakrishnan Mukkai says:

    When we have a dual monitor setup, why doesn’t the taskbar (at the bottom of the screen) span across both the screens?

    [Response. -Raymond]
  113. David says:

    Two things that I’ve always wondered about. 1 – Why does the desktop loose track of the icons, so it has to refresh them?

    And 2 – Why in the shell connected to explorer. If explorer crashes, then the shell restarts. Oh, and not all the tray icons reappear. Who thought that was a good idea??

    [Response. -Raymond]
  114. Randolpho says:

    You’ve had a blog about “What causes a program to be marked as “new” on the Start menu?”… how about an under-the-hood look at the Windows Vista Start menu? Is it still shortcut file/folder based, or is it finally managed and tightly integrated with program installation?

    [Response. -Raymond]
  115. jojjo says:

    Hi Raymond!

    Do you have any insights into the evolution of WinHelp? How integrated with the developement of Windows is the developement of the help system?

    On a related note, I have found it harder and harder to get help from inside Windows applications during the last ten years. When I want to know how to use a program today I tend to use Google or MSN Search instead. Is it just me, or are other users doing the same thing? Are application writers not paying as much attention to their help systems anymore or is the Web just a better way of finding information quickly?

    [Response. -Raymond]
  116. Ben says:

    If you’re ever bored, pull down the source for the win32 version of SWT. SWT is a Java GUI toolkit closely associated with the Eclipse IDE and is available as a standalone download from eclipse.org.

    There are different versions of SWT for each platform the toolkit is available on – e.g. there’s a win32 version, linux/gtk version, etc.

    The comments in the source code for the win32 version are pretty interesting. Search for "bug in windows" – just about every low-level class that interacts with the Win32 API has this comment, many in multiple places. It usually prefaces a long comment block explaining the "bug" in the Win32 API the following code is attempting to work around.

    Are these really bugs? Or just nuances of the Win32 API the authors of SWT didn’t understand? Either way, these comment blocks indicate some of the more subtle aspects of the windows API, and discussions of them would make for some interesting blog posts.

  117. Jonathan Wilson says:

    Do you know why there is a GetDlgItemInt and a SetDlgItemInt but not a GetDlgItemFloat and a SetDlgItemFloat.

    [Response. -Raymond]
  118. Jon Deeming says:

    I’ve noticed that Internet Explorer (and WinZip, although that’s not something you can comment on) downloads data to a temporary file and then copies the file to its final location, before deleting the original.

    Given that this results in 2x the disk space to copy, I don’t understand why the file isn’t simply moved? (Particularly if the source and destination locations are on the same partition!)

    The other effect of this is that the copy obviously takes longer than the move, so the user (i.e. Me) has an additonal delay.

    I’m sure there’s a weird, yet sensible, reason.
    But what is it?

    Thanks,
    Jon.

    [Response. -Raymond]
  119. zd says:

    Why can’t you rename the Recycle Bin?

    [Response. -Raymond]
  120. Koro says:

    Hi,

    I remember back in the times of DOS 2.11, there were plenty of warnings in the user guide to “never rename a COM file to .EXE or vice versa”. However, if you did, the system still happily ran the file with no problem.

    Was some sort of hack added to prevent dumb users from doing exactly that? How did the DOS loader recognize the binary format? (Because, I assume, it could be possible to have a .COM file whose 2 first instructions would give ‘MZ’, so just checking for these bytes is not enough)

    [Response. -Raymond]
  121. Michael Moulton says:

    Raymond,

    Back in the Win95 & 98 days, we had winipcfg to manage DHCP leases on the client. Additionally, we had an app (I think it was netmon) to let you view people currently accessing your shares.

    Now, we have ipconfig on the command line and nothing like netmon.

    I’d be interested in hearing why those tools weren’t retained.

    [Response. -Raymond]
  122. Greg Webb says:

    After doing an Internet search on ‘Windows Dialog Resources’ I found your four part article on ‘The Evolution of Dialog Templates’.

    What I would like to do is edit some of the dialog templates used by Outlook. I continually find that the space for the information that has to be displayed is not big enough.

    I know about comdlg32, shell32 and user32 but none of these contain the tempaltes Outlook is using. Can you tell me where the the Outlook dialog templates are stored?

    A suggestion for a future topic is, Customising dialogs for popular Microsoft software.

    [Response. -Raymond]
  123. Greg Webb says:

    Okay, I’ve solved it. The dialogs are in:

    c:Program FilesMicrosoft OfficeOffice111033outllibr.dll

    Dialog numbers:

    2098 – Categories

    2099 – Master Category List

    My suggestion for future topic stands, although my discovery allows me to make my own way on this now.

  124. Evgeny Krivosheev says:

    Some time ago I was got problem with WSUS server that not worked because anonymous user was not allowed to access specified directory.
    I was found error source and solved it, but I spend lot of time to find problem source.

    Source was interesting: Settings in one of domain policies was not specified anonymous users in list of users that have “Bypass traverse checking” right and anonymous users also do not have proper rights in one of parent directories.

    Why I spend so much time to this problem? Because only error that I can get is ACCESS_DENIED. I was used lot of tools to find source of problem (one of most helpful was FileMon from Mark Rusinovich) but when I go deeper – I always stopped by too short error message. Using tools that I have or can find I cannot determine who is blocking user access. For sure I was checked ACL’s and restrictions in policies. I was checked IIS settings many times too. But for long time I have no idea – what is real source of deny message.

    Maybe you find this theme interesting for you: it is exists any calls to find more information for ACCESS DENIED errors? After solving problem I also spend some time to search for answer, but cannot find anything interesting.

    [Response. -Raymond]
  125. Praful says:

    In your post “How to host an IContextMenu, part 10” (http://blogs.msdn.com/oldnewthing/archive/2004/10/06/238630.aspx), you mentioned the need to check if there’s room between idCmdFirst and idCmdLast. I have some questions related to do this for context menu shell extensions:

    1. What happens if there’s not enough room? Are you not supposed to activate your shell extension?

    2. I’m developing a shell extension that when called by Explorer, adds one top level menu item on the context menu and five sub menu items (a bit like WinZip). These submenu items have submenus defined – so they can be expanded dynamically. I listen for WM_INITMENUPOPUP messages in HandleMenuMsg2 to expand the submenus. When I get a message I expand one of the five submenu items. The actual number of menu items is not predictable. Therefore, what should I return to Explorer when it calls QueryContextMenu since I don’t know how many menu IDs I’ll eventually require (could be several hundred since there are many cascading submenus)? If I return 6 (one top level + 5 submenu items), Explorer eventually stops firing WM_INITMENUPOPUP. I’ve noticed that if Explorer gives me a narrow range for idCmdFirst and idCmdLast (eg 31085 and 31226, as it did while testing), I can’t add that many items since WM_INITMENUPOPUP is not fired. How do I tell Explorer that I may add, say, 500 menu items eventually?

    Thanks

    [I decline to answer this question because the answer is boring. -Raymond]
  126. Puckdropper says:

    When using the “dir” command in DOS and Windows (command.com) there appears to be a pause after listing a directory the first time it is done. If you know, would you care to comment on what’s happening there? Is it a free space calculation?

    [Response. -Raymond]
  127. There’s one limitation to the normal windows explorer, that bugs me quite much: It seems as if the windows explorer prevents the user from naming files as he / she wants to, even if the underlying file system is perfectly capable to store the name the user entered.

    For example, you can’t name a file “.htaccess” (without the quote marks of course), or you can’t have “.NET Framework SDK”. The problem in both cases seems to be the first character (the dot), but if you name the file any different (without the leading dot or whatever), then use any other program that is capable of renaming files / folders, it’s not problem at all for the filesystem (and all programs) to accept the name with the leading dot. For example, you could just use the normal cmd.exe, or any FTP/SCP-program (most of them are capable to rename files on lokal dirs, too).

    I would really like to know the rationale behind this nonsensical behaviour.

    I wouldn’t mind a warning “file names with leading dots may make some problems with old software, do you know what you are doing [YES][NO(default button)]”, but simply disallowing the user to use the name seems to be a bad idea for me …

    If you could shed some light on this issue, that would be great.

    [Response. -Raymond]
  128. Simon Cooke says:

    A few topic requests (two copied forward from the previous suggestion box).

    An explanation of the correct use of ScrollWindowEx.

    When you have (e.g.) a dialog containing controls which are outside of its client area, it makes sense to use ScrollWindowEx when you want to scroll them into view. Whenever I’ve tried this in the past, I’ve had to do some arcane tricks to get proper painting to occur without leaving glitches and artifacts – and I’ve heard the same story from many others. Of course, doing a full repaint misses the point – which is, scrolling the DC so that you don’t need to repaint everything. There has to be a correct way to use this API :)

    (The following were copied from the previous box:)
    A couple of topics (one I’ve brought up before, another that someone else brought up in the NCCALCSIZE discussion in Feb. but you haven’t returned to yet).

    1. Window Activation – how it works (and why you need to do the whole message-eating modal loop for FakeMenu).

    2. WS_EX_TRANSPARENT – what does this really do? For example, using GroupBoxes on a dialog with WS_CLIPCHILDREN enabled, you need WS_EX_TRANSPARENT on the group box or else its background is painted incorrectly.

    [Response. -Raymond]
  129. Dave Anderson says:

    I have just sent a frustrated letter to the Microsoft exec team and the SBA team. For those who do not know, Microsoft Small Business Accounting is a recent addition to the Office Suite.

    The essence of the letter is that SBA is the first example (IMHO) of one of the “new .NET products” that clearly demonstrates how losing the WIN32 API war is affecting true developers. The product is essentially unusable for a developer!

    It certainly should not be listed as an Office component because it does not interoperate with other Office components when one talks about the core of any accounting system (i.e. transactions). I could not believe that transactions cannot be moved from Excel to SBA!

    The UI clearly breaks Microsoft’s own guidelines which we have been faithfully following for the last 20 years. Try using keystrokes to accomplish SBA functionality and you will quickly run into a brick wall.

    The COM interfaces that Office uses to provide developer power are gone with SBA. Even the ADO interfaces are missing to allow open interfaces with other components.

    I can only imagine that the SBA team are part of the “we don’t care about developers” team. There seems to be no effort at interoperability, component interchange, power users, accessibility or any of the other important concepts that have drawn developers to Microsoft.

    If this is the future, then we might as well give up being developers which is a truly frightening prospect (for me anyway). I have been working with Microsoft products since the start and have always enjoyed working with them.

    [Response. -Raymond]
  130. Peter Kankowski says:

    Why does not Windows XP send WM_CLOSE and WM_DESTROY messages to open windows during shutdown? I have found that it sends the following messages:
    1) WM_ACTIVATE with wParam == WA_ACTIVE,
    2) WM_SETFOCUS,
    3) uMsg == 0x3B with wParam == 11 (have no idea what is it; there is no such message in WinUser.h),
    4) WM_QUERYENDSESSION,
    5) uMsg == 0x3B with wParam == 9,
    5) WM_ENDSESSION.

    But there is no WM_CLOSE or WM_DESTROY! There are some widely-used applications that fail to handle shutdown; e.g., they “forget” to save window position, because they expect WM_CLOSE message and put saving configuration in the WM_CLOSE message handler. Why not send them WM_CLOSE and WM_DESTROY? Thank you in advance.

    [Response. -Raymond]
  131. John Topley says:

    Why does Windows now also clear the Start menu Run history when you clear the list of recently opened documents? Windows 95 and NT 4.0 just used to clear the Recent Documents menu and left the Run history alone.

    [Response. -Raymond]
  132. Phil says:

    http://winhistory.de/more/386/xpmini_eng.htm

    An interesting attempt to find out what the mininum hardware Windows XP can run on.

    Includes plenty of screenshots. Just thought you might like it.

  133. I came across your article about DeferWindowPos() today. I have found this API can cause leaks. If you get return value of 0 with Error 87 (Invalid parameter) and then you SHOULD call EndDeferWindowPos() with the previous HDWP, because, at least on XP and 2000, the user object BeginDeferWindowPos() allocated has not been freed. Since this is against the documentation I am going to give up on the API and call SetWindowPos instead.
    Why do I get error 87? I have no idea. All the parameters are valid for the function but I sometimes get a failure on the very first call to DeferWindowPos().

    [Response. -Raymond]
  134. SHOULD call EndDeferWindowPos() with the previous HDWP, because, at least on XP and 2000, the user object BeginDeferWindowPos() allocated has not been freed. Since this is against the documentation I am going to give up on the API and call SetWindowPos instead.

    Why do I get error 87? I have no idea. All the parameters are valid for the function but I sometimes get a failure on the very first call to DeferWindowPos().

  135. Dirk says:

    Who wrote this code?

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/usingtimers.asp

    while (GetMessage(&msg, // message structure

    NULL, // handle to window to receive the message

    NULL, // lowest message to examine

    NULL) // highest message to examine

    != 0 && GetMessage(&msg, NULL, NULL, NULL) != -1)

  136. Ben says:

    I’ve recently been panicking [sic] about being obsolete. Can you discuss win32 and Vista? Or least point us to forum that does? Thanks.

    benya at dandy dot net

  137. Johann Scheepers says:

    From what I understand you are the TweakUI author, so I want to ask why the “Prevent applications from stealing focus” option doesn’t work (for IM programs that generally flash on the taskbar until you click them) if I set it to “Flash taskbar button x times”. Instead, it flashes indefinitely.

    Is this tweak broken because of the IM programs themselves? Surely this would override the IM program’s settings?

    [Response. -Raymond]
  138. Hi Raymond,

    When a dialog control is hidden (I mean WS_VISIBLE cleared, as opposed to coordinates outside dialog client area), it can still be ‘triggered’ (not sure ‘focused’ would be the right word here) using its mnemonic key.
    For example, a push-button can be pushed by striking Alt+mnemonic key.

    It looks pretty confusing/dangerous: An action can be triggered even though the button is hidden.

    What’s the rationale behind this behaviour ?

    TIA.

    [Response. -Raymond]
  139. BryanK says:

    Not sure if this is exactly shell related, but it’d be nice to know the reason behind the XP regression regarding the conflict between mapping a network drive and plugging in a removable USB-mass-storage device.

    (If you haven’t heard: The USB device chooses the first letter after the fixed disk drives (and perhaps CD-ROM), whether it’s in use as a network drive or not. 2000’s USB driver skipped any network drives that it found, so it works.)

  140. Mike says:

    Find out why the search box on your blog isn’t working correctly. For example, search for “Katamari Damacy” and you get no hits. However this page does exist: http://blogs.msdn.com/oldnewthing/archive/2005/10/04/476848.aspx

    [Response. -Raymond]
  141. Dandabass says:

    Mr. Raymond!

    Hi, I don’t really remember how or when I started reading your blog, but I find your point of views pretty much down to earth and interesting, and I just feel there’s a lot to learn from you!

    So, I was unistalling a program, and after a pop-up message i asked myself:

    What was Windows thinking when throwing this kind of questions to home users??!:

    e.g.:

    "The file C:WINDOWSsystem32mfc70enu.dll may no longer be needed by any application. You can delete this file, but doing so may prevent other applications from running correctly. Select Yes to delete the file."

    I mean, from a usability point of view, picture a home user, unistalling this software at around 3am… and he had never seen the mfc70enu.dll in his life!.. what kind of choices can he make? ‘It MAY no longer be needed bay any app, BUT! other apps my not run correctly’??

    I guess the questions are: How are this kind of messages thought? What’s the point of showing them? (keeping in mind Windows’ target audience) What department is responsible for making these kind of decisions? What kind of reactions are expected from users?

    Thanks a lot for your blog!

    Dan.

  142. Chris Becke says:

    In the context of an ansi (not unicode) app: How do the common controls (listview for example) decide which code page to use when translating multibyte to widestring?

    I had to debug an ansi app that was displaying corrupt strings on a traditional chinese system because the dialog font was causing the listview to use a codepage other than the system ACP when translating multibyte to widechar.

    [Response. -Raymond]
  143. Craig Ringer says:

    Pavel’s suggestion on DLLs is a good one. I’d be interested in hearing a bit about how the win32 DLL interface came about and how it evolved. That could be extremely helpful as well as interesting.

    It’d also be interesting to hear a quick explanation of, or pointers to information about, win32 DLL symbol import/export, since it’s clear many people – even win32 developers – don’t understand this, and good information on it is hard to find.

    To me the most interesting topic of all would be cross-DLL memory management, especially in a mixed code environment (two different c++ compilers with different runtime libraries; 32bit and 64bit DLLs; etc) . These mixed environments are almost inescapable on Windows, and finding decent information about working with them has been nigh impossible thus far.

    I’m a UNIX guy helping with the win32 port of an app I work on. Information on these issues has been hard to come by – and even knowing the background of why win32 DLLs work how they do would be useful and interesting. I’m not sure if it’s really your area, but I’d be very surprised if you didn’t have a few gems about the DLL interface’s beginnings.

    [Response. -Raymond]
  144. Chris Ashton (cashto) says:

    I came across an interesting bug this weekend that I’ve never seen described anywhere else, I thought it might be good fodder for your blog.

    What do you suppose the following code does?

    CComBSTR bstr;
    bstr = ::SysAllocStringLen(NULL, 100);

    a) Allocates a BSTR 100 characters long.
    b) Leaks memory and, if you’re really lucky, opens the door for an insidious memory corruption.

    Obviously I’m writing here, so the answer cannot be A. It is, in fact, B.

    The key is that CComBSTR is involved here, so operator= is being invoked. And operator=, as you might recall, does a deep copy of the entire string, not just a shallow copy of the BSTR pointer. But how long does operator= think the string is? Well, since BSTR and LPCOLESTR are equivalent (at least as far as the C++ compiler is concerned), the argument to operator= is an LPCOLESTR – so operator= naturally tries to use the wcslen length of the string, not the SysStringLen length. And in this case, since the string is uninitialized, wcslen often returns a much smaller value than SysStringLen would. As a result, the original 100-character string is leaked, and you get back a buffer that can only hold, say, 25 characters.

    The code you REALLY want here is:

    CComBSTR bstr;
    bstr.Attach(::SysAllocStringLen(NULL, 100));

    Or:

    CComBSTR bstr(100);

    I’m still a big fan of smart pointers (surely the hours spent finding this bug would have been spent finding memory leaks caused by other incautious programmers), but this example gives pause – CComBSTR and some OLE calls just don’t mix.

    [Response. -Raymond]
  145. Whatever says:

    What is the story behind the LOADPARMS32 structure? It takes a mix of C-style (NULL terminated) and Pascal (leading byte length) strings, and has a paramter which “must be 2”. What a mess!

    [Response. -Raymond]
  146. Mike Sax says:

    How does the Task Manager determine that an application is "Not responding"?

  147. Duncan Bayne says:

    One of the things I like about coding in the GNU environment is the availability of clear guidelines (now, if only people would follow them …)

    I remember starting off coding for Linux and thinking "how should I best go about this?", trotting off to the FSF site and finding the GNU Coding Standards, a copy of which I still have lying around in the off chance I ever find myself coding in C again ;-)

    Now, what would be great would be a Windows equivalent. It could be a post to your blog, it could be a static page on the Microsoft site, whatever works. But it should contain:

    – how to pay ‘taxes’ (i.e. the things different types of apps need to get right on the Windows platform)

    – UI standards (not just GUI standards, but guidelines for CLI apps, services, etc.)

    – Best practices for Windows components like WMI, Event Log, etc.

    – Coding standards for particular languages, and verfication tools (e.g. C# and FxCop)

    Microsoft often complains, justifiably, that a lot of complaints about Windows in fact have their origins in poorly behaved Windows applications.

    This would be a way of fixing that, while creating a ‘buzz’ amongst developers. It’d also make it easier to attract new developers to the platform, and it’d make my job a whole heap easier too :-)

  148. 8 says:

    When installing a font with the control panel, why does it have that retro windows 3.1 look? I’ve even seen the directory box suddenly use only capital chars (when changing the current drive, doesnt always work and i dont know the exact steps to reproduce), like it would back in 1992 or earlier. It’s even in server 2k3!
    Then, when it goes ahead and install the fonts, the copy dialog looks cool too.

    Like if no-one ever wants to install a font :D

    [Response. -Raymond]
  149. 8 says:

    Is it possible to use a loaded icon resource from another DLL (loaded with LOAD_LIBRARY_AS_DATAFILE) with MessageBoxIndirect? I have succesfully used FindResourceEx, SizeofResource, CreateIconFromResourceEx and CopyIcon to obtain a “local” copy of the icon, so I can then use FreeLibrary and then use it with WM_SETICON and STM_SETICON (ofcourse checking all the return values in the process, except in places where it doesnt make sense trying to handle the error like with FreeLibrary).

    Can I somehow use the HMODULE handle from LoadLibraryEx to point MessageBoxIndirect to the right place? Is there another trick to it (one that doesn’t involve copying the icon to a file on disk, and pointing to that, because that’s an awfully sloppy method, and my program should not expect write access, because it should be capable of running as Guest).

    It would be very much appreciated in my current (free) application, for consistency. Ofcourse when showing error messages, warnings and such i use the system provided icons.

    Much thanks in advance.

    [Response. -Raymond]
  150. 8 says:

    Is it possible to use a loaded icon resource from another DLL (loaded with LOAD_LIBRARY_AS_DATAFILE) with MessageBoxIndirect? I have succesfully used FindResourceEx, SizeofResource, CreateIconFromResourceEx and CopyIcon to obtain a "local" copy of the icon, so I can then use FreeLibrary and then use it with WM_SETICON and STM_SETICON (ofcourse checking all the return values in the process, except in places where it doesnt make sense trying to handle the error like with FreeLibrary).

    Can I somehow use the HMODULE handle from LoadLibraryEx to point MessageBoxIndirect to the right place? Is there another trick to it (one that doesn’t involve copying the icon to a file on disk, and pointing to that, because that’s an awfully sloppy method, and my program should not expect write access, because it should be capable of running as Guest).

    It would be very much appreciated in my current (free) application, for consistency. Ofcourse when showing error messages, warnings and such i use the system provided icons.

    Much thanks in advance.

  151. 8 says:

    Oops, sorry for the double post. The first one gave back an error, so I hit the back button and resubmitted.

  152. dose says:

    I recently wrote a little tool for scanning the Import address table for all Windows-processes in memory to compare it with the IAT of the binary file on disk in order to catch nasty userland API-hookers.

    When scanning explorer.exe in Windows 2000, I noticed, that the following functions which are imported from kernel32.dll point outside the location where the kernel32.dll is mapped to explorer.exe’s memory:

    – CreateProcessW

    – LoadLibraryW

    – GetProcAddress

    – FreeLibrary

    – LoadLibraryA

    When searching the Internet, I found out that I’m not the only person who discovered this

    interesting behaviour. The following sites also contain a note about it:

    http://www.phrack.org/show.php?p=62&a=12

    http://indian-hackers.net/print.php?sid=273&MDPROSID=19710ea969355ff0ca5e2b128945be0e

    Now I thought that you may know the reason, why those IAT-entries are replaced when loading and what explorer.exe does here. It would be really interesting to know. Maybe there is an intersting story behind this.

    Thanks in advance!

  153. I realized that in XP users can’t install themes. In fact, it seems that you need to have your themes signed to be able to use them – there’re some utilities that overwrite a dll to get rid of this "limitation" though

    I was somewhat surprised that there’s such limitation. But after thinking a while, a conspiration theory came to my mind: part of the windows graphics subsystem is inside the kernel, and the themes may be being run with system privileges? I suppose that Longhorn will get rid of this limitation? (I’ve heard that part of the graphcis subsystem is going to userspace again)

  154. How do you manipulate the taskbar’s position programmatically?

    There’s no ABM_SETTASKBARPOS message and the taskbar seems to ignore SetWindowPos() commands. Well, more accurately, it seems to obey them once after the shell is started and then ignore them subsequently.

  155. Hi Raymond,

    How does one prevent the background image of a listview control (set using ListView_SetBkImage()) to move when user scrolls the list.

    The image used by Windows Explorer correctly stays in the lower right corner. But my experience (including all the reports I’ve found) is that the image scrolls whan uer scrolls the list :-(

    Also, what is the purpose of the undocumented flag LVBKIF_TYPE_WATERMARK ?

    TIA,

  156. AnotherMatt says:

    Why don’t console programs under Win32 support SIGINT? That’s….lame. :-)

    “Note SIGINT is not supported for any Win32 application including Windows NT and Windows 95. When a CTRL+C interrupt occurs, Win32 operating systems generate a new thread to specifically handle that interrupt. This can cause a single-thread application such a UNIX [sic], to become multithreaded, resulting in unexpected behavior.” – MSDN under signal()

    I’ve run into this problem where I’m using CLisp, which is a console-based programming environment, and I hit Ctrl+C to stop the Lisp program, and it stops, but what I’m assuming is this “extra thread” will ask me “Terminate batch job [Y/N]?” (I usually run CLisp from a batch file) and if I hit ‘N’ it will start alternating between the CLisp prompt and the DOS prompt. Strange!

    I think the problem is with SIGINT, but I must admit I’m not totally positive.

    [Response. -Raymond]
  157. 8 says:

    I thought ^C sends a SIGABRT

  158. Carlos hm says:

    Hi Raymond,

    Did you know about it?

    http://blogs.msdn.com/carloshm/archive/2006/02/05/525246.aspx

    I didn’t find any article related to this bug?

  159. Fred Fenster says:

    Why when you sort icons ‘by name’ on the desktop My Documents appears above My Computer? I’m assuming ‘by name’ means alphabetical, but evidentally not.

    [Response. -Raymond]
  160. BryanK says:

    8: No, Ctrl-C sends SIGINT.  Unless you mess with your Unix terminal driver, anyway.

    SIGABRT is sent by the abort() syscall.

  161. Tim Lesher says:

    How about a little history on wsprintf()?

    Today a coworker asked me why wsprintf() wasn’t formatting his string correctly, even though he was using it for a wide (Unicode) string.  I told him that 1) the ‘w’ in wsprintf doesn’t mean “wide”, and 2) wsprintf has never supported the floating point values he was trying to format.

    I went into the historical reasons wsprintf exists in its current form (old C runtime limitations, memory models, and FPU support, as I recall), but I’m not sure I got all the details right. It would be nice to have another old-schooler back me up…

    [Response. -Raymond]
  162. Sean Bryant says:

    Alright, I’ve managed to do this but with great hackery. I have to custom draw the control myself manage the locations entirely by hand. Each control has to be handeld in its own proc or have a hook of some sort. I did handle this by wrapping the entire control into C++ class (static proc that gives itself up to an internal proc). And even still there are odd little drawing bugs. Lets say I embedd a bitmap button. Now the problem I encounter is when you click the button drawing for the rest of the control stops which is obviously a problem because you can click-hold drag the mouse of the treeview and you’ll have a nice white space. Now when you do let go everything is drawn but the button when you mose over shows its still pressed!

    With more hackery I could handle the not redrawing while being help with threads. Or If I’m really lazy I can handle this with a run once low resolution timer to draw the button in the background.  

    There has to be something a bit better than what I’m currently doing. And I’m sure Raymond can shed some light on embedding controls in other controls.

  163. Michael Silk says:

    [my goodness there is alot of suggestions here; this is mine to add to the pile :)]

    Why doesn’t programmatic access to Mapped Network Drives attempt a connection if the drive is "Disconnected"?

    I’ve found I have to manually double-click the drive and force it to connect before my programs (in this case Apache) will recognise that the drive is, in fact, valid and connected.

    I’d like to know why this is the case.

    Thank you.

  164. Why don’t console windows have the XP look ?

    [Dup. -Raymond]
  165. Joshua Blake says:

    My suggestion is from a simple thing a lot of us have probably seen but never given a second thought to:

    In Word, when you print a document it says in the status bar “Word is preparing to background print the document…”  The term “background print” seems to imply there are or used to be other types of printing like foreground, maybe harking back to the Win95 or *gasp* Win3.11 or DOS days.  I’d like to hear if you have any insight into the old days of printing, or whether this is just an odd status message.

    Thanks! Love the blog and your insights.

    [Response. -Raymond]
  166. Demeli says:

    Why does winlogon take down the entire system when you attach a debugger to it? (drwtsn32 -p <pid of winlogon>

    [Response. -Raymond]
  167. AnotherMatt says:

    Tim Lesher: He’s probably looking for swprintf(), where the "w" does mean "wide".

  168. Mr. Chen,

    Earlier today, some “classmates” (using the term very loosely here) got into a big debate (read: heated argument) about the new One Care antivirus system MS will soon be releasing.  All of my “classmates” criticized me horribly for MS releasing such technology at $50 a pop (I’m the only MS supporter in the group).  They all said things like, “MS should just fix their shit so viruses and crap can’t infiltrate the system to begin with instead of just once again finding a way to rape the customer’s wallet.”

    Is there any way I can talk you into making a post or two about this?  I’m certain there is a perfectly reasonable explanation for all this.  There has been for everything else so far.

    Regards,
    James

    [Response. -Raymond]
  169. dhiren says:

    Hi Raymond,

    Any idea why the address bar in Explorer randomly decides to reset itself while you’re typing in it?  I’ve noticed it seems to happen mostly when accessing remote machines, but sometimes when typing local paths as well.  e.g. I’m in my downloads directory, I copy a file, and then Alt+D to the address bar and start typing ‘ftp://user@servername/public_html‘ but before I get even half-way through, Explorer decides to reset the contents of the address bar back to ‘D:Downloads’, all highlighted, so the end result is something like ‘ame/public_html’.

    Is this something to do with the address bar’s auto-complete?

    [Response. -Raymond]
  170. Koro says:

    Hi,

    I am currently coding an application for which I’m doing an x86 (ANSI and Unicode) and x64 (Unicode only) build.

    At runtime, the installer (NSIS) detects the Windows version and copies the right build. However, when run on an x64 computer, since the installer is 32-bit, it detects the “C:Program Files (x86)” path as the %ProgramFiles% directory.

    But since on x64 it copies x64 executables, it would make sense to copy them in the x64 program files directory.

    I could just strip the ” (x86)” tag, but I’m pretty sure you would frown upon that. So my question is, what is the way of finding the x64 Program Files directory from a 32-bit application?

    [Response. -Raymond]
  171. Stewart Tootill says:

    I don’t know if you’re the right person to ask, but you’re the only person I can think of who might even know the answer, and even if you don’t, maybe you could pass it on to someone who does. If not ignore me.

    Anyway, here goes. I’m writing a socket library and using BindIoCompletionCallback to bind my sockets to the system worker pools IO completion port. When I get my completion callbacks, I’m getting NTSTATUS error codes instead of WIN32 codes, and yet if I do it the way I used to (using GetQueuedCompletionStatus) I get WIN32 error codes.

    The documentation doesn’t mention this, and I can’t seem to include ntstatus.h to get the defines.

    Does this mean a) I shouldn’t be doing it this way, or b) there is a bug in windows which I have to work around?

    Can I safely define my own constants for the NTSTATUS codes that I care about, or should I avoid this (I suppose that since they are not strictly documented (not in the PSDK anyway) that they could change from release to release but I think (hope:)) that this wouldn’t happen.

  172. Norman Diamond says:

    Suppose an application wants to receive each character press on a keyboard.  For example when F1 is pressed, case WM_KEYDOWN will recognize that F1 is pressed, and then if it cares about shift states it can go look at them.  Same for F2.  Same for F12.  Different for F10.

    OK, Microsoft has two Knowledge Base articles explaining why F10 is different, but they don’t say what to do about it.  I guess the answer is WM_SYSKEYDOWN.  And then I have to start handling a bunch of keys that really are system keys, that I didn’t want to bother with.

    Do you have any opinion on the correct way to handle it?  Also maybe the MSDN page on WM_KEYDOWN should say how an application can handle it?  The MSDN page mentions F10 as an exception down in the Remarks section, but the first line describes nonsystem keys with no exceptions which doesn’t entirely make it obvious.

    By the way a colleague was using an application that didn’t even have a menu bar when he found F10 behaving strangely, so we didn’t even have any visual feedback that F10 was intentionally intercepted by Windows.

    [Response. -Raymond]
  173. moby_steve says:

    How to do continuous drawing to a window (say for a game) during the idle time of a Move/Size modal loop.

    Thanks

  174. bav016 says:

    I do not understand how PostQuitMessage and some other functions (like SetTimer with hWnd == NULL) “know” about the thread that their messages intended for. InvalidateRect, for example, accepts hWnd as a parameter so WM_PAINT will be posted to the thread that associated with this hWnd. But PostQuitMessage does not accept hWnd or some other parameter that can tell what thread must accept WM_QUIT.

    [Response. -Raymond]
  175. Dominic Self says:

    Why is screen resolution a global setting in Windows XP rather than being able to be set per user?

    [Response. -Raymond]
  176. David Walker says:

    I would be interested in your comments on the following:

    http://blogs.msdn.com/ie/archive/2006/02/16/533586.aspx#534741

    Some discussion of cleartype in IE7, and then someone claims that MSDN claims that MS uses a horrible not-thread-safe way of implementing per-application cleartype.

    Quoting from the IE7 blog comments:

    Saturday, February 18, 2006 10:02 AM by Xepol

    Ed -> Regardless of your system settings, IE 7 uses cleartype.  To turn it off, you must go to your internet options, go to the advanced tab, scroll down to multimedia and uncheck cleartype.   Then close all instances of IE and it should be gone.

    Then you can join the rest of us pestering MS to honour the system-wide cleartype setting instead of adding their own app specific setting, rendering the system-wide setting a bad joke (esp. if the trend expands and more apps follow suit).

    Sadly, according to the MSDN site, the mechanism to turn on cleartype for just 1 application is not multi-threading friendly as it actually sets the system wide flag while it renders and then sets it back to whatever it was pre-rendering.  This means that a context switch while rendering could cause artifacting in other applications.  Cleartype settings per applicaiton aren’t just a bad idea, but can cause undesirable, random artifacting (even if the chances are very low that it could happen, it CAN happen).

    [Response. -Raymond]
  177. I have a GUI thread and a worker thread producing items very fast and PostMessage()-ing them back to the GUI to be inserted into a tree. Now as the producer is faster as the consumer, the worker hits from time to time ERROR_NOT_ENOUGH_QUOTA errors on PostMessage(). What is the best way to cope with this?

    [Response. -Raymond]
  178. Mihai says:

    Not long ago someone asked in a newsgroup: “Is there a way, programmatically, to set the taskbar to auto-hide and to show the quick launch toolbar?”

    Now, the hiding part was easy (SHAppBarMessage with ABM_SETSTATE).
    The “Quick Launch” part does not seam that easy.
    I managed to get a IShellFolderBand
    (with CLSID_QuickLinks and IID_IShellFolderBand), but I am not sure what to do with it or if this is the right thing to begin with.

    Thanks,
    Mihai

    [Response. -Raymond]
  179. c_e_pizano says:

    What is the purpose of they HKLMSoftwareMicrosoftWindowsCurrentVersionApp Paths<some exe>RunAsCommand ??

    Thanks,

    CPU

    [Response. -Raymond]
  180. Hayden says:

    Anyone who has taken a train in the Mumbai area recently may well recognise the intro tone for platform announcements. It’s the “eee-doo” noise from Outlook. Now – did the Indian railways steal  it from Microsoft, or was the Outlook engineer responsible for this bit Indian?

    [Response. -Raymond]
  181. Francisco Moraes says:

    Hi,

    Is there any API way of retrieving the command line of other processes? It seems that the only possible way of doing this is by retrieving the PEB from the desired process and calling ReadMemory to get the _RTL_USER_PROCESS_PARAMETERS. It seems like WMI could get you the data, but it doesn’t retrieve the command line for some processes.

    This solution works well as long you are not mixing 32-bit and 64-bit applications, where it fails miserably.

    Is there a real solution to this that would work no matter if the application is 32-bit and the target process is 64-bit or vice-versa?

    Francisco

    [Response. -Raymond]
  182. Hayden says:

    To Thomas Ziegler:

    Easy. Rather than having the producer madly sending items one at a time – there are various ways round this.
    1) Producer sends lists of things. Consumer sends  “Im done” messages back. Producer sends a single message with a list of all the outsanding items.
    2) Make it work like async sockets. Producer sends a single message to say “stuff to do”. Consumer calls read function to gets items. Producer sends another “stuff to do” when the consumer has read all of the items that were notifed last time.
    3) Use a semaphore. Add one in the producer when the producer has a pending list of items. producer sets count to 0 when there is nothing. The consumer should loop reading items until the semaphore becomes 0.

    [See also. -Raymond]
  183. Ulric says:

    Appologies but I can’t resist sending this to Raymond.  Prehaps the link is doing the rounds at MS?  
    This is a parody video that asks “What if Microsoft had designed the iPod packaging?”

    http://video.google.com/videoplay?docid=4313772690011721857&q=ipod+microsoft

    [Response. -Raymond]
  184. Phil Quirk says:

    Why does MoveWindow() not send WM_GEMINMAXINFO?

    [Response. -Raymond]
  185. Phil Quirk says:

    I meant WM_GETMINMAXINFO.

    Also, why is there a repaint parameter for MoveWindow()?  Shouldn’t the OS be able to figure out if the window needs to be repainted?

    You know, MoveWindow() is just a weird function. I guess it’s easier to call than SetWindowPos(), but that’s the only thing it seems to have going for it.

    [Response. -Raymond]
  186. Martin Filteau says:

    Could you explain the implementation of WM_PRINTCLIENT ?

    It seems that even MS got it wrong in the LISTBOX control.

    Try to AnimateWindow a window that as a LISTBOX control as a child.  The LISTBOX displays correctly if it is NOT empty.  However, if it is empty…  nothing is drawn.

    I got a similar problem when embedding an Internet Explorer control.

    Thanks.

    -mf

    [Response. -Raymond]
  187. Frans Bouma says:

    Why is the text of a treenode chopped off when you switch the font from normal to bold?
    http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_frm/thread/79297a46ef22f520/a51c76da39b1437a?lnk=st&q=TreeNode+font+bold+chopped+off&rnum=2#a51c76da39b1437a

    It apparently is for backwards compatibility but I fail to see why this is necessary for backward compatibility…

    (the reason I ask this is because .NET (not what you want to cover, but it’s related) winforms uses the win32 controls underneath and  therefore run into this issue.

    [Response. -Raymond]
  188. Serge says:

    How it was accepted by QA that Windows Installer writes “Time remaining: 0 seconds” and crunches hdd for additional ten minutes?

    [Response. -Raymond]
  189. tuniverse says:

    Aloha Raymond —

    Can you discuss why WM_NCPAINT doesn’t always get called when a window changes its activation state and the NC area is repainted (so says Spy++)?

  190. tzagotta says:

    Hi Raymond,

    Here’s a question that seems to come up a lot, and generates a lot of controversy: If I have a lot of RAM, can I disable then WinXP pagefile (virtual memory) to improve performance?

    Thanks!

  191. Nekto2 says:

    Why there is no mouse action “both buttons click” or “move mouse with both buttons pressed” ? :) Only one button at a time is used for UI. Only Opera used combination of “LeftMB then RightMB =  go forward, RightMB then LeftMB = go Back”

    Is there some reason or just none try to? :)

    [Response. -Raymond]
  192. BryanK says:

    Why, when I destroy the window with the focus when I get a WM_ACTIVATEAPP (with fActivate set to 0, so it’s a deactivate message), do I not get any WM_ACTIVATEAPP message at all when my program gets reactivated?  (According to Spy++, anyway.)

    If I subsequently switch away from the program, I do get a deactivate message, and at as long as I don’t destroy a window, I get all subsequent activate messages.

    Is it illegal (or undefined) to destroy a window inside the WM_ACTIVATEAPP handler (like the “don’t set focus inside WM_KILLFOCUS” thing)?  Is there something else going on here inside the window manager?

    Thanks for any insight!

    [Response. -Raymond]
  193. Eric Fischer says:

    In your article "Why is the line terminator CR+LF?" (http://blogs.msdn.com/oldnewthing/archive/2004/03/18/91899.aspx) you say that "the implicit CR before LF is a unix invention, probably as an economy, since it saves one byte per line."  The full history is much more complicated.  I would comment there but comments are closed so I will post here instead.

    Early in the development of ASCII the demand for control characters came almost entirely from the telegraph industry.  American computer industry representatives intended to continue to store text in fixed-size records of 6-bit bytes, padded at the end with spaces.  European computer industry representatives did see a demand for a few control characters and intended to replace the first several printing characters (!, ", #, $, %, &, ‘) in their 6-bit set with the block of core control characters (HT, LF, VT, FF, CR, SO, SI) from the 7-bit set.  The Europeans would have preferred a single NL character to the CR+LF pair, but the telegraph interests insisted on the separation.  The compromise was to include CR and LF separately but with a footnote that LF could be used standalone as NL if sender and recipient agreed.  LF was chosen for this role instead of CR because if the sender doesn’t know about NL but the recipient does, CR+(CR+LF) has the same net effect as CR+LF but (CR+LF)+LF skips an extra line.

    However, publication of the ISO standard was delayed for several years while additional issues (lower case, most significantly) were hammered out.  The American standard was published right away, and did not mention the NL compromise because neither American computer interests nor American communications interests cared about it.  So when American computers, contrary to expectations, did begin to use control characters, there was no reference for how they were intended to be used in computers and the makers had to guess.  DEC in particular adopted bare CR as line terminator.  Multics developers, on the other hand, had an insider’s view into the standardization process and knew that the ISO standard and the 1968 US standard would permit bare LF as NL, so that was what they adopted.  Multics conventions were carried forward into Unix and from Unix into C.

    You mention a 1996 revision of ASCII that allows the NL interpretation.  I think you are actually thinking of the 1986 revision, which deprecated the interpretation.  The published US standards are 1963 (CR+LF only), 1967 (CR+LF only), 1968 (CR+LF or LF by convention), 1977 (CR+LF or LF by convention), 1986 (CR+LF, LF deprecated).

  194. Kevin Dente says:

    Is it possible to put a folder on the Start Menu Pin list and have it cascade?

    [Response. -Raymond]
  195. I have a request:

    In Windows XP, MS added a “system tray” icon for new hardware detection.  What is the purpose of this icon?

    Furthermore, why doesn’t this icon work like a “normal” system try icon?
    – It doesn’t have any tooltips.
    – Clicking on it doesn’t do anything.

    [Response. -Raymond]
  196. Aggravated says:

    Situation:
    A developer uses his laptop’s screen in conjunction with another monitor through a docking station.
    When the developer then goes to use the laptop by itself, applications he closed on the second monitor are now orphaned and cannot be used until he re-docks the computer and moves the window back to the primary monitor.

    Can’t this be fixed?

    [Response. -Raymond]
  197. Skeets Norquist says:

    When subclassing a window how do you determine if the original wndproc handled the message?  CallWindowProc() always seems to return an LRESULT of 0.

    [Response. -Raymond]
  198. Can you do an post on why you cannot programatically change the text centering style of an edit control from say ES_LEFT to ES_RIGHT (or ES_CENTER, etc.) after the edit control has been created?

    [Response. -Raymond]
  199. Fredrik Hesse says:

    Ok, here’s a little peculiarity that would be interesting to hear the rationalization behind.
    When I log on to the domain (on my Windows XP) I get prompted to change password because my current one will expire in a couple of days, so I change the password.
    Later I lock my computer, when I return I can still use my old password to unlock the computer (as many times as I want) UNTIL I once use my new password to unlock the computer, after that I can no longer use my old one to unlock it.
    I guess this is due to the password cache:ing, but why isn’t the cache updated when I change my password??

    [Response. -Raymond]
  200. Hayden says:

    Under good ol’ Win3.1, File Manager could be set to ask for confirmation on file move/copy/delete. With Windows Explorer, I have several times ( more than 0 times, and that’s enough) suffered a "finger spasm" as I move the mouse over a file tree, and relocated a chunk of drive contents elsewhere. Really bad stuff happens if its Program Files…..

    Why wasn’t the ability to request confirmation added to Explorer?

  201. Ritchie says:

    I’ve got a question about CreateProcess(). In the MSDN documentation (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp) , it states that the parameter lpCommandLine should not be const, as the Unicode version CreateProcessW can modify the contents of the buffer. Furthermore, it says that attempting to call CreateProcess() when lpCommandLine is const might cause an access violation on Windows 2000, XP and 2003 Server. I was wondering if there was a particular design or backwards compatibility decision made at some point that introduced this behaviour? It seems a bit strange that only the Unicode version of the function is affected. It’s not causing me any problems, I’m just curious to how this came about.

    [Response. -Raymond]
  202. Trey says:

    In general if you have a function and you

    would like to have that function execute

    only on a specific frequency what is the best

    way under Windows to do this?

    One example is that I have an Update() function

    that communicats with a peripherial device

    through USB. The device does not need to have

    Update called more frequently than 100ms.

    Since I writing the library other programmers

    are going to use I have no control on how

    frequently they will call Update. It seems to

    me the easist thing is for me to throttle

    the frequency of how often Update in the

    library and that way I can enforce how

    frequently Update actually executes, and

    the programmers that use the library don’t have

    to worry about calling the function too often.

    It is a forgone conclusion that infrequent

    calls are not a problem.

    To me there seems to be 3 ways one might

    accomplish this.

    1. Wrap Update with timeGetTime calls and see

      how much time has passed. If deltaTime >100

      then you execute the code in Update.

    2. Calculate the frequency of the processor

      and use RDTSC to get the time delta. I would

      think this might be faster than using

      timeGetTime, but getting the freq of the

      processor can be difficult with current

      power saving modes that can alter the

      freq of the processor.

    3. You could just Sleep(100) and that way you

      are guarnteed that you will always be called

      with the right freq, but this is just wrong.

      I think you should always return as quickly

      as possible from a function call.

    I am open to all ideas, critisims, etc.

    Thanks,

    Trey

  203. RuleZ023 says:

    My life’s been pretty dull recently. Shrug. My mind is like a void. I haven’t gotten anything done lately. I can’t be bothered with anything recently.

    [Response. -Raymond]
  204. RuleZ023 says:

    Not much on my mind right now, but it’s not important. I’ve just been letting everything happen without me. I just don’t have anything to say right now.

    [Response. -Raymond]
  205. ::Wendy:: says:

    For example “Security Center” rather than “Security Centre”.  Surely a larger proportion of potential Windows customers use the spellings established prior to the US language was formalised?  My UK friends and family persistently complain about US linguistic imperialism through hollywood films (slang,  phraseology) and software most notably microsoft products.  I’m guessing its just CHEAPER to employ local (no Visa required) US writers and then not bother to ‘translate’ into one or multiple other versions of English.

    [Response. -Raymond]
  206. RuleZ023 says:

    I haven’t been up to much today. I’ve just been letting everything happen without me. Basically nothing seems worth bothering with. I’ve just been hanging out doing nothing. I just don’t have anything to say right now. More or less nothing happening.

    [Response. -Raymond]
  207. Jen Kilmer says:

    Have you talked about using mimicing Eliza to "help" others debug issues?

  208. RuleZ023 says:

    Not much on my mind lately. My life’s been completely boring these days. I’ve just been hanging out not getting anything done. So it goes.

    [Response. -Raymond]
  209. Oscar says:

    Raymond,

    Do you have any idea why an application hosting iwebbrowser2 does not necessarily use the JVM specified in IEs options?

    For instance, on a system that has the MS-JVM installed, if you look at:

    http://www.javatester.org/version.html

    with IE it says its using Sun’s JVM

    However, if you look at it with an iwebbrowser2 hosted app, it reverts to the
    older MS-JVM – even tho the options have Sun’s VM checked.

    If the MS-JVM is not installed, both browsers report they are using the Sun JVM. Even more freakish, if you rename the iwebbrowser2 hosted app IExplore.exe it works correctly.

    Pretty odd eh?

    Thanks!

    [Response. -Raymond]
  210. RuleZ023 says:

    I haven’t been up to much lately. I’ve basically been doing nothing , but it’s not important. I can’t be bothered with anything recently. I’ve just been letting everything happen without me lately.

    [Response. -Raymond]
  211. Bruno says:

    Being a command prompt enthusiast (I like to type more than I like using the mouse) I keep wondering why the DOS Command Prompt is so ugly and limited. Even in Vista it’s still ugly.

    Why doesn’t the Command Prompt allow you to at least change the font to something other than Lucida Console and Raster Fonts?

    Thanks,
    Bruno.

    [Response. -Raymond]
  212. RuleZ023 says:

    I haven’t been up to anything recently, but so it goes. Such is life. What can I say? Pretty much not much exciting going on to speak of. I haven’t gotten much done lately, but I don’t care.

    [Response. -Raymond]
  213. RuleZ023 says:

    I haven’t gotten anything done recently. I’ve just been hanging out doing nothing. I haven’t been up to anything these days, but it’s not important. Today was a total loss.

    [Response. -Raymond]
  214. RuleZ023 says:

    I haven’t been up to much today. I’ve just been letting everything happen without me. Basically nothing seems worth bothering with. I’ve just been hanging out doing nothing. I just don’t have anything to say right now. More or less nothing happening.

    [Response. -Raymond]
  215. RuleZ023 says:

    I can’t be bothered with anything these days, but shrug. I just don’t have anything to say recently. I haven’t gotten much done recently. Nothing seems worth thinking about.

    [Response. -Raymond]
  216. RuleZ023 says:

    I just don’t have much to say recently. Such is life. I’ve basically been doing nothing. Basically nothing seems worth bothering with. Oh well.

    [Response. -Raymond]
  217. RuleZ023 says:

    I’ve just been staying at home not getting anything done. I’ve basically been doing nothing worth mentioning. My life’s been pretty unremarkable these days. Eh.

    [Response. -Raymond]
  218. RuleZ023 says:

    Not much on my mind lately. My life’s been completely boring these days. I’ve just been hanging out not getting anything done. So it goes.

    [Response. -Raymond]
  219. RuleZ023 says:

    I just don’t have much to say recently. Such is life. I’ve basically been doing nothing. Basically nothing seems worth bothering with. Oh well.

    [Response. -Raymond]
  220. RuleZ023 says:

    Basically nothing noteworthy happening right now, but eh. Today was a complete loss. I haven’t been up to much recently. I’ve pretty much been doing nothing worth mentioning.

    [Response. -Raymond]
  221. Nawak says:

    [Test] Just trying to post here since I couldn’t post in the MI3 post

  222. RuleZ023 says:

    I haven’t been up to anything today. I can’t be bothered with anything recently. Nothing seems worth thinking about. I haven’t gotten anything done recently, but oh well. Not much noteworthy going on worth mentioning.

    [Response. -Raymond]
  223. Michael Buschbeck says:

    I’ve set my Recycle Bin to use 5% of my harddisk capacity, which translates to something about 3 GB of data.  I rarely empty the Bin (it gives me a sense of security that I can simply delete anything and give that decision the test of time before the deleted file expires eventually), and so it currently contains about 2,300 files and folders.

    However, the first time I move something to the Bin (even just the tiniest Start menu item some reckless installer has sullied my Start menu with) or open the Bin, it takes ages to complete the deletion or open the Explorer window with the Bin’s contents, all the while my poor notebook’s harddisk thrashes around like crazy.

    Joel Spolksy suspects that there’s a "Shlemiel the painter’s algorithm" hidden somewhere in the Recycle Bin’s code [1]. Can you shed some light on why the Bin is behaving that way?

    Thanks,

    Michael

    [1] http://www.joelonsoftware.com/articles/fog0000000319.html

  224. RuleZ023 says:

    Pretty much nothing seems worth thinking about. My life’s been completely dull , not that it matters. I’ve just been staying at home waiting for something to happen.

    [Response. -Raymond]
  225. RuleZ023 says:

    I just don’t have much to say recently. Such is life. I’ve basically been doing nothing. Basically nothing seems worth bothering with. Oh well.

    [Response. -Raymond]
  226. Why is it some file APIs (like SetFileTime) take a handle to an open file whereas other APIs (like SetFileAttributes) take a path to the file.  I would expect the APIs to be consistent.  Ideally I would like two set of APIs, one for handles and one for paths, put maximum flexibility into the hands of the programmer.

    P.S.  Awesome blog!  Keep up the great work.

    [Response. -Raymond]
  227. RuleZ023 says:

    My life’s been pretty dull recently. Shrug. My mind is like a void. I haven’t gotten anything done lately. I can’t be bothered with anything recently.

    [Response. -Raymond]
  228. RuleZ023 says:

    I just don’t have anything to say , but shrug. So it goes. Not much on my mind recently. I can’t be bothered with anything recently.

    [Response. -Raymond]
  229. Daniel says:

    Why does a flashing taskbar button cause fullscreen DOS apps (and fullscreen cmd.exe) to lose focus?  This is very annoying when using full-screen grahpical DOS software.  Is there any way to turn it off (or any reasoning for making it work this way)?

    Code to reproduce:

    Add the following code to WM_KEYDOWN or similar of a Win32 GUI app:

    Sleep(1000);
    FlashWindow(hWnd, TRUE);
    Sleep(500);
    FlashWindow(hWnd, FALSE);

    Run cmd.exe, run the Windows app and activate the FlashWindow sequence, and hit Alt-Enter on the cmd window to enter full-screen mode.  As soon as the first Sleep expires, the GUI app’s taskbar button will be highlighted and the cmd window will be sent back to non-fullscreen mode.  This is not so bad for text-mode DOS apps, but graphical apps get minimized.

    This brings me to a separate, tangential question.  What happened to the support for running DOS apps in windowed mode from Windows 95?  It seems like this could be done with a VDD (or inside the VDM) by hooking the standard VGA framebuffer areas and the VGA registers.  It certainly wouldn’t be trivial, but apparently it was done in Win95…  Perhaps this has to do with the differences in the architectures of Win9x and NT?

    If I remember correctly, running in windowed mode only worked with programs that used standard modes (set through int 0x10) and didn’t do sneaky things with the VGA registers.  It was pretty slow, but my memories of Windows 95 involve a 486, so perhaps things would be better on today’s hardware.  Plus, it was a great way to get screenshots without some shady TSR. :)

    [Response. -Raymond]
  230. RuleZ023 says:

    Basically nothing noteworthy happening right now, but eh. Today was a complete loss. I haven’t been up to much recently. I’ve pretty much been doing nothing worth mentioning.

    [Response. -Raymond]
  231. WendyHome says:

    use exactly 30 words,  no syllable requirement.

    No more than 4 full stops (periods), 4 comma’s, and two pairs of brackets.

    If i give this description to a 12 year old that has never seen a raw carrot,  they should not respond by

    a) crying

    b) swearing and becoming abusive

    d) any variation of ‘huh what?’

    just a suggestion.

  232. Larry Hosken says:

    As near as I can tell, a bunch of students in Sweden run a big puzzle hunt, and it’s called Rebusrally.  They solve puzzles and zip around in vans.  I say "As near as I can tell" because, unlike some people, I can’t understand Swedish. Who can bridge the gap of understanding here?  Who can deliver a report on the activities of these exotic forign puzzlers based upon a loose translation of some of their web pages?  Raymond, America’s Puzzle Huntists look to you.

  233. RuleZ023 says:

    My life’s been basically bland today. More or less nothing seems worth thinking about. My mind is like an empty room. I’ve more or less been doing nothing to speak of. Not much on my mind recently.

    [Response. -Raymond]
  234. RuleZ023 says:

    I haven’t been up to much these days. Today was a loss. Nothing seems important. I’ve just been letting everything happen without me these days.

    [Response. -Raymond]
  235. RuleZ023 says:

    My mind is like a bunch of nothing, but I guess it doesn’t bother me. I haven’t been up to anything recently. I’ve pretty much been doing nothing to speak of.

    [Response. -Raymond]
  236. RuleZ023 says:

    I haven’t been up to anything recently, but so it goes. Such is life. What can I say? Pretty much not much exciting going on to speak of. I haven’t gotten much done lately, but I don’t care.

    [Response. -Raymond]
  237. RuleZ023 says:

    I’ve just been staying at home waiting for something to happen. Whatever. Not much on my mind lately. I guess it doesn’t bother me.

    [Response. -Raymond]
  238. {?I’m trying to figure out how to reserve the virtual address space below 4GB that isn’t already allocated (the loaded exe, loaded dlls, and allocations already in place are fine where they are, but I’m sure I could re-base them).

    I can (and already have) used VirtualAlloc in combination with HeapAlloc (to take up the pre-reserved heap) to block off everything up to 4GB in virtual address space, but it seems like there should be a cleaner way to do this.

    If you want the code to do what I’ve already done, just email me.

    Thanks for the great resource,
    Matt

    [Response. -Raymond]
  239. RuleZ023 says:

    I haven’t been up to anything these days. So it goes. I can’t be bothered with anything these days.

    [Response. -Raymond]
  240. RuleZ023 says:

    I haven’t gotten anything done today. I feel like a fog, but what can I say? I’ve just been letting everything wash over me lately, not that it matters. Shrug.

    [Response. -Raymond]
  241. RuleZ023 says:

    My life’s been basically bland today. More or less nothing seems worth thinking about. My mind is like an empty room. I’ve more or less been doing nothing to speak of. Not much on my mind recently.

    [Response. -Raymond]
  242. RuleZ023 says:

    Not much on my mind these days, but what can I say? It’s not important. I just don’t have much to say lately. I’ve just been letting everything pass me by recently, but eh.

    [Response. -Raymond]
  243. Herb says:

    A newly installed piece of s/w comes with a FAQ, an item of which reads (names changed to protenct myself):

    Question 5: Will AmazingWare’s performance be enhanced when running on a 64-bit operating system like Windows XP x64 Edition?

    Answer: Yes. While AmazingWare is a 32-bit application, it will use all of your system’s available physical memory (above the 32-bit Windows limit of 4GB) for storing model data when running under 64-bit operating systems. This can enhance AmazingWare’s performance particularly when working on large models if you have more than 4G of physical memory on your 64-bit workstation.

    —–

    How’s this possible?

    [Response. -Raymond]
  244. RuleZ023 says:

    Basically nothing seems worth thinking about. I haven’t been up to much these days. I just don’t have much to say right now. I can’t be bothered with anything , but whatever.

    [Response. -Raymond]
  245. RuleZ023 says:

    I feel like a complete blank, but I don’t care. Pfft. I’ve pretty much been doing nothing worth mentioning.

    [Response. -Raymond]
  246. RuleZ023 says:

    I just don’t have anything to say , but shrug. So it goes. Not much on my mind recently. I can’t be bothered with anything recently.

    [Response. -Raymond]
  247. nolan says:

    Perhaps this is slightly outside your usual domain, but back in the win95 days, there was a winsock bug that caused a blue-screen whenever you attempted to resolve a FQDN that was exactly 13 characters (including periods) that didn’t exist.  Any other length worked fine, and if the host existed in the DNS it worked fine as well.

    So for the past 10 years or so, I’ve been wondering exactly how one could write code with that bug.  Please elighten us!  Any bug that weird has to have a great story behind it.

    See:
    http://attrition.org/security/denial/w/winsk20.dos.html
    for the advisory.

    [Response. -Raymond]
  248. RuleZ023 says:

    I just don’t have much to say recently. Such is life. I’ve basically been doing nothing. Basically nothing seems worth bothering with. Oh well.

    [Response. -Raymond]
  249. RuleZ023 says:

    Not much on my mind these days, but what can I say? It’s not important. I just don’t have much to say lately. I’ve just been letting everything pass me by recently, but eh.

    [Response. -Raymond]
  250. RuleZ023 says:

    My life’s been pretty dull recently. Shrug. My mind is like a void. I haven’t gotten anything done lately. I can’t be bothered with anything recently.

    [Response. -Raymond]
  251. RuleZ023 says:

    I feel like a complete blank, but I don’t care. Pfft. I’ve pretty much been doing nothing worth mentioning.

    [Response. -Raymond]
  252. RuleZ023 says:

    I can’t be bothered with anything these days, but such is life. I don’t care. So it goes. More or less nothing seems worth thinking about. I’ve just been hanging out waiting for something to happen, but that’s how it is.

    [Response. -Raymond]
  253. steven says:

    I’m a regular reader of The Old New Thing. I wonder is there any reason why in most cases does Windows have to be restarted after software installation while Linux doesn’t have to? May you blog something about this?

    [Response. -Raymond]
  254. RuleZ023 says:

    I haven’t been up to anything these days. So it goes. I can’t be bothered with anything these days.

    [Response. -Raymond]
  255. RuleZ023 says:

    I haven’t gotten anything done today. I feel like a fog, but what can I say? I’ve just been letting everything wash over me lately, not that it matters. Shrug.

    [Response. -Raymond]
  256. RuleZ023 says:

    I just don’t have much to say these days, but so it goes. Today was a total loss. I guess it doesn’t bother me.

    [Response. -Raymond]
  257. RuleZ023 says:

    I can’t be bothered with anything these days, but such is life. I don’t care. So it goes. More or less nothing seems worth thinking about. I’ve just been hanging out waiting for something to happen, but that’s how it is.

    [Response. -Raymond]
  258. RuleZ023 says:

    Not much on my mind. I don’t care. I’ve just been letting everything happen without me , but shrug. Whatever. I feel like a void.

    [Response. -Raymond]
  259. RuleZ023 says:

    I haven’t gotten anything done today. I feel like a fog, but what can I say? I’ve just been letting everything wash over me lately, not that it matters. Shrug.

    [Response. -Raymond]
  260. RuleZ023 says:

    I can’t be bothered with anything these days, but shrug. I just don’t have anything to say recently. I haven’t gotten much done recently. Nothing seems worth thinking about.

    [Response. -Raymond]
  261. Ulric says:

    I learned windows back in the 16-bit days.  
    When switching to Win32, as everyone knows MoveTo was gone and replaced with MoveToEx.  Everyone had to either change code or use a macro.

    Delete a function from the API? How could this happen?  Did someone want to force me to save the previous pen position? Was a code review skipped :D

    I tried to google an answer for this, but it’s hard to find anythign — and of course it’s water under the bridges now.  But it stills bugs me.

    [Response. -Raymond]
  262. RuleZ023 says:

    I can’t be bothered with anything these days, but such is life. I don’t care. So it goes. More or less nothing seems worth thinking about. I’ve just been hanging out waiting for something to happen, but that’s how it is.

    [Response. -Raymond]
  263. RuleZ023 says:

    I’ve just been hanging out not getting anything done. What can I say? I’ve basically been doing nothing worth mentioning, but pfft. Not that it matters. Pretty much nothing exciting happening to speak of. I haven’t been up to much these days.

    [Response. -Raymond]
  264. RuleZ023 says:

    I haven’t been up to anything today. I don’t care. I’ve just been staying at home not getting anything done. Basically not much happening right now. Maybe tomorrow. I guess it doesn’t bother me.

    [Response. -Raymond]
  265. ulric says:

    My appologies, I posted this before here, but I don’t see it – perhaps I pressed the wrong button.

    I would like to know if there was an interesting story behind 16-bit GDI’s MoveTo being dropped for MoveToEx in Win32.  It’s very rare that any API is being dropped like this!  Plus, a function that would be in most non-MFC Win16 apps.

    Could it be because it conflicted with another library?  Source code that’s 10 years old is littered with #define of MoveTo to MoveToEx

    p.s. : the CR/NL post above is really interesting!

  266. RuleZ023 says:

    I’ve just been staying at home not getting anything done. I guess it doesn’t bother me. Shrug. I haven’t been up to anything. I haven’t gotten much done today.

    [Response. -Raymond]
  267. Pavel Vozenilek says:

    Perhaps you may write something about popularity of this blog. When I googled for it now (using “Raymond Chen” keyword) the only text add shown was “Job at Google” directly from Google Inc ;) This is kind a black belt level for a blogger, isn’t it?

    [Topic accepted. -Raymond]
  268. RuleZ023 says:

    My life’s been pretty dull recently. Shrug. My mind is like a void. I haven’t gotten anything done lately. I can’t be bothered with anything recently.

    [Response. -Raymond]
  269. Patrick says:

    Can you write something about how seemingly random strings break notepad?  It seems like it is confusing notepad and making it guess the wrong encoding?

    See:

    http://digg.com/software/_this_app_can_break_Are_there_any_other_forbidden_strings_in_Notepad_

    [Response. -Raymond]
  270. RuleZ023 says:

    I’ve just been staying at home waiting for something to happen. Whatever. Not much on my mind lately. I guess it doesn’t bother me.

    [Response. -Raymond]
  271. Francois Boucher says:

    Sleep() + flag vs WaitForSingle(Event)

    Which scenario is better?  The first one uses only 1 handle for the thread.  The second one will use 2.  But is the first scenario wasting more thread time?  Is it worth using the event (kernel object)?

    The event and the flag signal tell the thread to exit.

    while( fKeepGoing )
    {
     //Check something
     Sleep(50);
    }

    or

    do
    {
     //Check the same thing
    }
    while( WaitForSingle(hEvent, 50) == WAIT_TIMEOUT );

    [Response. -Raymond]
  272. Francois Boucher says:

    When in a thread, is it better to check an exit boolean flag and Sleep(N) or loop and wait on an alertable event handle every N ms?

    Is it worth using the extra kernel object?

    Thanks

  273. RuleZ023 says:

    I’ve just been staying at home waiting for something to happen, but I don’t care. Basically nothing seems worth thinking about. I can’t be bothered with anything recently.

    [Response. -Raymond]
  274. RuleZ023 says:

    Not much on my mind. I don’t care. I’ve just been letting everything happen without me , but shrug. Whatever. I feel like a void.

    [Response. -Raymond]
  275. RuleZ023 says:

    Not much on my mind right now, but it’s not important. I’ve just been letting everything happen without me. I just don’t have anything to say right now.

    [Response. -Raymond]
  276. RuleZ023 says:

    I just don’t have much to say recently. Such is life. I’ve basically been doing nothing. Basically nothing seems worth bothering with. Oh well.

    [Response. -Raymond]
  277. Tim Lesher says:

    These might be outside your realm, but:

    1. Before DirectShow, there was Video for Windows… but before that, was Clockwork (which looked a lot like what became ActiveMovie). Any comments on the history of these technologies, and how Clockwork->Quartz->ActiveMovie->DirectShow happened?

    2. The little-known DrawDib API was the answer to many programmers’ image-drawing needs (after Windows 95 came out, with VfW built-in). Why didn’t it ever seem to get any respect from within Microsoft?

  278. ::wendy:: says:

    without messing-up the display of the whole post (xref today’s article on the usability of conference name tags)

    [Response. -Raymond]
  279. asmguru62 says:

    I have come across the issue:

    1. Main window created (WS_OVERLAPPEDWINDOW)

    2. Child control created: multiline edit control

    3. When parent is resized – edit control also resized to take some room on the main (parent) window

    4. EM_SETRECT used on a child to provide some margings for a text typed in the control

    5. The next MoveWindow() in WM_SIZE message resets the margins back to default values

    Just wondering, if it is a real issue or it was designed to work that way. I am used to the thought, that if some property applied to HWND – this HWND should retain the property until HWND will be destroyed. Seems logical, but not the case here.

    P.S. I have a small test application which shows this

    [Response. -Raymond]
  280. stat says:

    Why does the stat function in MS C library return times dependant on the “Automatically adjust clock for daylight saving changes” setting? This introduces some problems when porting software fron *nix (and also explains why CVS updates take longer after the winter/summer time transition).

    [Response. -Raymond]
  281. KiwiBlue says:

    Is there a documented way to retrieve the usable rectangle inside balloon (TTS_BALLOON) tooltips? NMCUSTOMDRAW::rc contains coordinates which fail outside the balloon region.

  282. Mr. Chen,

    I was wondering if I might request that we see more posts about Microsoft history and why things are the way they are in Windows.  For example, I totally loved your article in TechNet Magazine about Fat32.

    James

  283. Will Rayer says:

    Hello – I have an article suggestion, which is the degree to which ‘plain vanilla’ C Windows API code works under Vista with the native look and feel.

  284. sarathc says:

    Hi Raymond,

    I’m real enthusiastic of your blog.

    Let me introduce myself. My name is Sarath, I’m working as Software
    Engineer in India.

    My Skill sets are MFC and C++ (Application, GUI). I’d like to build my
    career in that area and also I’d like to be part of Microsoft. For that
    my knowledge is not enough. In which way I should go? Managed C++ can be
    a future for me? Please suggest some books or website(of course your
    blog is one of the key resource). How could I improve myself? It would
    be helpful for me, if you give me some tips.

    [Response. -Raymond]
  285. David says:

    Why is there an apparent lack of development for new controls that use the same programming methods as the basic edit control or listbox control?  It seems that there must have been a decision to only develop COM controls after the invention of COM.

    Many COM controls could have been implemented as Win32 controls.  I have personally developed grid controls, and image display controls that are compatible with Win32, so I know it’s possible to do, but why hasn’t Microsoft developed these and made them standard controls with the operating system?

  286. Adrian McCarthy says:

    Can you to create an information context for the display?  For a printer, I can use CreateIC(), using paramters from the device manager.  For the

    display I can call CreateDC() with "DISPLAY", but the documentation suggests that won’t work with CreateIC().  Perhaps that wouldn’t generalize for a multi-monitor display with different settings on each screen.

    I’m trying to avoid constantly creating and destroying DCs when all I need to do is measure strings, check color depth, dpi, etc.  

  287. sarathc says:

    Hi Raymond,

    how we could implement a custom scrollbar as windows do? what is the logic behind the thumb size and position calculation calculation and all? how we could dynamically manage it?

  288. Nick says:

    Raymond,

    Love the blog. Helps wake my brain up in the morning :)

    I just wondered if the idea of creating an Explorer UI element for NTFS hardlink support (as demonstrated by fsutil) was ever thrown around, and if so, why it hasn’t been implemented. I suppose it could cause some havoc for less knowledgeable users who don’t understand the concept, but it seems a shame to let a good feature of NTFS go to waste.

    Thanks for any insight.

  289. Igor says:

    Please check this to see how many good programming practices are broken in a single Windows DLL.

    I was about to send a small windowshot via email so I rightclicked a .gif file and selected Send To|Mail Recipient…

    #1 – Spamming user with dialog which can’t be turned off

    Much to my amazement I got an option to resize the picture to make it smaller. But wait, it was ~430×490 and I can size it _down_ to the 640×480?!?

    #2 – Confusing wording

    Apart from awkward wording which says "Make *ALL* my pictures smaller" (I wouldn’t like that thank you), it appeared that Windows doesn’t check for image size.

    #3 – No checking for image size

    So I fired up disassembler and checked sendmail.dll (SP1, offsets are different in SP2) for oddities and I found this:

    5CDC3F63                 call    _PathIsImage@4

    5CDC3F68                 test    eax, eax

    5CDC3F6A                 jz      loc_5CDC414E

    Aha, its image, lets offer to resize it no matter if it is already small just for the sake of annoying the user!

    #4 – No checking for real file content

    That is not all mind you, PathIsImage() only checks the extension and not the actual file content!!! Just for fun rename zip archive to .jpg and try to send it this way.

    #5 – Poor error handling/signalization

    I bet it would recover nicely from an error… if there was actually error handling code in there. Instead it just skips silently to the next file unless a SHILCreateFromPath() shows some dialog box which would also be another bad practice.

    text:5CDC3F78                 call    ds:__imp__SHILCreateFromPath@12

    text:5CDC3F7E                 mov     edi, eax

    text:5CDC3F80                 cmp     edi, ebx

    text:5CDC3F82                 jl      loc_5CDC414E

    Which then does:

    lea     ecx, [ebp+74h+var_3C]

    call    ?Next@CFileEnum@@QAEPAUMRFILEENTRY@@XZ

    mov     esi, eax

    cmp     esi, ebx

    jnz     loc_5CDC3F44

    Perhaps you could check if they fixed it in Vista?

    I temporarily "fixed" mine by putting xor instead of test because I didn’t want my files to be discriminated.

    And please check this picture of a Vista start menu:

    http://www.gamepc.com/images/labs/vista/rev-xpfinal-smprogsLG.jpg

    And tell them to remove all those Windows’ repeating endlessly there.

    IMO, only two names are really justified — Windows Update and Windows Defender. Others are pure nonsense. I mean, Windows Contacts?!? Aren’t they actually ours?

    And finally I am sorry if all this sounded as a rant. I like reading your blog very much.

    Best regards,

    Igor

  290. Nick says:

    Why doesn’t the taskbar extend across multiple monitors?

  291. Adam says:

    Regarding the upcoming "talk about import libraries in more detail" that you mention in your July 18 post, would it be possible for you to find out and mention why import libraries are even /necessary/, and why the build-time linker can’t "link" against the .dll, extracting the info it needs from there?

    If the answer to this is "because the .dll doesn’t contain all the informtion the linker needs" – the question becomes "why don’t .dlls contain all the information needed to link against them?"

    It’s something that’s always seemed a little weird to me, but I’ve never been able to figure out "why", despite a number of google searches over the years. The "whys" never seem to be documented anywhere.

    Cheers.

  292. Nick says:

    I’ve often wished that applications in Windows run completely sandboxed.  By this I mean the user gives them a directory to which they install, and the only HD access they have is to this directory and My Documents, Temp and other specific folders.  If they try to add keys to the registry, they are really added to a registry ‘patch’ in the app’s directory, not the real registry.  If they try to put files in Windowssystem32, they are really added to a ‘virtual’ Windowssystem32 inside the app’s directory.  Start menu shortcuts are also in the app’s directory, and upon install the user is asked whether to insert ‘hooks’ into the Start menu code to pick these up.  The app runs in a memory sandbox with no access outside of it.  Any access to anything outside of its user-allocated areas is prompted – even things like .NET runtime which would be required by other apps.

    I feel that this would seriously prevent viruses/spyware from being as effective, and apps would not be able to dump files all over the users’ HD (which almost all apps do).  Furthermore, uninstalling an app would be 99% just deleting the folder in which the app was installed – that would take the Start menu shortcuts, registry keys etc with it automatically.

    I hope I’ve explained this well enough, I have more detail on how certain obvious problems would be resolved but I’ll refrain from writing it here due to space.  Has this approach ever been discussed for Windows?  What are the insurmountable reasons (if any) why it wouldn’t work?

  293. Nick says:

    I’ve often wished that applications in Windows run completely sandboxed.  By this I mean the user gives them a directory to which they install, and the only HD access they have is to this directory and My Documents, Temp and other specific folders.  If they try to add keys to the registry, they are really added to a registry ‘patch’ in the app’s directory, not the real registry.  If they try to put files in Windowssystem32, they are really added to a ‘virtual’ Windowssystem32 inside the app’s directory.  Start menu shortcuts are also in the app’s directory, and upon install the user is asked whether to insert ‘hooks’ into the real Start menu so that it can pick these up.  The app runs in a memory sandbox with no access outside of it.  Any access to anything outside of its user-allocated areas is prompted – even things like .NET runtime which would be required by other apps.

    I feel that this would seriously prevent viruses/spyware from being as effective, and apps would not be able to dump files all over the users’ HD (which almost all apps do).  Furthermore, uninstalling an app would be 99% just deleting the folder in which the app was installed – that would take the Start menu shortcuts, registry keys etc with it automatically.

    I hope I’ve explained this well enough, I have more detail on how certain obvious problems would be resolved but I’ll refrain from writing it here due to space.  Has this approach ever been discussed for Windows?  What are the insurmountable reasons (if any) why it wouldn’t work?

  294. Nick says:

    I’ve often wished that applications in Windows run completely sandboxed.  By this I mean the user gives them a directory to which they install, and the only HD access they have is to this directory and My Documents, Temp and other specific folders.  If they try to add keys to the registry, they are really added to a registry ‘patch’ in the app’s directory, not the real registry.  If they try to put files in Windowssystem32, they are really added to a ‘virtual’ Windowssystem32 inside the app’s directory.  Start menu shortcuts are also in the app’s directory, and upon install the user is asked whether to insert ‘hooks’ into the real Start menu so that it can pick these up.  The app runs in a memory sandbox with no access outside of it.  Any access to anything outside of its user-allocated areas is prompted – even things like .NET runtime which would be required by other apps.

    I feel that this would seriously prevent viruses/spyware from being as effective, and apps would not be able to dump files all over the users’ HD (which almost all apps do).  Furthermore, uninstalling an app would be 99% just deleting the folder in which the app was installed – that would take the Start menu shortcuts, registry keys etc with it automatically.

    I hope I’ve explained this well enough, I have more detail on how certain obvious problems would be resolved but I’ll refrain from writing it here due to space.  Has this approach ever been discussed for Windows?  What are the insurmountable reasons (if any) why it wouldn’t work?

  295. Nick says:

    I’ve often wished that applications in Windows run completely sandboxed.  By this I mean the user gives them a directory to which they install, and the only HD access they have is to this directory and My Documents, Temp and other specific folders.  If they try to add keys to the registry, they are really added to a registry ‘patch’ in the app’s directory, not the real registry.  If they try to put files in Windowssystem32, they are really added to a ‘virtual’ Windowssystem32 inside the app’s directory.  Start menu shortcuts are also in the app’s directory, and upon install the user is asked whether to insert ‘hooks’ into the real Start menu so that it can pick these up.  The app runs in a memory sandbox with no access outside of it.  Any access to anything outside of its user-allocated areas is prompted – even things like .NET runtime which would be required by other apps.

    I feel that this would seriously prevent viruses/spyware from being as effective, and apps would not be able to dump files all over the users’ HD (which almost all apps do).  Furthermore, uninstalling an app would be 99% just deleting the folder in which the app was installed – that would take the Start menu shortcuts, registry keys etc with it automatically.

    I hope I’ve explained this well enough, I have more detail on how certain obvious problems would be resolved but I’ll refrain from writing it here due to space.  Has this approach ever been discussed for Windows?  What are the insurmountable reasons (if any) why it wouldn’t work?

  296. Nick says:

    Apologies for the triple post above – not sure how that happened.

    How would you go about creating a special toolbar to sit on the taskbar like the Windows Media Player 10 minimised toolbar (which has play control buttons on the toolbar button itself)?

  297. Randolpho says:

    Raymond,

    You should probably follow up on the Floyd Landis drug scandal. It’s still breaking news at the moment, but I’m sure more will follow:

    http://seattletimes.nwsource.com/html/sports/2003156267_weblandis27.html

  298. Brian says:

    I suggest you move the ‘suggestion box’ link to the top of the nav bar (perhaps between ‘search’ and ‘archives’) and maybe even make it bigger or in a different font or something.  I only found it by using Ctrl+F

  299. charless says:

    So after all of these informative articles about DLL import and export, I am more curious than every why shlwapi.dll imports a nonexistant function from mpr.dll (on WinXP sp2 at least). You see this in Dependency Walker quite often. (e.g. View Dependencies on C:windowsexplorer.exe and notice the warning and it source.)

  300. Wacek says:

    Hi Raymond

    I’ve been reading your blog for a long time, since times it was just a web page not a blog.

    Thanks for a lot of fun and interesting time spent on reading your posts.

    And my suggestion is:

    Don’t you want to be a Windows Code Pope ?

    http://www.pcmag.com/article2/0,1895,1993524,00.asp

    I would vote for you if there would be an election.

    Regards

    Wacek

  301. A. Skrobov says:

    I’m really curious about the blog stats, like which portion of the entire blogs.msdn.com traffic is yours, what are the top referrers, what search requests lead to the blog, and the like.

  302. Mark Reid says:

    Hi Raymond,

    I’ve never been able to work out why a windowed console window that is outputting a lot of data makes the UI so unresponsive while it is showing.

    The problem doesn’t occur when the window is not visible (eg another window is on top of it)

    thanks

    Mark

  303. With your recent posts on DLLs and libraries, what is the meaning of the signatures in the library entries? Why do exported functions use IMAGE_FILE_MACHINE_UNKNOWN and 0xffff?

  304. asdf says:

    I’d love to see you do a series on random or obvious to you but probably not obvious to everyone PSDK tidbits like WINVER, _WIN32_WINDOWS, WIN32_LEAN_AND_MEAN, multimon-like backwards compatible stuff, etc.

  305. asdf says:

    I’d love to see you do a series on random or obvious to you but probably not obvious to everyone PSDK tidbits like WINVER, _WIN32_WINDOWS, _WIN32_WINNT, WIN32_LEAN_AND_MEAN, multimon-like backwards compatible stuff, etc.

  306. Tom M says:

    I was just implementing an event logging system using mailslots and I came across a frankly unbelievable detail on the "About Mailslots" page of the Interprocess communication section of the MSDN docs.

    "Messages smaller than 425 bytes are sent using datagrams. Messages larger than 426 bytes are sent using a connection-oriented transfer over an SMB session. Connection-oriented transfers are limited to one-to-one communication from one client to one server. Therefore, you lose the ability to broadcast a message from one client to many servers. Note that Windows does not support messages that are 425 or 426 bytes. "

    I’d love to know whether or not there’s a good reason why 425 or 426 byte long messages are not allowed.

    According to the "About Mailslots" page of the Interprocess communication section of the platform SDK

  307. sfilippov says:

    Resource compiler issues a warning if the text length in a static control exceedes 256 characters: "warning RC4206 : title string too long; truncated at 256".

    AFAIK dialog template has no such a limit. Is this warning just a 16-bit legacy?

    This was not an issue until now – we always were able to rephrase a text to fit it in 256 limit. Now we are localizing our product. After translating to German and French the length of the text in many controls became longer  than 256 chars and resource compiler thruncates it to 256.

    Of course your answer will not solve the problem, but I just wonder is any chance that in a future this limit will be eliminated?

  308. Mike Dunn says:

    Why was the "Start" label removed from the Start button in Vista? As you’ve talked about, that label was a great affordance in telling newbie users what to click on first.

    How are the help and tech support folks going to refer to the button? "The round windows logo in the corner" doesn’t have quite the same ring to it.

  309. BrianK says:

    What compiler do you and other developers use? Are you using VS2005 yet?

  310. Roland Persson says:

    There seems to be a limit on the total path of filenames to be less than 256 characters. This limit is enforced by the shell when naming files for example.

    You can trick the checks though by renaming a directory above the file and get a full filename that is longer than the limit.

    For example:

    1. create c:mydir

    2. put a file in mydir and give it the longest possible name the shell allows.

    3. rename c:mydir to something longer, like mydir_long

    Although the limit is pretty high it does happen that users manage to reach it inadvertently. Typically by people who like to organize stuff and have deep directory hierarchys with descriptive names for everything.

    If you create such a file and it is associated to a program and then doubleclick the file the filename sent to the launched program as an argument will be cut before the limit is reached.

    In the above case "c:mydir_long" would be given as an argument to the launched program.

    Why is this? And wouldn’t it be better to pass the whole filename eventhough it’s too long? The command line length is no longer a problem in these cases is it?

    And if that is not better wouldn’t it be better to do nothing at all? Or to tell the user that the filename is too long and that they need to rename it (although that’s not so easy as the shell wont allow them to, they have to shorten the path first).

    Any workarounds for this that can be implemented in the launched program itself?

    This is observed on WinXP SP2.

  311. Bod J says:

    How to encrypt autologon password in registry. I know powertool does this, but haven’t found a way to do this myself.

    Thanks

  312. Jamie Gordon says:

    I do a lot of low level process manipulation and I find the documentation on certain aspects quite scant so a lot of it turns out to be trial and error. I’ve listed some things I have had difficulty with lately, I thought they might make nice blog topics, simply because the answers would interest me (from a "I like to know how things work under the hood" viewpoint).

    When using the BeginUpdateResource (et al) functions, why must the resource section in an image be called ".rsrc", and why is IMAGE_DIRECTORY_ENTRY_RESOURCE ignored otherwise? Although Explorer still appears able to display the resources if you only have IMAGE_DIRECTORY_ENTRY_RESOURCE set, EndUpdateResource (on XP) does some strange things if the resource section is not called ".rsrc". What is the original cause of this behaviour? (As I understand it [vaguely], it’s not a bug in the API but a throwback to behaviour in something else. Or maybe the API is just broken after all, and I just hoped the answer might be more interesting than that. heh)

    What contitutes a valid Win32 application to the loader, as distinct from just a file that has MZ and PE in the right locations? Specifically, I had an image that appeared to be valid but which the loader refused to load. I fixed it by making sure SizeOfHeaders, SizeOfCode, SizeOfInitializedData and  SizeOfUninitializedData total the same as SizeOfImage (which wasn’t strictly how it actually was, but it made it work). But I have seen other images where this is definietly not the case but the loader does still load them.

    What rules does the loader use for data appended to an image but which is not in a section. I have seen compilers place data (which it seems ought really to be placed in a section) in both the header itself and appended to the end of an image. The appended data was also referenced by an entry in the DataDirectory so I assume it was even needed at runtime. So does the loader place such data in memory, what is it supposed to do (if there is a spec.), and if it ends up in memory how does it protect the memory given the absense of any section characteristics?

    Thanks for a great blog.

  313. eric johnson says:

    i hate working with the mouse and much prefer the keyboard.  i wish the "repeat rate" setting in the keyboard control panel would go higher.  my googling around on the topic has left me with no great solution.

    might be interesting to hear about how the keyboard control panel does what it does and why one can’t go higher.

    keyboard king (http://bandwidthcontroller.com/Keyboard%20King/) gets me closer, but it has some quirky behavior  possibly triggered by it stuffing events into the event queue.

    -eric

  314. Yuhong Bao says:

    [Commenting on the article "Applications and DLLs don’t have privileges; users do"]

    How about not granting debug privileges on the user? This will make bypassing the protection impossible. But that will prohibit legalmate debugging, so how about separate the dangerous activities from the non-dangerous activities, or better, only allow approved programs to do the dangerous activities?

    The dangerous activities are:

    Calling WriteProcessMemory on the process

    Changing the processor context

  315. Arno Schoedl says:

    One would think that GetDC(hwnd) and GetDCEx(hwnd, NULL, 0) do the same thing. Not so. I had an iconized MDI window with CS_OWNDC (to be precise, an Excel 2000 document window). GetDC retrieved some DC different from the own DC, while GetDCEx retrieved the own DC. ???

    Arno

  316. Fredrik Ullner says:

    When hovering over the ‘Start’ button, a tooltip appear. However, if you hover long enough, the tooltip will go away. If you move the mouse, and then hover the ‘Start’ button again, the tooltip doesn’t display.

    But, if you click on the ‘Start’ button, the tooltip will then display when you again hover the ‘Start’ button.

    Why doesn’t the tooltip re-appear if you don’t press the button?

  317. Yuhong Bao says:

    That is probably AWE.

  318. Yuhong Bao says:

    Before Windows XP, yes, but not anymore.

  319. Yuhong Bao says:

    Well, first the DOS inside Win9x is started and then it starts win.com, which is a DOS application. Basically it is like Win3.1 in 386 enhanced mode which is also more like an OS than a DOS frontend.

  320. Yuhong Bao says:

    Well, first the DOS inside Win9x is started and it starts win.com, which is a DOS application. Basically it is like Win3.1 in 386 enhanced mode which is also more like an OS than a DOS frontend.

  321. Ken Hagan says:

    …if you aren’t writing device drivers?

    You have written on several occasions about the stuff that goes into a new version of Windows to avoid breaking existing apps. My perception is that on many occasions the app was actually broken even when it was written, which means the whole sorry tale could have been avoided, if only they’d known.

    Now, the checked build could (and does) in some (many?) cases, contain code to spot obvious abuses and report them to developers. Its a kind of hot line between two groups of people who (on your blog’s evidence) really need to talk more. :)

    However, my perception is that the checked build is woefully underused. I’ve been running check builds on my test systems for years and there are major apps out there (hello, InstallShield) that display "you goofed, abort retry ignore" message boxes on checked builds. (In fact, there are device drivers that simply blue-screened on boot, but I did exclude driver development just now, so I’ll say no more.) It is hard to believe that such code has ever had ever the most cursory "start it up" testing on a checked build, far less a complete test program under the application verifier.

    So why don’t MS support and promote the checked builds more? It doesn’t get protection from Windows Update and Windows Installer 3.1 (which is *required* for VS2005) refuses to install, so as I write these words the checked build is unusable with VS2005.

    Am I simply mis-understanding what MS intend the checked build for? Do *they* see it as just a driver tool?

    Afterthought: Each time MS add something evil for compatibility, they could make it conditional on "if (!IsDebuggerPresent())", which would mean end-users got the protection (this is commercially essential) but the descendants of the original developers didn’t, but had the precise nature of the error and the fix explained to them instead. Nice or nasty?

  322. Andres says:

    Why doesn’t Windows Explorer show the Folders size when in "Details" mode?

    Andres

  323. David Walker says:

    You ran an article once about illogical pricing at the Microsoft cafeteria.  Here’s a similar topic on Starbucks’ "ghetto latte":

    http://freepressblog.org/2006/09/06/gaming-starbucks-the-ghetto-latte/

  324. Ray S says:

    Back on November 16, 2004 you posted "What is this Xerox directory doing in Program Files?"

    No need to rehash that blog, it turned out to be very informative (thanks, by the way). The only problem is on searching all of the Microsoft websites I found no hits for "nwwia", including this one (probably due to archiving).

    The problem I still have with this is that there’s no Microsoft document about the xerox/nwwia folders.

  325. I noticed you’ve been posting a lot of DLL stuff, so I thought i’d throw a question converning them your way.  In a dll made in MSVC with a def file for exporting the functions, I tried renaming the functions, and then other projects dont pick them up through the lib file.

    For example:

    EXPORT

    MC_Dispose=?Dispose@MyClass@@QAEAAV1@XZ

    Then when importing the lib into another project, it reports that "?Dispose@MyClass@@QAEAAV1@XZ" is not found.

    It would only pick it up if I had named the function "Dispose".

    If you get the urge to email me about it, I can be reached at jeff at dakusan dot com.  Otherwise, I hopefully look forward to a blog post on it :).

    Thanks.

  326. I noticed you’ve been posting a lot of DLL stuff, so I thought I’d throw a question concerning them your way.  In a DLL made in MSVC with a def file for exporting the functions, I tried renaming the functions, and then other projects don’t pick them up through the lib file.

    For example:

    EXPORT

    MC_Dispose=?Dispose@MyClass@@QAEAAV1@XZ

    Then when importing the lib into another project, it reports that "?Dispose@MyClass@@QAEAAV1@XZ" is not found.

    It would only pick it up if I had named the function "Dispose".

    If you get the urge to email me about it, I can be reached at jeff at dakusan dot com.  Otherwise, I hopefully look forward to a blog post on it :).

    Thanks.

  327. Jonathan Wilson says:

    Can you explain why the clipboard APIs still require GlobalAlloc and friends?

    Why is there not a SetClipboardDataEx or something that does what SetClipboardData does but without needing to call GlobalAlloc?

  328. Chris J says:

    I’ve been trying to google this after a discussion here at work … why is the default date for OLE/ADO "30 Dec 1899", rather than 1 Jan 1900 (SQL Server origin), 1 Jan 1970 (UNIX epoch).

    It seems a strange choice of date – not at the beginning or end of a year/decade/century, but the day before new-years eve.

    Any chance of enlightenment?

  329. DX says:

    I would like to mention that sometimes during system start up and heavy CPU load, Shell_NotifyIcon fails without any apparent reason.

  330. Pplu says:

    Hi,

      Keep up the good work on the blog! It’s very nice.

      When I work in multimonitor mode i have noticed that programs tend to run more slowy.

    If I swith to single monitor mode, applications tend to run faster.

    I was curious if this is because of windows internal implementation, or its the drivers fault (bad multimonitor implementation). Or am I just a little paranoid all together? How does Windows treat multimonitor mode?

    I suspect multimonitor mode is not that mature (or tested by manufacturers). I’ve seen DirectX Games resize the second monitor on startup (although they execute on the primary monitor). Glitches on my screen when in multimonitor (I suspect of the driver). I think its a great feature, and use it on a daily basis at work, and am curious to know what kwirks and curiosities are behind the multimonitor implementation.

    Thanks

  331. A. Skrobov says:

    Regarding http://blogs.msdn.com/oldnewthing/archive/2006/08/31/733521.aspx, why is in imposible to superclass WC_DIALOG?
    When I register my own class under this atom, and leave NULL in WNDCLASS.hInstance, Windows fills it in for me.
    Then I have two distinct classes registered: (0,WC_DIALOG) and (hMyInstance,WC_DIALOG), and DialogBox functions all use the first one.

  332. SuperBK says:

    Whats the proper way to add keyboard support to a Dialog box? For example, I have a button called "Add", that is mapped to a handler called "OnAddRecord".  I want to do the same thing when a user presses "Insert" on the keyboard. What I have been doing is overriding PreTranslateMessage (this is MFC) and then checking if the message is WM_KEYDOWN and if so if the key is VK_INSERT. If all that was TRUE I called my button handler directly?  I recently got into trouble when I forgot to return TRUE for PreTranslateMessage to stop further processing. Is there a better way to do this? You will probably say to use a keyboard accellerator, but I find Pretranslate give me finer control by allowing me to check which control has the focus.

    Here’s an example:

    BOOL CMyDialogDialog::PreTranslateMessage(MSG* pMsg)

    {

    if (pMsg->message == WM_KEYDOWN)

    {

    switch (pMsg->wParam)

    {

    case VK_INSERT:

    OnAddRecord();

    return TRUE; // stop further processing

    case VK_RETURN:

    // check if the list box has the focus then call function

    if (GetFocus() == GetDlgItem(IDC_GRIDCTRL))

    {

    OnModRecord();

    return TRUE;

    }

    break;

    case VK_DELETE:

    OnDeleteRecord();

    return TRUE; // stop further processing

    case VK_F5:

    OnButtonRefresh();

    return TRUE; // stop further processing

    default:

    break;

    }

    }

    return CResizableDialog::PreTranslateMessage(pMsg);

    }

  333. kokorozashi says:

    ShowWindow is documented as ignoring its first parameter the first time it’s called if GetStartupInfo produces an instance of STARTUPINFO whose dwFlags member has its STARTF_USESHOWWINDOW bit set. In this case, ShowWindow is supposed to behave as if the caller had passed the wShowWindow member of STARTUPINFO. However, I don’t see this occurring. Despite my verifying the relevant bit is indeed set, ShowWindow seems to happily honor the parameter I pass. What’s the real story, and, assuming the documentation is out of date, what is the history behind the change?

  334. Brian Reiter says:

    I’m interested in a particular oddity of the Windows Explorer task bar tool tips. I’m not sure when I became aware of this issue, it may be very old and go all the way back to Win95. On every Windows XP and Windows Server 2003 box I have used the tool tips on the task bar buttons and system notification area icons are eventually placed in a z-order behind the task bar itself. They start out normal at the beginning of a session but invariably after a while become unreadable because they pop behind the task bar. I haven’t been able to figure out why this happens or a way to prevent it from happening except by choosing to disable the standard “Keep the taskbar on top of other windows” option, but that has the side effect of having the taskbar not be on top of other windows. The only way to restore normal tool tip behavior is to do “taskkill /f /im explorer.exe && start explorer.exe” or log of and log back on. Nobody has ever been able to provide me with a satisfactory explanation for why this happens. Maybe there’s an interesting story behind it. Any idea what is going on?

    [Response. -Raymond]
  335. shankarg says:

    Is there a programmatic way to check for the real microsoft windows?

    If I want my program to run only under microsoft windows how do I do that?

    Is there any registry key like HKEY_LOCAL_COMPUTERSOFTWAREMicrosoftWindows that can’t be legally implemented by wine because that would violate microsoft’s trademarks?

    Thank you.

  336. Wyatt says:

    CreateRemoteThread, how does it work and why is it there/what is it ussed for.

  337. Dave says:

    Probably not the right place, but I’d sure like to know why both the on and offline versions of the MSDN assume I’m interested in Windows CE. There’s got to be a way to filter those documents out, no?

  338. Eric says:

    There is an error in the PowerToy Calculator converting miles per hour to feet per hour. Here are details:

    http://xperiencexp.blogspot.com/2006/07/powertoy-calca-strange-error-in.html

  339. Sean W. says:

    I’d like to see an in-depth discussion of the use of the shell’s new Desktop Window Manager (Dwm*) functions in Win32, in non-managed good old-fashioned hard-compiled C code, with an eye towards what it takes to make existing Win32 code "play nicely" with Vista’s new styles and special effects.  There doesn’t seem to be much documentation or sample code on using these beyond the reference documentation in MSDN, and none of it targets existing unmanaged C code.

    Discussion of both the use of these functions as well as best practices would be really helpful for a large class of developers who want to make their existing software look good on Vista.

  340. Daniel Cheng says:

    I think you may be interested in this…..

    This guy use his psychic power to remove malware and computer virus:

    http://www.clearwisdom.net/emh/articles/2001/12/14/16758.html

  341. Bart van der Werf says:

    I was wondering why UTF8 is not a choice for the ACP in XP ?

    It would allow older applications that treat ACP correctly in regards to MCBS to be multilingual.

  342. Igor says:

    Raymond,

    I am wondering why the Explorer doesn’t listen to the user preferences?

    For example, I set it to delete files directly instead to Recycle Bin and not to show any confirmation dialog. For one thing, I still get dialog and what is more annoying is that Recycler folder which keeps popping up even though it has no function if I don’t use the Recycle Bin.

    Is there any way to prevent recreating of this folder apart from patching the explorer (or more likely shell32.dll)?

    IMO, Recycle Bin config should be located in Control Panel and it should allow the user to remove the icon from desktop when it decides that it doesn’t want to use its functionality. It should also remove Recycler folders on all drives and stop creating them unless you reactivate the Recycle Bin.

    Same goes for System Volume Information. If one doesn’t use System Restore, Indexing and Shortcut Tracking services then the System Volume Information folder should be a goner too.

    I am really interested in your opinion or at least explanation here.

  343. Tom Kirby-Green says:

    I know it’s deeply untrendy but I’d like to know why I’d want to use ‘COINIT_DISABLE_OLE1DDE’. I mention it because I see it used in some sample code over on the shellreleaved.com web site.

    http://shellrevealed.com/files/folders/code_samples/entry4073.aspx

    Is this a flag we should be routinely |’ing in these days – assuming we’re not having to target down stream platforms?

  344. Igor says:

    Regarding my previous suggestion (http://blogs.msdn.com/oldnewthing/pages/407234.aspx#818292) — never mind, I figured it out on my own and I even wrote two articles on my blog:

    How to get rid of Recycled and Recycler folders permanently?

    http://levicki.blogspot.com/2006/10/how-to-get-rid-of-recycled-and.html

    How to get rid of System Volume Information folder permanently?

    http://levicki.blogspot.com/2006/10/how-to-get-rid-of-system-volume.html

    It is an ugly hack but it works until someone in Microsoft decides to implement some way to disable those features in more down to Earth fashion.

  345. James says:

    There is an article on MSDN about using VirtualAlloc to reserve then commit memory pages. Here is the link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/reserving_and_committing_memory.asp

    The article demonstrates a use of SEH to handle a page fault and then commit the appropriate page at runtime. My question: is SEH being used for performance reasons? I mean alternatively we could write a special allocator function that checks the allocation range and commits new pages when necessary without triggering a page fault. Of course such code would be run for every allocation, whether or not it actually required a new page to be committed.

    Can you elaborate?

    [You asked Larry Osterman the same question. -Raymond]
  346. kip says:

    For most users, 80-90 percent of the time they right click on something it is to subsequently click on Properties.  Since double-click of the right mouse button doesn’t do anything, I’ve always thought it should open the properties dialog of the object being clicked.  I know Alt+double-click does the same thing, as does Alt+Enter… I’ve sent this suggestion to Microsoft before, years ago… maybe I shouldn’t have posted it here.. if so, sorry I’ve wasted 30 seconds of your life. :-/

  347. AndyB says:

    In a recent blog concerning Vista minimum resolution you said this:

    <i>> Sometimes servers are run at 640×480, where you have a rack of them in the datacentre and one shared popup LCD or legacy CRT monitor to work with.

    Why would you ever do this? Am I just spoiled by serial consoles that can be run in a quiet office somewhere else?</i>

    I think the answer is .. yes, you are spoiled by them!

    Please tell us more about them, what type you use, how you get it going, what tips and pitfalls to watch for, and other ‘this is cool and its about time more people were made aware of it’ type things.

  348. BhavanaP says:

    Hi,

    I am trying to add a query on this site. But i do not get any link where I can post it.

    Please Help.

    Bhavana.Poladia

    Magnet Technologies.

  349. MontagFTB says:

    Hi Raymond,

    We have a win32 implementation of a widget factory that includes the creation of the top-level dialog window to which all the children will be bound. However, the attachment of the child widgets to the parent takes place at a time *after* the CreateWindowEx routine has been called. Because of this, we temporarily create the dialog’s child widgets to an invisible window first. Later we use SetParent to move the widget from the invisible dialog to its final resting place in the visible dialog. However, when we try to process events for the child widget, we find many times that events are still getting sent to the invisible window for the children it used to have, but have since been moved to the visible dialog.

    Further investigation reveals this subtle fact: That the parent specified in CreateWindowEx is both the parent of the window and the owner of the window, but when you call SetParent it only sets the parent of the window, not the owner. Thus, some events that need to go to the parent will fetch the "parent" of the window to send certain events (in which case the event goes to the correct [visible] dialog), and others will fetch the "owner" of the window, and the event will go to the wrong [invisible] dialog.

    Is there a way to set the owner of a win32 window after it has been created by CreateWindowEx?

  350. Scott says:

    In cmd.exe, with a working directory of "c:abcd":

    "start .." opens an Explorer window in c:abc, as expected.

    "start …." however, also opens an Explorer window in c:abc. From then on, adding additional ".." will move back one additional directory. "start ….", however (i.e. with the trailing ), always works correctly.

    Is this just a boring old bug, or is there some crazy compatibility reason for this?

  351. robroy says:

    given a menu handle, how do you find out what window(handle) is actually showing the menu and receiving messages from the menu?

    and why on earth is the windows menu system so incredibly counterproductive? if implemented properly, it would make it possible to clean up the user interface with unneccessary superflous buttons and visual fluff and actually be a productive and quick way of accessing functions in the user interface without having to move the mouse too much around the screen. this is probably the 1 thing that bugs me the most about windows. help me with my first q and i might be able to help myself! :)

    and why is most of the juicy menu messaging and goings-on hidden from developers? if you have a good source of info, please post a link.

    ciao

  352. Iain Heath says:

    Hey Raymond, I’d love to hear your comments on this new thread on the Vista UI forum…

       http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=855446&SiteID=1

    In short: Why did the Shell team feel it was necessary to tinker with the appearance of combo-boxes in Vista so that CBS_DROPDOWNLIST combos now look like menu pushbuttons, making them inconsistent with how CBS_DROPDOWN combos look (which hasn’t changed)? What were you guys thinking?!

    What techniques can we ISV’s use to force CBS_DROPDOWNLIST combos in our apps to retain the *proper* look and feel when run on Vista, so that our forms and dialogs don’t look a mess and our users don’t freak out.

    Is there some magic window style we can slap on combos to get the old look back (but without un-theming them)?

    iain

  353. erangi says:

    Hello Raymond,

    In one of his posts to the Shell: revealed site, Christopher Davis describes the undocumented error messages returned by SHFileOperation. According to the post, the function was written during the pre-win32 era, thus returns codes that are not included in winerror.h. The post contains a list of those codes, which is really great.

    In the codes list, two errors have caught my attention: DE_DEST_IS_DVD (0x83) and DE_SRC_IS_DVD (0x87). According to wikipedia, the first DVD players were sold on 1996. The error codes have been there before Win95, i.e. 1995. So, have someone with a great vision anticipated the use of DVDs several years before they were sold? If so, how was this error tested? Or, was this error added to the list later, even though winerror.h was already available? Or is it the post that is wrong?

    The post can be found here: http://shellrevealed.com/blogs/shellblog/archive/2006/09/11/Common-Questions-Concerning-the-SHFileOperation-API_3A00_-Part-1.aspx

    Eran

  354. BrianK says:

    The history of Sysedit. I noticed that its still in XP. Does anybody really still any 16 bits apps?

  355. Viagra says:

    Generic Viagra Generic Viagra Generic Viagra Ringtones Ringtones Ringtones

  356. Viagra says:

    Generic Viagra Generic Viagra Generic Viagra Credit Cards Credit Cards Credit Cards Ringtones Ringtones Ringtones

  357. Viagra says:

    Generic Viagra Generic Viagra Credit Cards Credit Cards Credit Cards Ringtones Ringtones Ringtones

  358. Nick says:

    Hi Raymond!

    A topic I am particulary interested in is the naming of controls, how it works…

    ->Every control gets a name from a developer…via the IDE (e.g btnOK)

    When using this function: GetWindowLong(handle,GWL_ID) it doesn’t return the name itself but mostly a number or nothing.

    What is GWL_ID, the documentation isn’t very clear on this.

    How does this whole system work, what are these numbers and where are the ‘real’ names?

    PS: Thanks for this great site! You do a great job on explaining the topics and keeping it up-to-date!

    Best Regards,

    Nick

  359. mez says:

    Hi

    I have signed up for receiving emails when you add new articles ("Send me emails for new posts and articles only"), but i haven’t received any email so far (you have added several new articles since i’ve signed up)

    What did I do wrong?

    TY

  360. I have a question related to this post:

    http://blogs.msdn.com/oldnewthing/archive/2006/11/20/1109012.aspx

    I also asked a similar question in the comment, but this may be worth a blog post.

    Okay, here goes:

    A lot of your blog commenters are critical of Microsoft’s efforts to maintain backwards compatibility.  Certainly being backwards compatible helps you sell moe copies of Windows.

    However, one of the issues that the critics raise is: “all of this backwards compatibility stuff slows Windows down”.  I can certainly understand that line of reasoning.  If every Windows library is filled with checks to see if the calling program is buggy, that can slow down things for every application that calls the library.

    So, my suggestion for a topic is this:

    1. How much do these backwards compatibility “hacks” cost us in terms of CPU cycles and memory?  Have you done any profiling on them?  If not, what’s your gut feeling?  If you made a version of Windows with all of the “hacks” removed, would it be significantly smaller/faster?

    2. What kinds of techniques you used (if any) to minimize the negative impacts of these “hacks”.

    [Topic. -Raymond]
  361. nick_journals@hotmail.com says:

    Hi Raymond!

    A topic I am particulary interested in is the naming of controls, how it works…

    ->Every control gets a name from a developer…via the IDE (e.g btnOK)

    When using this function: GetWindowLong(handle,GWL_ID) it doesn’t return the name itself but mostly a number or nothing.

    What is GWL_ID, the documentation isn’t very clear on this.

    How does this whole system work, what are these numbers and where are the ‘real’ names?

    Best Regards,

    Nick

    PS: Thanks for this great site! You do a great job on explaining the topics and keeping it up-to-date!

  362. sandra says:

    General interest topic:

    Online German language resource site at http://www.canoo.net

  363. Bart says:

    When using a memory mapped file, is all the content that the application has written to the mapped view of the file in memory flushed to disk if the application is then terminated abnormally ?

  364. JF says:

    How about something on your blog saying who you are.  Apparently you’re called Raymond, as many comments seem to say, perhaps you’re really famous  and I should already know who you are, but on a quick scan I see no attribution on any post and no "who am I" type link.  It would help people like me who stumble upon your blog to decide whether we think it may be worth reading.  Perhaps it’s here somewhere, but it’s not obvious.

  365. tod weitzel says:

    Raymond,

    One thing I always wondered since most of my day is spent reinstalling XP for one reason or another:

    Why does the XP installer always start at an estimate of 39 minutes, then go to 23 minutes (IIRC) after the first reboot? It seems to always use those numbers regardless of the machine it installs on.

    I am certain there must be a story behind that, and as your knowledge of windows history is quite voluminous, hopefully you know the answer :)

    -t

  366. David Pritchard says:

    Maybe you could shed light on the strange history of the edit control, and one oddity in particular: text alignment. Originally it wasn’t allowed, then only in multiline edits, now in all edits, but not dynamically, unless you have a language pack installed, in which case there’s a hook via lpk.dll which adds this special ability (presumably related to right-to-left scripts).

  367. Aaron Lerch says:

    Can a non-administrator retrieve/evaluate environment variables as they would appear for another user? Admins can scrape the registry (yuck), but if LocalService wanted to periodically clear log files (hypothetically) stored in user-defined paths, can the windows service get the data?

    (And yes, I know the natural answer is "why would you do that?" :) )

    Thanks!

  368. I have not found a simple example of code that switches an application from windowed to fullscreen, as IE or Irfan Views with Enter key.

    So I have come to my own solution, but as it involves reparenting and setting style, I am not sure it is correct in all cases

    <verbatim>

    BOOL fullscreen = FALSE;

    void SwitchFullscreen() {

       WINDOWPLACEMENT wplacement;

       wplacement.length = sizeof(WINDOWPLACEMENT);

       GetWindowPlacement(vlivview, &wplacement );

       if (fullscreen == FALSE) {

    ShowWindow(mainwindow, SW_HIDE);
    
    SetWindowLong(vlivview, GWL_STYLE, WS_HSCROLL | WS_VSCROLL | WS_CLIPCHILDREN | WS_VISIBLE);
    
    SetParent(vlivview, 0);
    
    wplacement.showCmd = SW_SHOWMAXIMIZED;
    
    SetWindowPlacement(vlivview, &amp;wplacement);
    
    SetWindowPos(vlivview, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); 
    
    fullscreen = TRUE;
    

       } else {

    SetParent(vlivview, mainwindow);
    
    SetWindowLong(vlivview, GWL_STYLE, WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE);
    
    wplacement.showCmd = SW_SHOWNORMAL; 
    
    SetWindowPlacement(vlivview, &amp;wplacement ); 
    
    SetWindowPos(vlivview, 0, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
    
    ShowWindow(mainwindow, SW_SHOW);
    
    fullscreen = FALSE;
    

       }

    }

    </verbatim>

  369. Martin says:

    I always wondered why the wireless dialog asks you to insert your passphrase twice when connecting to a network. Is there an actual point to confirming a passphrase that already exists?

  370. BrianK says:

    Why can’t programs running in a non-aminstrator account use raw sockets in Windowx XP? If they can, how do you enable it.  None of the settings found on the net seem to work,

  371. James says:

    The following code implements a simple keylogger. It prints out everything that is typed on the system to stdout. However the seemingly useless line ‘GetKeyState(0);’ is required for it to work. If that is not there the information that GetKeyboardState returns is never updated (and so it loses track of caps lock, etc.). According to the documentation GetKeyboardState is only updated when you remove keyboard messages from your queue. It is supposed to be the same for GetKeyState, so how come calling that function causes the buffer to be updated? Is there some subtlety I have missed or is this an obscure bug?

    #include <windows.h>

    #include <cstdio>

    LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) {

    if(nCode == HC_ACTION && wParam == WM_KEYDOWN) {

    KBDLLHOOKSTRUCT* key = (KBDLLHOOKSTRUCT*)lParam;

    GetKeyState(0);

    BYTE keyState[256];

    GetKeyboardState(keyState);

    WORD chars;

    if(ToAscii(key->vkCode, key->scanCode, keyState, &chars, 0)) {

    if((char)chars == ‘r’) putchar(‘n’);

    else putchar(chars);

    }

    }

    return CallNextHookEx(NULL, nCode, wParam, lParam);

    }

    int main(int argc, char** argv) {

    HHOOK hhk = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), 0);

    MSG msg;

    while(GetMessage(&msg, NULL, 0, 0) > 0);

    UnhookWindowsHookEx(hhk);

    return 0;

    }

    [Michael Kaplan answers this one. -Raymond]
  372. Cláudio says:

    Hi,

    (Congrats on the book I will definitely read it)

    Could you blog on the deferent techniques supported by windows for reading a file:

    (Memory Mapped; Read Async; Read Async NoBuffering)

    I’ve been implementing a system that reads a lot files and due to this I’ve been trying to improve the performance of its main task, reading files.

    My first choice was Read Async NoBuffering but when I hit the 64Meg consecutive read chunk I changed to the Memory Mapped because I ended up being a simpler implementation.

    Although I’m still interested in improving it, and I would like to see your opinion on it! And by the way why is there the 64Meg barrier?

    Thanks

  373. Bart says:

    Why is there no TryEnteryCriticalSection that loops for the spincount specified with InitializeCriticalSectionAndSpinCount

    but does not release its timeslice to the OS if it fails to get it while spinning ?

  374. Ashish shah says:

    Hi,

    I am looking for VC++ (win32) sample code for interrupt driven communication with COM port. Thanks

  375. Yaron says:

    Windows Media Player (and several other software) insert an entry into the right-click Context menu of explorer.  The entry I’m referring to is "Add to windows media player list".

    Reading the file association documentation in MSDN it tells us that in Windows XP, a new file association interface has been implemented that allows a program to receive a list of multiple files at once using the IDropTarget COM interface.

    I haven’t found any documentation on how this actually works.  Must you use an ActiveX DLL that implements this interface, or can this somehow be used directly through my main program’s EXE file?

    I’m referring to this documentation:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/fileassociations/fa_verbs.asp

  376. duggie says:

    In XP, sometimes after I play a game the cursor speed gets messed up. I have found that clicking the Start button fixes it. Why does this work?

  377. Johan Almén says:

    What was the rationale behind the decision to let Excel empty the clipboard when launched?

    (Yes, this is an Office question of sorts, but the clipboard is a part of Windows…  ;-)

  378. Really16 says:

    How 32-bit was win 3.11 when running in protected mode with win32s? Why is 3.11 called 16-bit windows when it required a 32-bit cpu an runned i 32-bit protected mode?

  379. Matthew Douglass-Riley says:

    I’m curious as to the history and current status of the "What’s This?" context option in dialog boxes, and the associated button in the title bar.  Are new applications in-house still being developed with this feature?  What will it / does it look like in Vista?

    I ask because it seems to a (very) casual observer that the feature had its time but has since gone out of favor both in and out of Microsoft.  I notice it’s still supported in the Common Dialog library and in (some) Windows Explorer dialogs.  One particular counterexample (only for illustrative purposes, not at all an indictment) is the "Choose Details…" window under "View" in Windows Explorer.  It has the button but, at least on Windows XP SP2, has no associated help text for any of the buttons on the right.

  380. Merit says:

    Why can’t I stretch the windows task bar across multiple monitors?  Why don’t windows maximize to  both monitors?

    I know there are third party tools to do this, and some drivers have a span mode that presents both monitors as one large screen to Windows, but why isn’t this built in functionality?

    Thanks

  381. Martin Filteau says:

    Hi Raymond,

    I just received my copy of your book from Amazon.  It’s great and I’m having a lot of fun reading it!

  382. Sys64738 says:

    I read on Bjarne Stroustrup’s web site that:

    <cite>

    Literally everything at Microsoft is built using various flavors of Visual C++ – mostly 6.0 and 7.0 but we do have a few holdouts still using 5.0 :-(

    </cite>

    <http://www.research.att.com/~bs/applications.html&gt;

    Is it real that you are still using Visual C++ 6 and 5?

    Thanks.

  383. Sys64738 says:

    Hi,

    Do you think is a good C/C++ programming style to add IN and OUT to

    function prototypes? e.g.

    void ScrambleString(

     IN  LPCTSTR str,

     IN  LPCTSTR key,

     OUT LPTSTR  outBuffer

    );

    Thanks.

  384. Chester says:

    Hi, Raymond! First of all, thank you for the great work you have been doing on your blog – it’s amazing to have so many things (historical and technical) explained by an insider.

    I would like to inquire if you can clarify the reason that makes so many people receive the "Are you sure you want to delete ‘WINDOWS’" message when there is something wrong with their Recycle Bins (ex.: http://www.herrodius.com/blog/?p=46, but you can find dozens more by searching for "are you sure you want to delete windows").

    I know that it’s a shell functionality, not directly related to kernel stuff, but maybe there is some interesting aspect (i.e., "old new thing material") that can be highlighted by investigating this curioius (from an user standpoint) behavior – just a guess.

    Thank you and have a nice day!

  385. Andrei says:

    Hi Raymond!

    I couldn’t find any useful resource for the radio buttons bug that happens when I try to make them (the text) transparent using WM_CTLCOLORSTATIC: instead of the radio button now there’s a black background.

    Please shed some light on this.

    Thanks

  386. Leo Davidson says:

    We’ve been able to drop files on the command prompt to paste their paths for as long as I can remember. (Something you mentioned back in 2003, as it happens: http://blogs.msdn.com/oldnewthing/archive/2003/11/24/55833.aspx)

    This was really handy but in Vista it seems to be gone. The command prompt is no longer a drop target.

    Why is this? Is there a way to turn it back on? If it’s a security feature, couldn’t drops have remained enabled for non-admin prompts, at least?

  387. Cory says:

    Great work!

  388. Chad says:

    Well done!

  389. Edward says:

    Well done!

  390. Yuhong Bao says:

    What were the MFC 2.53 that John Elliott mentioned in one of his blog comments in this blog entry:

    http://blogs.msdn.com/oldnewthing/archive/2006/01/06/510066.aspx

  391. performance-guy says:

    Care to do one more on PAE and 3GB? In particular, how it interacts with LargeSystemCache?

    I am building a dedicated file server. The hardware has 4 GB of memory, so of course we have PAE enabled so that the available mem is 4,193,296 rather than 3,538,128.

    The reason for this amount of memory is for caching, so of course I have LargeSystemCache enabled. The docs would lead one to expect 4,012,744 K for caching (max memory less 172 MB for the kernel and 4 MB).

    However, of course, this is more than the 2 GB available for user mode. So, the most the system will cache is 2,097,068 (according to NtQuerySystemInformation). The only way I see to get 4,012,744 is by enabling 3GB.

    This, of course, presents a problem because now both PAE and 3GB are enabled, conflicting with each other.

    Is there a good way out? Or should I simply settle for a 2 GB NTFS-CIFS cache?

  392. JP says:

    I apologize for posting this off-topic in another area of your blog.  But I’m just about at my wits end and desperate for anyone who can possibly figure it out.

    I just recently noticed that one of my XP machines i acting in a very frustrating manner. Normally, if you minimize an application and then press alt-tab, that application is the last one on the list. This has been the behavior forever and still is on my laptop. However, on my desktop it now puts the minimized app in SECOND position. This means if I minimize an app and hit alt-tab, I’m back at the minimized app. Turns out to be a very useless way of doing things. I’ve found several other unanswered reports in usenet and on blogs from other people with the same problem. I also have another person at my office so afflicted.

    I’m only referring to WELL-BEHAVED applications.  This happens even if the test windows are just notepad and calc windows.  These aren’t special topmost ones or anything else.

    Does anyone know if there’s setting I obliviously tweaked that screwed me over? Any idea how to fix this problem?

  393. JP says:

    I just recently noticed that one of my XP machines i acting in a very frustrating manner. Normally, if you minimize an application and then press alt-tab, that application is the last one on the list. This has been the behavior forever and still is on my laptop. However, on my desktop it now puts the minimized app in SECOND position. This means if I minimize an app and hit alt-tab, I’m back at the minimized app. Turns out to be a very useless way of doing things. I’ve found several other unanswered reports in usenet and on blogs from other people with the same problem. I also have another person at my office so afflicted. Nothing is different service pack wise or anything else.  Does anyone know if there’s setting I obliviously tweaked that screwed me over? Any idea how to fix this problem?

    I’m only referring to WELL-BEHAVED applications.  This happens even if the test windows are just notepad and calc windows.  These aren’t special topmost ones or anything else.

  394. Andy says:

    In Windows XP, synchronizing the clock when your date is set incorrectly fails citing a security risk:

    "An error occurred while Windows was synchronizing with time.windows.com. For security reasons, Windows cannot synchronize with the server because your date does not match. Please fix the date and try again."

    I’m interested to hear what this security risk is.

  395. Robert May says:

    Is there any good reason that a groupbox is implemented as part of the "Button" class rather than part of the "Static" class.

  396. Robert May says:

    Is there any penalty to pay for using WS_CLIPSIBLINGS when the sibling windows are not overlapping?

  397. How about a reminder that while most widget classes work fine by toggling their WS_DISABLED style with SetWindowLong(), Edit controls in particular won’t change their visual state unless they are altered via EnableWindow(). Edit controls act disabled, but don’t look disabled. I suspect it has to do with EnableWindow() sending WM_ENABLE and SetWindowLong() not doing so, but it can trap people who aren’t paying attention.

    I think I filed a suggestion on MSDN2.microsoft.com’s suggestion box to advise people not to fiddle with the WS_DISABLED flag at runtime via SetWindowLong() since it seems like a viable route if you don’t know otherwise.

    Here’s someone else who ran into it:

    http://www.codeguru.com/forum/showthread.php?t=55945

  398. J-F says:

    A friend was asking why non-admin in XP could be easier, such as installers automatically prompting for admin credential (even I forget to do Run as manually, many times). I found out even any file can be renamed to "setup.exe" and it will bring up the "Install program as other user" dialog.

    What reason was it made that only files name "setup.exe" brought up a Run as dialog, and isn’t there any code or API to do with without naming it "setup.exe"?

  399. Yuhong Bao says:

    Do you know that the Novell behavior described in "Not all short filenames contain a tilde" came from HPFS? The LONG namespace in NetWare originally were called the OS2 namespace, and so it emulated HPFS. It was only renamed to the the LONG namespace because the Windows 95 client used the OS2 namespace to support LFNs.

  400. powerbib@hotmail.com says:

    Hello Raymond,

    I made an application which creates a splash screen on a secondary thread while the main thread loads data. I create and then destroy this splash screen window just before creating and displaying the main window.

    I noticed that my main window is not shown correctly after destroying the splash window. I noticed that the app kind of looses the ‘foreground’ and is actually shown behind other windows. I went throught the MSDN doc and found that calling SetForegroundWindow() makes it work. If I comment out the code for the splash screen creation/destruction, the main window is always shown correctly.

    Is there an explanation for this behavior?

    Thanks

  401. PT says:

    Can you give a time ? I investigated the partition type for FAT32 on MBR (Master Boot Record, located on sector 0 of disk).  Some partition set it to 0x0C but, some one set it to 0x0B. The ResKit for XP describes why two values exists, supporting for BIOS INT 13h extension for 0x0C. however, other document, for example, BSD OS, describes supporting CHS for 0x0B, LBA for 0x0C. Furture more, Windows 95 picks 0x0C for some removable disk when formatting, while Windows XP set 0x0B for them.  what reason does exist in behind of these curious two partition type values and behavior ?

  402. Achaemenes says:

    Hello!  It is interestig site. Keep working!

    soma 350

    cheap soma

    cheap phone cards

    Thanks!

  403. Achates says:

    Hello!  It is interestig site. Keep working!

    soma 350

    cheap soma

    cheap phone cards

    Thanks!

  404. Francisco Moraes says:

    Hello, Raymon.

    I am trying to connect to a remote computer from a service with WNetAddConnection2W. It works if I run the code from the command line or if the service logs in as a user. When running under the LocalSystem account, the WNetAddConnection2W returns the error ERROR_NO_SUCH_LOGON_SESSION.

    I guess the problem is that LocalSystem doesn’t really have a full account on the system and that’s causing the failure as I know that the user/password supplied are correct.

    Francisco

  405. Accius says:

    Hello!  It is interestig site. Keep working!

    soma 350

    cheap soma

    cheap phone cards

    Thanks!

  406. winhelp says:

    I’d love to know why winhelp.exe has disappeared from Vista: there are plenty of applications still using it, and in 32-bit Vista there’s still support for 16-bit applications where it’s the only option. (Plus some applications prefer to use it to stay compatible with Windows 95).

    What really strikes me it that Vista’s installation size is about 5 GB, and all-winhelp-related stuff if less then 1 MB. It’s not a component that is loaded permanently, it’s not kernel mode, it’s not a liability, it wouldn’t cause "support cost". Enlighten me on the reasons for its removal, please :)

  407. Markello says:

    Thank you.nice site! orderpaxil

  408. properdon says:

    Thank you.nice site! paxil tankless preventive

  409. Alexis says:

    Very useful and interesting site, thanks!

  410. MattCho says:

    What about an overview of the AVICAP*.dll?  

  411. Josh says:

    In XP and 2000, if you run as non-admin and run a file specifically named "setup.exe", it will bring up the Run as dialog. I thought there was an API to bring up that dialog in case non-admin users wanted to install a program, so it would automatically prompt.

    But it turns out that dialog only appears because of the fact that a file is named "setup.exe". Even a blank text file renamed to setup.exe would trigger it. Do you know anything behind this design quirk?

  412. //@ says:

    How about you guys fix the toolbar bugs and its ability to lock menu and/or the app.

    As the simplest example, set your mouse over a toolbar button, right click and hold it, left click, move over to another button and keep holding that right button, left click on another button etc.. Do you see it?

    Try this on IE or WordPad or many other apps such as winzip, your apps, your cousin’s apps, chose your lick :).

    In most cases you will be very lucky to have the menu available but in some instances you must change focus to another app to get your command bar back.

    Guess what? Office and VS.NET don’t have this problem mostly because they popup a context menu or similar but still:

    My OS and I feel pretty embarassed about this feature, for a long time now.

    M _

  413. Andy Visser says:

    On LockWindowUpdate.  I’ve found that the start bar seems to behave like it may be using this call incorrectly.  I put my start bar on the left hand side of the screen.  When I try to resize the bar (dragging its edge left and right), the system tray will dynamically move icons (based on tray width), seemingly disregarding the lock.  The rest of the bar waits until MouseUp to redraw.

    What gives?

  414. Yuhong Bao says:

    Why not implement delay-loading by having a flag in the import entry

    specifying that Windows should mimic the Windows 3.1 behavior for

    resolving that import?

  415. Twisted Combo says:

    I read this article, how to set the combobox height.

    https://blogs.msdn.com/oldnewthing/archive/2006/03/10/548537.aspx

    But how do I *get* the dropped down height?

  416. Sahab Yazdani says:

    I was wondering why a Console Window doesn’t get visual styles like other Windows. In Windows XP, all other windows will have a Luna style border (or Royale in MCE), but the Console Windows (cmd.exe, command.com, Application Consoles, etc.) will have Windows classic borders. I believe this has been a happening since Windows 95 (i.e. if you use WindowBlinds on a Win95 – WinXP system, it will be able to take control of drawing for all windows except consoles). Not sure about the behaviour under 2003 and Vista since I haven’t used those ones yet.

    Or maybe a deeper question: Why can’t Console Windows be hooked using the SetWindowsHookEx and family of functions?

  417. Arno Schoedl says:

    Just a little OT, but given all the problems with backward compatibility Microsoft is facing, could not a lot of it be solved by simply declaring (via manifest?) the earliest and latest version of Windows a program has been tested to run on? I understand that there are a few redistributables which have separate versioning, but the Windows version certainly covers the largest part of API differences. Windows could then change its behavior according to what the application expects, and Microsoft would be freeer to change things around in new versions, because the new stuff does not have to seamlessly fit with the old stuff. I recently had a case where obviously a feature, which I now happen to need, has not been fully implemented out of fear of breaking old code, a fact confirmed by the MS developer who did the feature.

  418. Unknown says:

    Hello!  It is informative interesting site!

    carisoprodol cheapes

    carisoprodol discount

    Thanks!

  419. Unknown says:

    Hello!  It is informative interesting site!

    carisoprodol cheapest

    carisoprodol discount

    Thanks!

  420. ... says:

    Very nice site! Good work.

  421. pcooper says:

    Tell us more about the Archive of Computers that you mentioned in the story on the dead Alpha server

  422. Dirk Declercq says:

    Can you explain what’s the (historical) reason

    that the origin of a client-area (default without transforamtion) is at the upper-left corner and not at the lower-left corner ?

  423. Jonathan Wilson says:

    Can you explain the reason why the "hide file extensions for known file types" setting exists (and is still turned on by default, even now)?

  424. Dean Earley says:

    Why is there a "current directory" AND an current drive?

    Why not merge them?

    I have to set both the dir and drive if i want a specific working dir.

  425. Unknown says:

    Hello!  It is nice, interesting site!

    abc internet tv

  426. CreateProcessEx says:

    What is "CreateProcessEx()"?

  427. Jeff Bean says:

    On the Page Setup common dialog the Printer button is hidden on Windows Vista. I am referring to the button that appeared on the bottom right of the page setup dialog in earlier versions of Windows — see this URL in the MSDN library: http://msdn2.microsoft.com/en-us/library/ms646962.aspx

    Why was the button hidden?

    The Page Setup dialog isn’t used by a lot of applications — most use the Printer Setup dialog instead. But it is used by Wordpad and by my application of course (otherwise I wouldn’t be writing this).

    The button wasn’t actually removed, just hidden. They forgot to remove the ampersand from the button text when they hid it, so you can actually still operate the hidden button by entering Alt-P.

    My application has a customized version of the Page Setup dialog. I used a customized dialog because I needed to add two or three new controls and also needed to remember the margin settings for more printers than just the default printer. With the printer button gone, the user is no longer able to set the margins for anything but the default printer. I was able to work around this by creating a second Printer button with a different control ID that is placed exactly underneath the normal Printer button in our customized dialog. When Vista hides the normal Printer button my second button is revealed.

  428. I’m doing a lot of work on multiple selection in a tree and have noticed that ctrl+click and shift+click behave differently in the MS Tree Control and Windows Explorer.

    Shift takes affect on left button down whereas Ctrl takes affect on left button up. Further Ctrl takes affect if you start a drag operation. That is, it behaves as if left button up occurred.

    I’m curious if there is a particular reason for the difference in behaviour here and if I should be emulating this in my custom written tree control.

    I’ve looked in my somewhat dated "The Windows Interface" guidelines book and others and so far haven’t found anything helpful re. multiple selection.

    PS. Thoroughly enjoyed the Podcast with Scott Hanselman.

  429. Norman Diamond says:

    I’m going to ask a bunch of questions here, but I think each one is valid.  I can’t find any of the answers in MSDN, and even an answer to one doesn’t make answers to others obvious.

    Unless failures occur, the DialogBox function doesn’t return until the new dialog’s DialogProc calls EndDialog.  It starts its own message loop.  During this time the hwndParent (i.e. owner not parent) window is disabled.  However, disabling doesn’t prevent delivery of some kinds of messages to the parent window’s WindowProc or DialogProc, and doesn’t prevent delivery of any messages to the application’s main message loop, right?  So aren’t there two or more message loops running in parallel?

    If the application’s main message loop gets a message, calls IsDialogMessage, and gets TRUE back, then the result is the same as if the dialog’s message loop got the message and handled it, right?  Well, sometimes, right?

    Now, suppose the application’s main message loop calls GetMessage and/or PeekMessage with different parameters than a dialog’s message loop does.  Then won’t the results sometimes be scrambled?

    Can we know if a dialog’s message loop gets WM_TIMER messages?  I can’t find the answer to this in MSDN.  If the application’s main message loop calls GetMessage to pick off WM_TIMER and calls IsDialogMessage, but the dialog’s message loop does things differently, can’t the results get scrambled?  Now sure there are better ways to do timers, such as CreateWaitableTimer if we don’t have to run on Windows CE, but the example still stands.

    When a DialogProc calls DialogBox, as far as I can tell, all three message loops (main, first dialog, and second dialog) might all get some kinds of messages.  So doesn’t the first DialogProc have to call IsDialogMessage to find out if the message really belonged to the second dialog?

    Can the first DialogProc call GetMessage to pick off WM_TIMER, call IsDialogMessage to let the second dialog handle it but ignore (or maybe act on) the result, and then finally handle the message that the first dialog’s message loop handed to it in the parameters to DialogProc?

    MSDN states what these APIs do and I am not handing invalid parameters to them, so these are not relying on undocumented behaviour.  But these stunts smell pretty bad and I’m not sure they’re relying on documented behaviour either.  MSDN doesn’t say yes and doesn’t say no.

  430. Courtney Mewton says:

    One thing I have always been curious about is the titlebar of the command prompt in XP.  It seems that the icon folks updated the command prompt icon in Windows XP to have the newer luna-theme titlebar and red “close” button, but the actual titlebar used by the program is different to the XP “luna” titlebar.  Is there an interesting tale to tell behind the command prompt titlebar?

    [Dup. -Raymond]
  431. littleguru says:

    Why does the End Now button (that’s in the dialog that’s shown on an application that Windows thinks it’s hung) not kill the process immediately?

  432. ac says:

    Why was context help (aka "Whats this?") removed from vista, this was a very useful feature

  433. Frank Jacobs says:

    I would like to suggest a topic on Windows "low-level console I/O." Specifically, I’m curious about the lack of an API for listening to low-level console I/O events such as user input or characters written to the screen.

    For example, it is difficult to write a Command Prompt replacement since there appears to be no way to receive these events. The SourceForge project Console (http://sourceforge.net/projects/console/) has gotten around this problem by using a polling technique. This technique appears to be the only option if one wishes to implement a Command Prompt replacement. However, polling won’t always work reliably if the events come in significantly more quickly then the one’s polling interval. Being able to listen for these events instead of having to poll would be more reliable.

    If you have any comments, insight, or history on  Windows low-level console I/O, I’d love to hear it. Thanks so much for your daily posts — it is something to look forward to every day!

    More discussion on what I’m talking about can be found here: http://homepages.tesco.net/~J.deBoynePollard/FGA/capture-console-win32.html

  434. Chrissy says:

    Hello Raymond,

    I just read your article titled "Determining what is frequently used" in TechNet magazine. I have observed what seems to be a bias towards Microsoft products, especially in older versions of Windows. Can you confirm one way or the other?

  435. Jim Mack says:

    How about a non-Windows — but still geekish — question or two?

    What do international dialing codes (you know, like +44 for UK) have to do with Huffman coding?

    In a similar vein, the original US telephone area codes were partly assigned so as to keep similar (confusable) codes from serving adjacent areas.  But some of the codes have an additional assignment property which has since been rendered obsolete. Once you know what it is, it’s obvious what rendered it obsolete.

  436. James Risto says:

    Is there a way to change the behavior of the CMD.EXE window? I don’t know if this falls under your "shell" category. I would like to add a status line.

  437. webcyote says:

    In "Dynamic Link Library Data" (http://msdn2.microsoft.com/en-us/library/ms682594.aspx) there’s a note at the bottom that says __declspec(thread) fails when using LoadLibrary unless you’re running Vista. Vista "fixes" __declspec(thread) by giving each DLL its own copies of TLS variables declared using __declspec(thread), whereas 95/NT4/2000/XP/2003 share all variables (that is, the EXE and all DLL files get only one shared set instead of each having their own set). Programs that depend upon the old behavior will break in Vista; what happened to backward compatibility?

  438. WikiServerGuy says:

    @Norman Diamond

    Well, I try to answer a couple…

    So aren’t there two or more message loops running in parallel?

    From my understanding, just the one DialogBox uses. I.E. it is blocking and no other message loops are running.

    If the application’s main message loop gets a message, calls IsDialogMessage, and gets TRUE back, then the result is the same as if the dialog’s message loop got the message and handled it, right?  Well, sometimes, right?

    Except the DialogBox loop doesn’t call IsDialogMessage for your own dialogs – it is a known issue that are articles for. Generally you need to setup a windows hook and call IsDialogMessage there for your own dialogs if you are going to show more than one top-level one so that they can handle tab key entries etc.

    @James Risto

    Here are couple links that probably answer your question:

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true

    (This one seems to be down, but you can still see the google cache for it etc.)

    obieda.com/blog/2007/03/29/making-cmdexe-act-more-like-a-linux-shell/

  439. WikiServerGuy says:

    @Myself

    Except the DialogBox loop doesn’t call IsDialogMessage for your own dialogs

    I meant except for the DialogBox uses of course :). Applies to MessageBox etc. as well…

  440. KJK::Hyperion says:

    Raymond, could you shed some light on Get/SetMessageExtraInfo? It’s almost like nobody on earth used them, ever, and I can’t get some sample code

  441. David Walker says:

    Regarding IsBadReadPtr and IsBadWritePtr: I jsut read this:

    "In earlier Windows versions, the IsBadReadPtr and IsBadWritePtr functions were used to validate parameters. These functions are now banned on Windows Vista and Windows Server Codename "Longhorn."

    Also, applications that rely on Windows components using these functions to validate parameters will find that Windows no longer uses them.

    Applications should not rely on Windows to do any parameter validation (a check for null is done and the application fails if it is a bad pointer)."

    From http://msdn2.microsoft.com/en-us/library/aa480152.aspx

  442. Greg Williams says:

    I’m curious about using TrackMouseEvent for hover tracking while responding to a DoDragDrop interactions in a TreeView.  My suspicion is that DoDragDrop monopolizes the window so that a WM_MOUSEHOVER message is never posted, so it won’t end up being useful.

  443. Nektar says:

    Could you comment on how the remaining time displayed to the user when performing a file operation in Explorer, e.g. copying, is calculated and why many times it seems to me to be unreliable, i.e. the time jumps from 5 mins to 30 secs and back to 2 mins and it is usually wrong?

    [Old topic. -Raymond]
  444. Tanveer Badar says:

    I have two questions.

    This one has already been asked. Why does "hide file extensions for known file types" exist in the first place? I have seen many people (both users and dumb programmers) bitten by this when they try to open the file they see without any extension?

    Secondly, file/directory property dialog has an advanced button, on that dialog there are two check boxes if the file system is ntfs, one for encryption and one for compression. But ntfs supports either compressing a file/directory or encrypting a file/directory at a time. Why not have two radio buttons instead of these silly check boxes?

  445. Yuhong Bao says:

    On the topic of GlobalWire:

    GlobalWire in Windows 3.x often returned memory in the first megabyte. In Windows 95, this changed.

  446. Emil T says:

    One of my favorite shortcut features in windows formfields is Ctrl+Backspace. Which deletes the word to the left of the cursor.

    But in some cases it doesn’t work, and it inserts some control character instead. Particularly the “password edit”!

    What’s the deal with that?

    [Response. -Raymond]
  447. David Walker says:

    You can’t get something for nothing…

    I was reminded of this again recently.  One of my office computers is a SQL development machine.  It runs a SQL server and not much else.  I rarely use it directly (from the keyboard), but sometimes I do.

    I was mucking around in the SQL server settings, and saw the option to "Boost SQL Server priority".  This makes the SQL server session run at priority "High".  

    I thought this change would magically make the SQL queries run faster on that machine.  No, the only effect was to make actually using that machine from the keyboard, painfully slow, since the interactive session (and almost everything else except SQL) is at normal priority.

    The SQL queries on that machine generally have almost 100% of the cycles on that machine anyway, since nothing else runs there.

    I was trying to circumvent the laws of physics, I think, by keeping interactive sessions fast while making SQL queries faster.  Heck, why not set everything to high priority?

  448. S says:

    What happened to the return code from WinMain in a Windows 3.1 app? (GetExitCodeProcess() didn’t exist in 3.x days)

  449. mzygmunt says:

    Hi Raymond,

    It is maybe not a suggestion but a kind of a question I think you may know how to answer it.

    I am particulary interested in a way to implement "multiple focuses" (like: one person is working on one application /ex. notepad/ and the second /remote/ can help the first person during his/her work but without interrupting him/her).

    What I am trying to do is to simulate two or more focuses on one desktop and doing this not by using SendInput (which changes application focus) but just simulating "actions" by sending plain messages using SendMessage/PostMessage directly to the control/window I want.

    I can do this with keystrokes and HTCLIENT region but I am not able to simulate WM_NCLBUTTONDOWN.

    Can you tell us maybe how SendInput is internally implemented that we can use it to simulate only part of the actions (like without accuiring focus) ?

    Thanks you,

    Michal Zygmunt

  450. 4134uwzoa9 says:

    zy9jgajy48jvj excf732qvtym889kd mjo1kzw86l1eihv uv1uh0ast26

  451. 4134uwzoa9 says:

    zy9jgajy48jvj mjo1kzw86l1eihv uv1uh0ast26

  452. Nektar says:

    Is there a historic or compatibility reason for not being able to use the spacebar for selecting check boxes and radio button elements in a menu. Currently I need to press enter and the menu closes. This makes selecting multiple menu items, e.g. enabling multiple toolbars, more difficult than it should, since the user needs to enter and re-enter the menu and navigate to the correct spot for every check box or radio button element that he/she needs to select.

  453. Anonymous says:

    Maybe you need to repeat a blog posting about this:

    http://kernelmustard.com/2007/04/05/dtm-install-has-a-button-whacker/

  454. KTamas says:

    A historic question: where does the feature come from that lets you copy-paste the content of a messagebox? Was it for debugging? or something else? It’s just kinda weird :)

    [Alas I don’t know either… -Raymond]
  455. Ane says:

    If you have a string such as test:string? in the clipbard and you are renaming a file and you try paste it, the usual warning about invalid characters pops up (OK), but the clipbard’s contents are destroyed in the process (the invalid characters are removed from the clipbard too!). Why does this happen?

  456. Bezalel says:

    How does Windows determine what the capabilities of an optical drive are?

  457. Raymond,

    I bought your book 6 month ago and now it exhibits a peculiar bug: newer articles of interest to me don’t show up in it ;-P

    Nice selection for the book.

    -Vlad

  458. meh says:

    The search function returns results from the old weblogs.asp.net address (try searching for ‘PulseEvent’, for example). Replacing it with blogs.msdn.com works just fine, as the archive URLs are apparently the same.

  459. Myria says:

    I found a bug in AddVectoredExceptionHandler that came up when I tried to debug why the memset() in my handler was corrupting the stack.

    When an exception occurs, KiUserExceptionDispatcher does not clear the direction flag.  RtlCallVectoredExceptionHandlers calls the vectored handlers while in this state.  Because the Windows x86-32/64 ABI requires that the direction flag be cleared before calling a function, compilers inline a "rep stosd" for memset() without bothering to clear the direction flag first.

    The exception that triggered my handler was inside a call to memmove() that happened to be doing a forward move by copying backward.  The direction flag was still set while in the exception handler.  The inlined "rep stosd" therefore went backward and clobbered other variables on the stack.

    This was fixed in Vista – KiUserExceptionDispatcher’s first instruction on x86-32 and x86-64 is now "cld".  __except_handler* in the CRT already had a "cld" presumably for the same reason with normal exception handlers.

    This isn’t a UI topic, but it still might be interesting for this journal.

  460. Lately seen on The Old New Thing: I want to see your blog stats.

  461. Nett zu lesen mit welchen Anfragen Microsoft zu tun hat: Does the Windows XP Add/Remove Programs control panel expose a scriptable object model? We want our program to open the Add/Remove Programs control panel and uninstall the programs of our compe

Comments are closed.