Showing tag results for Code

Sep 15, 2003
Post comments count0
Post likes count0

Eric's complete guide to BSTR semantics

Raymond Chen

Eric Lippert has posted Eric's Complete Guide to BSTR Semantics. This is a document that is widely valued within Microsoft, since BSTR semantics are rather tricky, and I'm glad he's willing to share it with the world. In particular, Eric spends quite a bit of time discussion the very important...

Code
Sep 11, 2003
Post comments count0
Post likes count0

Scrollbars part 10 – Towards a deeper understanding of the WM_NCCALCSIZE message

Raymond Chen

When your window is resized, Windows uses the message to determine where your window's client area lives inside your window rectangle. There are two forms of the message. The simple form merely takes a window rectangle and returns a client rectangle. This is useful for resizing a window to h...

Code
Sep 9, 2003
Post comments count0
Post likes count0

Scrollbars part 9 – Maintaining the metaphor

Raymond Chen

When a document is displayed with scrollbars, the metaphor is that the window is a viewport onto the entire document, only a portion of which is visible at the moment. The default behavior of a resize, however, is to maintain the origin at the upper left corner of the client area, which breaks the metaphor when...

Code
Sep 5, 2003
Post comments count0
Post likes count0

Where is my program running from?

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

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

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

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

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