Showing results for Code - The Old New Thing

Nov 18, 2011
Post comments count0
Post likes count0

Why does Internet Explorer not call DLL_PROCESS_DETACH on my DLL when I call ExitProcess?

Raymond Chen
Raymond Chen

A customer asked a question, but as is often the case, the question was much more telling than the answer. We have an Internet Explorer plug-in which calls to force Internet Explorer to exit. We found that when we do this, our plug-in does not receive a notification. What could be preventing our plug-in from receiving the notification? As w...

Code
Nov 16, 2011
Post comments count0
Post likes count0

How can I tell whether a COM pointer to a remote object is still valid?

Raymond Chen
Raymond Chen

A customer asked the rather suspicious question, "How do I check whether a pointer is valid in another process?" This question should make your head boggle with bewilderment. First of all, we've moved beyond to . Second of all, what the heck are you doing with a pointer in another process? You can't do anything with it! After some back-and-fort...

Code
Nov 4, 2011
Post comments count0
Post likes count0

How do I generate a unique 32-bit value for a time zone?

Raymond Chen
Raymond Chen

Public Service Announcement: Daylight Saving Time ends in most parts of the United States this weekend. Other parts of the world may change on a different day from the United States. A customer asked the following question: Given two structures, I would like to compute a for each that I can then compare to determine whether they represent t...

CodeTime
Nov 3, 2011
Post comments count0
Post likes count0

We've traced the call and it's coming from inside the house: A function call that always fails

Raymond Chen
Raymond Chen

A customer reported that they had a problem with a particular function added in Windows 7. The tricky bit was that the function was used only on very high-end hardware, not the sort of thing your average developer has lying around. The customer reported that the function always failed with error 122 () even though the buffer seems perfectl...

Code
Oct 28, 2011
Post comments count0
Post likes count0

Why isn't my transparent static control transparent?

Raymond Chen
Raymond Chen

A customer reported that their application uses transparent static controls positioned over a bitmap image control, but even though they set the Transparent property on the static control, the static control isn't transparent. The customer was kind enough to provide clear steps to illustrate the problem: Open Visual Studio 2005 or 2008. From the...

Code
Oct 26, 2011
Post comments count0
Post likes count0

How can I get notified when some other window is destroyed?

Raymond Chen
Raymond Chen

A customer wanted to know whether there was a method (other than polling) to monitor another window and find out when it gets destroyed. The goal was to automate some operation, and one of the steps was to wait until some program closed its XYZ window before moving on to the next step. Finding the XYZ window could be done with a , but since the wi...

Code
Oct 21, 2011
Post comments count0
Post likes count0

The PSN_SETACTIVE notification is sent each time your wizard page is activated

Raymond Chen
Raymond Chen

A customer had received a number of crashes via Windows Error Reporting and believed that they had found a bug in the tree view common control. In our UI, we have a tree view with checkboxes. The tree view displays a fixed item at the top, followed by a variable number of dynamic items. When the user clicks Next, we look at the tree view to de...

Code
Oct 19, 2011
Post comments count0
Post likes count0

Why do some infotips repeat the name of the item as well as the infotip?

Raymond Chen
Raymond Chen

A customer noticed that when the user hovered over their application name in the Start menu, the infotip that pops up includes their product name: ... but no other program on the Start menu included the product name in the description: The customer compared their shortcut with the other ones but couldn't find anything that was telling Explorer,...

CodeTips/Support
Oct 13, 2011
Post comments count0
Post likes count0

How do I set an accessible name on an unlabeled control?

Raymond Chen
Raymond Chen

A customer asked for advice on accessibility. This was great news, because it meant that somebody actually cared about accessibility! We have a property sheet page that contains an unlabeled list view. The list view is not labeled because its meaning is implied by its placement on the dialog. This works great as long as you can see the screen, bu...

Code
Oct 12, 2011
Post comments count0
Post likes count0

Is there a 2048 character limit for OFN_ALLOWMULTISELECT in MFC or isn't there?

Raymond Chen
Raymond Chen

The MFC documentation for contains the following strange warning: When the user allocates their own buffer to accommodate , the buffer can't be larger than 2048 or else everything gets corrupted (2048 is the maximum size). The sudden informality of the phrase "or else everything gets corrupted" is surprising but also sounds vaguely familiar to...

Code