Showing tag results for Code

Jun 28, 2010
Post comments count0
Post likes count0

How do I get a radio button control to render its text transparently?

Raymond Chen
Raymond Chen

Commenter Andrei asks via the Suggestion Box for help with making the text transparent using . "Instead of the radio button now there's a black background." Let's look at this problem in stages. First, let's ignore the transparent part and figure out how to render text without a black background. The background color of the text comes from the ...

Code
Jun 14, 2010
Post comments count0
Post likes count0

Annotating function parameters and using PREfast to check them

Raymond Chen
Raymond Chen

Via the suggestion box, Sys64738 asks, whether I think is a good C/C++ programming style to add IN and OUT to function prototypes. Remember, this is my opinion. Your opinion may validly differ. I would go beyond just IN and OUT and step up to SAL annotations, which describe the semantics of function parameters in more detail than simply IN and ...

Code
Jun 11, 2010
Post comments count0
Post likes count0

How do I indicate that I want my window to follow right-to-left layout rules?

Raymond Chen
Raymond Chen

There are many ways, depending on how wide a scope you want. If there is one specific window that you want to follow right-to-left layout rules, then you pass the extended window style when you create the window. This extended style is inherited by child windows, so once you set a top-level window to have right-to-left layout, all child windows w...

Code
Jun 4, 2010
Post comments count0
Post likes count3

How do I enable and disable the minimize, maximize, and close buttons in my caption bar?

Raymond Chen
Raymond Chen

A customer was having problems with the small icon that appears in the upper left corner of the caption: In my program, I need to enable and disable the Close button programmatically, since the program sometimes goes into a state where I don't want the user to close it. I do this by removing the style when I want to disable the Close button, an...

Code
Jun 1, 2010
Post comments count0
Post likes count0

Why doesn't the Windows Vista copy progress dialog show the names of the files being copied?, redux

Raymond Chen
Raymond Chen

As expected, everybody concluded that the Windows Vista copy progress dialog made every wrong decision possible. Let's look at some of the suggestions on making it suck less: Why not update the file name every five seconds to the file that is being copied at that time? Sure, you could do that, but the cost of getting the name is part of the prob...

Code
May 28, 2010
Post comments count0
Post likes count0

How do I accept files to be opened via IDropTarget instead of on the command line? – bonus content

Raymond Chen
Raymond Chen

One of my colleagues tipped me off to some additional resources on the subject of using the DropTarget technique for accepting files for execution. First, it turns out that there is an SDK sample that demonstrates the DropTarget technique after all. This sample is fifteen years late according to one commenter who apparently thinks that the Plat...

Code
May 28, 2010
Post comments count0
Post likes count0

Every window with the WS_SYSMENU style has a system menu, but it's not there until it needs to be

Raymond Chen
Raymond Chen

I mentioned last time that there's an optimization in the treatment of the system menu which significantly reduces the number of menus in the system. When a window has the window style, it has a system menu, but until somebody calls on that window, nobody knows what its menu handle is. Until that point, the window manager doesn't actually have ...

Code
May 27, 2010
Post comments count0
Post likes count0

When will the window manager destroy a menu automatically, and when do I need to do it manually?

Raymond Chen
Raymond Chen

Our old friend Norman Diamond wonders when you are supposed to destroy a menu and when you are supposed to let Windows destroy it. The rules for when the window manager implicitly destroys menus are actually not that complicated. Outside of the above situations, you are on your own. Of course, when I write that "you are on your own" I do ...

Code
May 26, 2010
Post comments count0
Post likes count0

How do I find the bounding box for a character in a font?

Raymond Chen
Raymond Chen

A customer had the following question: I'm looking for a way to get the height of text which consists entirely of digits, for example , as these characters do not have any descent or internal leading. I expected functions like to return the character's ascent minus the internal leading, but in fact it returns the ascent plus the descent plus t...

Code