Showing tag results for Code

Apr 6, 2009
Post comments count0
Post likes count1

There’s nothing wrong with making bold treeview items

Raymond Chen

Commenter Frans Bouma asks, Why is the text of a treenode chopped off when you switch the font from normal to bold? It apparently is for backwards compatibility but I fail to see why this is necessary for backward compatibility... Actually, bold treeview items work just fine. Watch: Start with our scratch program and make these changes: ...

Code
Mar 30, 2009
Post comments count0
Post likes count1

What is the implementation of WM_PRINTCLIENT?

Raymond Chen

Via the suggestion box, Martin Filteau asks Could you explain the implementation of WM_PRINTCLIENT? It seems that even MS got it wrong in the LISTBOX control. Try to AnimateWindow a window that as a LISTBOX control as a child. The LISTBOX displays correctly if it is NOT empty. However, if it is empty... nothing is drawn. I got a similar ...

Code
Mar 23, 2009
Post comments count0
Post likes count1

What’s the point of the MoveWindow function when we already have SetWindowPos?

Raymond Chen

Commenter Phil Quirk notes via the suggestion box, " is just a weird function. I guess it's easier to call than , but that's the only thing it seems to have going for it." Yup, that's about right. The function doesn't really do anything you couldn't already do yourself with . It's just a convenience function. And it you look at it pretty clos...

Code
Mar 16, 2009
Post comments count0
Post likes count1

Why does the MoveWindow function let you suppress repainting?

Raymond Chen

Commenter Phil Quirk asks via the suggestion box why the function lets you suppress repainting. "Shouldn't the OS be able to figure out if the window needs to be repainted?" Indeed the window manager does do a very nice job of figuring it out if you pass , which is the expected value of the parameter. But if you think you're smarter than the wi...

Code
Mar 9, 2009
Post comments count0
Post likes count1

Why doesn’t the MoveWindow function generate the WM_GETMINMAXINFO message?

Raymond Chen

Commenter Phil Quirk asks why calling does not result in a message being sent to validate the moved window size. Well, because you moved it after all. You're being trusted to respect your own rules. After all, if you didn't want the window to be wider than 200 pixels, you shouldn't have passed , right? The message is for obtaining minimum ...

Code
Mar 5, 2009
Post comments count0
Post likes count1

Fixups are not the same as rewriting code, they’re just fixups

Raymond Chen

Classically speaking, a linker cannot rewrite the code the compiler generated; its job is merely to resolve symbols. Of course, resolving symbols means that references to those symbols in the code generated by the compiler turn from "I don't know" to "Here it is." Somebody named George appeared to be confused by this, believing that all changes by...

Code
Feb 23, 2009
Post comments count0
Post likes count1

Why is there no supported way to get the command line of another process?

Raymond Chen

Commenter Francisco Moraes wonders whether there is a supported way of getting the command line of another process. Although there are certainly unsupported ways of doing it or ways that work with the assistance of a debugger, there's nothing that is supported for programmatic access to another process's command line, at least nothing provided b...

Code
Feb 20, 2009
Post comments count0
Post likes count1

Foreground activation permission is like love: You can’t steal it, it has to be given to you

Raymond Chen

This is the blog entry that acted as the inspiration for the last topic in my 200 PDC talk. When somebody launches a second copy of your single-instance program, you usually want the second copy to send its command line to the first instance (and deal with the current directory somehow), and then you want the first instance to come to the foreg...

Code
Feb 17, 2009
Post comments count0
Post likes count1

Why doesn’t the file system have a function that tells you the number of files in a directory?

Raymond Chen

There are any number of bits of information you might want to query from the file system, such as the number of files in a directory or the total size of the files in a directory. Why doesn't the file system keep track of these things? Well, of course, one answer is that it certainly couldn't keep track of every possible fragment of information ...

Code