The Old New Thing

The oft-misunderstood /3GB switch

It's simple to explain what it does, but people often misunderstand. The /3GB switch changes the way the 4GB virtual address space is split up. Instead of splitting it as 2GB of user mode virtual address space and 2GB of kernel mode virtual address space, the split is 3GB of user mode virtual address space and 1GB of kernel mode virtual...

Never leave focus on a disabled control

One of the big no-no's in dialog box management is disabling the control that has focus without first moving focus somewhere else. When you do this, the keyboard becomes dead to the dialog box, since disabled windows do not receive input. For users who don't have a mouse (say, because they have physical limitations that confine them to the ...

Why .shared sections are a security hole

Many people will recommend using shared data sections as a way to share data between multiple instances of an application. This sounds like a great idea, but in fact it's a security hole. Proper shared memory objects created by the CreateFileMapping function can be secured. They have security descriptors that let you specify which users ...

Spammers look stupid when they don’t read the blog they spam on

Yesterday, I got a 419 scam via the contact form. This is a new low for spam stupidity. You'd think people who blog are more likely to be aware of Internet scams because they're reading the news, are clearly more comfortable with technology, and often make fun of news stories about 419 scammers. But if you're for real, I have this to...

The company picnic, sponsored by Microsoft

Robert Scoble blogs from the Microsoft company picnic. Although he writes, "Microsoft holds a picnic for its employees every year," this suggests that the picnic is organized by Microsoft. It isn't. The company picnic is run by a professional company picnic company. They also do the Alaska Airlines company picnic, and ...

How to set focus in a dialog box

Setting focus in a dialog box is more than just calling SetFocus. A dialog box maintains the concept of a "default button" (which is always a pushbutton). The default button is typically drawn with a distinctive look (a heavy outline or a different color) and indicates what action the dialog box will take when you hit Enter. Note that this ...

When should you use a sunken client area?

The WS_EX_CLIENTEDGE extended window style allows you to create a window whose client area is "sunken". When should you use this style? The Guidelines for User Interface Developers and Designers says in the section on the Design of Visual Elements that the sunken border should be used "to define the work area within a window...

Disabling the program crash dialog

If you don't want your program to display the standard crash dialog, you can disable it by setting the SEM_NOGPFAULTERRORBOX flag in the process error mode. The simple-minded way is just to do but this overwrites the previous error mode rather than augmenting it. In other words, you inadvertently turned off the other error modes! ...