November, 2003

  • The Old New Thing

    Hello Sweden, you're on fire

    • 8 Comments

    (Geek talk resumes on Monday.)

    The longstanding tradition of Norwegians telling Swedish jokes and vice versa, was recently refueled by a border story. A Norwegian man called Sweden on his mobile phone to tell them they had a forest fire. Not only did the firefighters not know about the blaze, they didn't recognize the name of the place on fire.
    Mitt bidrag att försämra diplomatiska förbindelser mellan Sverige och dess grannländer...
  • The Old New Thing

    It's like the Swedes don't want you to learn their language

    • 15 Comments

    (It's a holiday in the States today and tomorrow, so I'm not going to talk about geek stuff. That'll resume on Monday.)

    If you pay a visit to Deutsche Welle, the German international broadcasting service, you will find a wide array of online German learning materials, such as the daily news in slowly- and clearly-enunciated German (including transcripts) and dozens of half-hour mini-documentaries designed for students of German (including transcripts and exercise worksheets). These are great for improving my woefully deficient listening comprehension skills.

    On the other hand, all I could find for students of Swedish is the weekly news in simple Swedish. No transcripts, no lessons. Sure, I can listen to all of the Swedish national radio stations anytime I want, but they sort of assume you're fluent in Swedish.

    And if you go to google and search for "Swedish movies", trust me, the top hits are definitely not the works of Ingmar Bergman. (Yes, I know about IMDB PowerSearch. Now.)
  • The Old New Thing

    Other tricks with WM_GETDLGCODE

    • 8 Comments

    The WM_GETDLCODE message lets you influence the behavior of the dialog manager. A previous entry on using WM_GETDLGCODE described the DLGC_HASSETSEL flag which controls whether edit control content is auto-selected when focus changes.

    I was going to write a bit about the other flags, but it turns out that Knowledge Base Article 83302 already covers this, so I'll just call out some highlights.

    The DLGC_WANTMESSAGE flag is the most powerful one. It lets your control prevent the dialog manager from handling a message. So for example if you don't want ESC to dismiss the dialog box when focus is on a particular control but rather be delivered to the control itself, handle the WM_GETDLGCODE message and peek at the lParam. If it is a press of the ESC key, then return DLGC_WANTMESSAGE so the message will not be handled by the dialog manager.

    The DLGC_WANTCHARS, DLGC_WANTTAB and DLGC_WANTARROWS flags are just conveniences that save you the trouble of checking certain categories of messages.

    As always, consider the consequences of overriding default behavior. Doing so generally makes your program harder to use, since it goes against what people are accustomed to seeing in other programs.
  • The Old New Thing

    What do the letters W and L stand for in WPARAM and LPARAM?

    • 22 Comments

    Once upon a time, Windows was 16-bit. Each message could carry with it two pieces of data, called WPARAM and LPARAM. The first one was a 16-bit value ("word"), so it was called W. The second one was a 32-bit value ("long"), so it was called L.

    You used the W parameter to pass things like handles and integers. You used the L parameter to pass pointers.

    When Windows was converted to 32-bit, the WPARAM parameter grew to a 32-bit value as well. So even though the "W" stands for "word", it isn't a word any more. (And in 64-bit Windows, both parameters are 64-bit values!)

    It is helpful to understand the origin of the terms. If you look at the design of window messages, you will see that if the message takes a pointer, the pointer is usually passed in the LPARAM, whereas if the message takes a handle or an integer, then it is passed in the WPARAM. (And if a message takes both, the integer goes in the WPARAM and the pointer goes in the LPARAM.)

    Once you learn this, it makes remembering the parameters for window messages a little easier. Conversely, if a message breaks this rule, then it sort of makes your brain say, "No, that's not right."
  • The Old New Thing

    A shortcut to the Run dialog

    • 6 Comments

    Here's a little script that opens the Run dialog. You can save it as "Run.js" and double-click it.

    (new ActiveXObject("Shell.Application")).FileRun();
    

    The advantage of this approach over various others people have come up with is that this one is actually documented. (And therefore is less likely to break in the next version of the operating system.)

  • The Old New Thing

    You can drag/drop to the command prompt

    • 17 Comments
    The command prompt is a drop target: Dropping a file onto it inserts the filename.
  • The Old New Thing

    Why isn't Fast User Switching enabled on domains?

    • 30 Comments

    Windows XP added a new feature called Fast User Switching which lets you switch between users without having to log off. But this feature is disabled if your computer is joined to a domain. Why?

    There were several reasons, none of them individually insurmountable, but they added up to quite a lot of work for something IT administrators weren't even sure they wanted. (See a previous entry on retraining costs.)

    • How do you show all the users on the domain in the Welcome screen? You certainly don't want a list with 10,000 names in it. (Scroll scroll scroll.)
    • How do you check whether a user has a password? In Windows XP, the Welcome screen merely tries to log you on with a blank password. If it works, then poof! you're in. If it doesn't work, then it displays the password prompt. This works, but it also generates a failed password event into your security event log. Many IT administrators have a passwork lockout policy, where if you get your password wrong more than N times, your account is locked. Blank password probing would result in locked-out accounts all over the company.

    Those of you who have gotten Longhorn can see that Fast User Switching is now enabled on domains. New infrastructure needed to be developed to enable the feature on domains without ruining the domain administrators' lives.

  • The Old New Thing

    What's the deal with the System Volume Information folder?

    • 53 Comments

    In the root of every drive is a folder called "System Volume Information". If your drive is NTFS, the permissions on the folder are set so not even administrators can get in there. What's the big secret?

    The folder contains information that casual interference could cause problems with proper system functioning. Here are some of the things kept in that folder. (This list is not comprehensive.)

    • System Restore points. You can disable System Restore from the "System" control panel.
    • Distributed Link Tracking Service databases for repairing your shortcuts and linked documents.
    • Content Indexing Service databases for fast file searches. This is also the source of the cidaemon.exe process: That is the content indexer itself, busy scanning your files and building its database so you can search for them quickly. (If you created a lot of data in a short time, the content indexer service gets all excited trying to index it.)
    • Information used by the Volume Snapshot Service (also known as "Volume Shadow Copy") so you can back up files on a live system.
    • Longhorn systems keep WinFS databases here.
  • The Old New Thing

    Notepad's geek options require Word Wrap be disabled

    • 13 Comments
    If you want to use the "Go To" or "Status Bar" options, you have to turn off word warp first. (Word wrap messes with line breaks.)
  • The Old New Thing

    How can I tell if I have the 64-bit edition of Windows?

    • 6 Comments

    Answer: Your wallet is empty.

    Seriously, there is no way you bought an Itanium by mistake. They are expensive machines: The entry-level workstation available from HP (who co-developed the Itanium with Intel) goes for over $3000 and the entry-level server is over $13,000. And in addition to paying for the computer itself, you probably had to install a custom air conditioning system for your building to keep it cool.

    If you still aren't sure whether you have one, go to Help.About in Explorer. At the top of the About box, it will say "Windows XP 64-Bit Edition" if you have it.

Page 1 of 3 (30 items) 123