Showing archive results for 2005

Apr 18, 2005
Post comments count0
Post likes count5

What is the HINSTANCE passed to CreateWindow and RegisterClass used for?

Raymond Chen
Raymond Chen

One of the less-understood parameters to the function and the function is the (either passed as a parameter or as part of the structure). The window class name is not sufficient to identify the class uniquely. Each process has its own window class list, and each entry in the window class list consists of an instance handle and a class nam...

Code
Apr 15, 2005
Post comments count0
Post likes count0

News flash: Everybody has to pay income tax

Raymond Chen
Raymond Chen

NFL rookies are required to attend "How not to mess up your life like those other professional athletes" training. They learn about such things as sexual harassment, AIDS, common-law marriage, and, of course, taxes. Kendrell Bell, a Pittsburgh Steelers linebacker, tells of his great awakening to the verities of income tax: "I got a million-dollar...

Non-ComputerNews flash
Apr 15, 2005
Post comments count0
Post likes count0

Tweaking our computation of the interval between two moments in time

Raymond Chen
Raymond Chen

We can take our computation of the interval between two moments in time and combine it with the trick we developed for using the powers of mathematics to simplify multi-level comparisons to reduce the amount of work we impose upon the time/date engine. Observe that we avoided a call to the method (which is presumably rather complicated becau...

Code
Apr 14, 2005
Post comments count0
Post likes count0

Computing the interval between two moments in time

Raymond Chen
Raymond Chen

Computing the interval between two moments in time is easy: It's just subtraction, but subtraction may not be what you want. If you are displaying time units on the order of months and years, then you run into the problem that a month is of variable length. some people just take the value relative to a base date of January 1 and extract the yea...

Code
Apr 13, 2005
Post comments count0
Post likes count0

Using the powers of mathematics to simplify multi-level comparisons

Raymond Chen
Raymond Chen

What a boring title. Often you'll find yourself needing to perform a multi-level comparison. The most common example of this is performing a version check when there are major and minor version numbers involved. Bad version number checks are one of the most common sources of errors. If you're comparing version numbers, you can use the funct...

Code
Apr 12, 2005
Post comments count0
Post likes count0

There's an awful lot of overclocking out there

Raymond Chen
Raymond Chen

A bunch of us were going through some Windows crashes that people sent in by clicking the "Send Error Report" button in the crash dialog. And there were huge numbers of them that made no sense whatsoever. For example, there would be code sequences like this: Yet when we looked at the error report, the and registers were equal! There were othe...

Other
Apr 11, 2005
Post comments count0
Post likes count0

The end of one of the oldest computers at Microsoft still doing useful work

Raymond Chen
Raymond Chen

My building was scheduled for a carpet replacement—in all my years at Microsoft, I think this is the first time this has ever happened to a building I was in—so we all had to pack up our things so the carpeters could get clear access to the floor. You go through all the pain of an office move (packing all your things) but don't get the ...

OtherDead computers
Apr 7, 2005
Post comments count0
Post likes count0

The dialog manager, part 8: Custom navigation in dialog boxes

Raymond Chen
Raymond Chen

Some dialog boxes contain custom navigation that goes beyond what the function provides. For example, property sheets use Ctrl+Tab and Ctrl+Shift+Tab to change pages within the property sheet. Remember the core of the dialog loop: (Or the modified version we created in part 7.) To add custom navigation, just stick it in before callin...

Code
Apr 6, 2005
Post comments count0
Post likes count0

The dialog manager, part 7: More subtleties in message loops

Raymond Chen
Raymond Chen

Last time, we solved the problem with the function by posting a harmless message. Today, we're going to solve the problem in an entirely different way. The idea here is to make sure the modal message loop regains control, even if all that happened were incoming sent messages, so that it can detect that the flag is set and break out of the mod...

Code