Showing tag results for Code

Sep 5, 2003
Post comments count0
Post likes count0

Where is my program running from?

Raymond Chen
Raymond Chen

Another common question: "How do I find out where my program is? I want to be able to access support files in that same directory." Answer: GetModuleFileName(NULL, ...).

Code
Sep 5, 2003
Post comments count0
Post likes count0

Case mapping on Unicode is hard

Raymond Chen
Raymond Chen

Occasionally, I'm asked, "I have to identify strings that are identical, case-insensitively.  How do I do it?" The answer is, "Well, it depends. Whose case-mapping rules do you want to use?" Sometimes the reply is, "I want this to be language-independent." Now you h...

Code
Sep 2, 2003
Post comments count0
Post likes count0

Determining whether your window is covered

Raymond Chen
Raymond Chen

The method described in the previous coding blog entry works great if you are using the window visibility state to control painting, since you're using the paint system itself to do the heavy lifting for you. To obtain this information outside of the paint loop, use and . The HDC that...

Code
Aug 29, 2003
Post comments count0
Post likes count0

Painting only when your window is visible on the screen

Raymond Chen
Raymond Chen

Sometimes you want to perform an activity, such as updating a status window, only as long as the window is not covered by another window. The easiest way to determine this is by not actually trying to determine it. For example, here's how the taskbar clock updates itself: ...

Code
Aug 27, 2003
Post comments count0
Post likes count1

Why are these unwanted files/folders opening when I log on?

Raymond Chen
Raymond Chen

I get called on frequently to do troubleshooting, so I figure I'd share some entries from my private bag of tricks.  (And there are some remarks for programmers hidden here too.) Problem 1. A folder like opens each time you log on. Reason: Your system contains two ...

CodeTips/Support
Aug 27, 2003
Post comments count0
Post likes count0

What are those little overlay icons?

Raymond Chen
Raymond Chen

Windows XP ships with a number of icon overlays. The black clock is particularly baffling because you sometimes see it even if your system is not equipped with Hierarchical Storage Management. When this happens, it's because some program (typicall...

CodeTips/Support
Aug 26, 2003
Post comments count0
Post likes count0

Rotating the Z-order

Raymond Chen
Raymond Chen

Sometimes you run into a conflict where you need the controls laid out in one Z-order to get hit-testing to work, but need a different order to get keyboard TAB order working. For example, consider this dialog template, which has been simplified for expository purposes. The dial...

Code
Aug 21, 2003
Post comments count0
Post likes count2

The secret life of GetWindowText

Raymond Chen
Raymond Chen

GetWindowText() is more complicated than you think. The documentation tries to explain its complexity with small words, which is great if you don't understand long words, but it also means that you're not getting the full story. Here's an attempt to give the full story. How windows manage the...

Code