The Old New Thing

Waiting until the dialog box is displayed before doing something

Last time, I left you with a few questions. Part of the answer to the first question was given in the comments, so I'll just link to that. The problem is more than just typeahead, though. The dialog box doesn't show itself until all message traffic has gone idle. If you actually ran the code presented in the original message, you'd find ...

Things you already know: How do I wait until my dialog box is displayed before doing something?

One customer wanted to wait until the dialog box was displayed before displaying its own dialog box. (Personally, I think immediately displaying a doubly-nested dialog box counts as starting off on the wrong foot from a usability standpoint, but let's set that issue aside for now.) The customer discovered that displaying the nested dialog box...

Allocating and freeing memory across module boundaries

I'm sure it's been drilled into your head by now that you have to free memory with the same allocator that allocated it. matches , matches , matches . But this rule goes deeper. If you have a function that allocates and returns some data, the caller must know how to free that memory. You have a variety of ways of accomplishing this. One is...

Philosophical discussion on when to mark a method as virtual

When should you mark a method as virtual? This question has both a technical and a philosophical aspect. The technical aspect is well-understood: You mark a method as virtual if you want calls to the method to be invoked on the run-time type of the invoked object rather than on the compile-time type of the invoking reference. But there is a ...

Const pointers: Logical consequences

Consider this follow-up question to the question from last time: When I call the function, can I assume that the field of the structure will not be modified? If we take a look at the declaration of the function, we see that it reads like this: Go past all the function declaration specification goo and look at the parameter list. It...

You already know what your target architecture is (or at least you should)

Sometimes the questions I see make me shake my head in wonderment. How do I determine programmatically what processor architecture my program was compiled for? I want the x86 version of my program to behave differently from the ia64 version. Is there some API I can call? Note that this person isn't asking whether the program is running ...