Showing tag results for Code

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
Oct 10, 2011
Post comments count0
Post likes count0

How do I access a file without updating its last-access time?

Raymond Chen
Raymond Chen

The first problem with discussing file last-access time is agreeing what you mean by a file's last-access time. The file system folks have one definition of the file last-access time, namely the time the file was most recently opened and either read from or written to. This is the value retrieved by functions like , , and . The problem with th...

Code
Oct 7, 2011
Post comments count0
Post likes count0

During process termination, slim reader/writer locks are now also electrified

Raymond Chen
Raymond Chen

Some time ago I mentioned that during process termination, the gates are now electrified: If you attempt to enter a critical section that is owned by a thread that was terminated by an earlier phase of process termination, the entire process is forcibly terminated. Windows Vista introduced a new lightweight synchronization pseudo-object known as ...

Code
Oct 3, 2011
Post comments count0
Post likes count0

Do not access the disk in your IContextMenu handler, no really, don't do it

Raymond Chen
Raymond Chen

We saw some time ago that the number one cause of crashes in Explorer is malware. It so happens that the number one cause of hangs in Explorer is disk access from context menu handlers (a special case of the more general principle, you can't open the file until the user tells you to open it). That's why I was amused by Memet's claim that "w...

Code