Showing tag results for Code

Jan 17, 2014
Post comments count0
Post likes count1

Psychic debugging: Why messages aren't getting processed by your message pump

Raymond Chen

The second parameter to the is an optional window handle that is used to tell the function to retrieve only messages that belong to the specified window. A filtered is nearly always a bad idea, because your program will not respond to messages that don't meet the filter. Unlike a filtered (which simply returns "no messages satisfy the filter...

Code
Jan 13, 2014
Post comments count0
Post likes count1

Creating a listview with checkboxes on some items but not others

Raymond Chen

Today's Little Program creates a listview with checkboxes on some items but not other. The extended style is really just a convenience style. Everything it does you could have done yourself, with a bit more typing. It creates a state image list consisting of an unchecked box (state 1) and a checked box (state 2). You could have done t...

Code
Jan 10, 2014
Post comments count0
Post likes count1

How do I manually recalculate ACLs on a file based on the containing directory?

Raymond Chen

A customer wanted to move a file and have it forget all its old ACLs and instead inherit its ACLs from its new location. They found an old article of mine that said If you use to move a file and pass the flag, then it will not preserve the original ACLs on the moved files but will rather recalculate them from the destination's inheritable prop...

Code
Jan 8, 2014
Post comments count0
Post likes count1

The case of the missing context menu verbs

Raymond Chen

A customer reported that when they right-clicked a batch file, a bunch of commands were missing. For example, Open was gone! Okay, there really isn't much of a story here, because some direct debugging quickly identified the culprit. The customer had installed a third party shell extension which returned a huge value from its method. Explorer t...

Code
Jan 6, 2014
Post comments count0
Post likes count1

How do I obtain the computer manufacturer's name via C++?

Raymond Chen

The way to get the computer manufacturer and other information is to ask WMI. WMI is much easier to use via scripting, but maybe you want to do it from C++. Fortunately, MSDN takes you through it step by step and even puts it together into a sample program. But I'm going to write the code myself anyway. Today's Little Program extracts the c...

Code
Jan 2, 2014
Post comments count0
Post likes count1

If the cursor clip rectangle is a global resource, how come I can't change it with ClipCursor?

Raymond Chen

A customer reported that the function was not working. "The cursor clip rectangle is a shared global resource, so I should be able to change it any time I like. My app installs a global mouse hook and sets the clip cursor inside the hook function, but the change doesn't have any effect. Why can't I change the clip cursor inside a mouse hook?" Sur...

Code
Dec 30, 2013
Post comments count0
Post likes count2

How can I get the list of programs the same way that Programs and Features gets it?

Raymond Chen

A customer wanted to get the list of programs the same way that the Programs and Features folder gets it. Here, here's an idea: Instead of trying to mimic the Programs and Features folder, just ask the Programs and Features folder for its contents! That way, no matter what changes are made to how the Programs and Features folder obtains its cont...

Code