Showing archive results for 2004

Dec 3, 2004
Post comments count0
Post likes count0

Why are documents printed out of order when you multiselect and choose “Print”?

Raymond Chen
Raymond Chen

If you select say five files and then right-click them and choose "Print", they tend to print in a random order. Why is that? The shell invokes the Print verb on each file in turn, and depending on how the program responsible for printing the document is registered, one of several things can happen. These three ways of registering print act...

Other
Dec 2, 2004
Post comments count0
Post likes count1

Why did Windows 95 run the timer at 55ms?

Raymond Chen
Raymond Chen

The story behind the 55ms timer tick rate goes all the way back to the original IBM PC BIOS. The original IBM PC used a 1.19MHz crystal, and 65536 cycles at 1.19MHz equals approximately 55ms. (More accurately, it was more like 1.19318MHz and 54.92ms.) But that just pushes the question to another level. Why 1.19...MHz, then? With that clock rat...

History
Dec 1, 2004
Post comments count0
Post likes count0

What is the purpose of the bmPlanes member of the BITMAP structure?

Raymond Chen
Raymond Chen

Many bitmap-related structures in Windows have a field called "planes". For example the structure has a member (which must be set to 1). The structure has a field called . What's the deal with that field? The EGA video adapter supported 16 simultaneous colors. This was an enormous improvement over the CGA, which supported only four colors. I...

History
Nov 30, 2004
Post comments count0
Post likes count0

What’s the difference between GetKeyState and GetAsyncKeyState?

Raymond Chen
Raymond Chen

I've seen some confusion over the difference between the function and the function. returns the virtual key state. In other words, reports the state of the keyboard based on the messages you have retrieved from your input queue. This is not the same as the physical keyboard state: When should you use and when should you use ? For ...

Code
Nov 29, 2004
Post comments count0
Post likes count0

Why doesn’t the RunAs program accept a password on the command line?

Raymond Chen
Raymond Chen

The RunAs program demands that you type the password manually. Why doesn't it accept a password on the command line? This was a conscious decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure. In other words, the feature is ...

Other
Nov 26, 2004
Post comments count0
Post likes count0

Simple things you can do with the ShellExecuteEx function

Raymond Chen
Raymond Chen

Here's a tiny little program: #include <windows.h> #include <shellapi.h> int __cdecl main(int argc, char **argv) { if (argc == 3) { SHELLEXECUTEINFO sei = { sizeof(sei) }; sei.fMask = SEE_MASK_FLAG_DDEWAIT; sei.nShow = SW_SHOWNORMAL; // added 27 Nov sei.lpVerb = argv[1]; sei.lpFile = argv[2]; ShellExecuteEx...

Code
Nov 24, 2004
Post comments count0
Post likes count0

Why can’t you drop directly onto a taskbar button?

Raymond Chen
Raymond Chen

If you drag a object and drop it onto a taskbar button, you get an error message that says, You cannot drop an item onto a button on the taskbar. However, if you drag the item over a button without releasing the mouse button, the window will open after a moment, allowing you to drop the item inside the window. Why doesn't the taskbar let y...

Other
Nov 23, 2004
Post comments count0
Post likes count0

Why do folders like “My Pictures” come back after I delete them?

Raymond Chen
Raymond Chen

Some people are offended by the special folders like "My Pictures" and "My Music" and delete them, only to find them being re-created. What's going on? Windows itself is okay with you deleting those folders. Some corporations, for example, remove those folders from their employees' machines because they don't want the employees looking at picture...

Code