Showing tag results for Code

Aug 31, 2006
Post comments count0
Post likes count0

The dialog class goes under the sneaky name WC_DIALOG

Raymond Chen
Raymond Chen

An anonymous commenter wanted to know how to create a dialog box with . The window class for dialog boxes is . I'm not quite sure why anybody would want to create a dialog box this way, but there you have it.

Code
Aug 28, 2006
Post comments count0
Post likes count2

Try to avoid having BOOL function parameters

Raymond Chen
Raymond Chen

Generally speaking, I believe that you should try to avoid giving functions a boolean parameter (, , etc.) unless the meaning of that boolean parameter is blatantly obvious. Examples of obvious meaning would be the second parameter to the function ( obviously means the window is being enabled and means that it's being disabled) and the final para...

Code
Aug 23, 2006
Post comments count0
Post likes count1

Environment variable expansion occurs when the command is read

Raymond Chen
Raymond Chen

On the command line (and in batch files), environment variable expansion occurs when the command is read. This sounds obvious at first, but it has its own consequences. In the online documentation for , one such consequence is spelled out: would never display the message, since the in both "" statements is substituted when the first "" state...

Code
Aug 22, 2006
Post comments count0
Post likes count0

Who says there's only one? There can be more than one logon session

Raymond Chen
Raymond Chen

An extension of the "What if two programs did this?" thought experiment is the "Who says there's only one?" question. A common question I see is, "From a service, how do I do X with the currently logged-on user?" (Where "X" can be a variety of things such as interact with them or impersonate them.) But who says that there's only one? With the int...

Code
Aug 21, 2006
Post comments count0
Post likes count0

Sucking the exception pointers out of a stack trace

Raymond Chen
Raymond Chen

Often, you find yourself staring at a stack trace for a caught exception and want to see the original exception. (You too can get symbols for operating system binaries, either by using the symbol server to get the symbols on-demand or, if you have a gigabyte of disk space, you can download symbol packages to get them all at one go. Even if yo...

Code
Aug 17, 2006
Post comments count0
Post likes count0

Don't trust the return address, no really

Raymond Chen
Raymond Chen

In the discussion of how to prevent non-"trusted" DLLs from using private OS resources, more than one person suggested having the or function behave differently depending on who the caller is. But we already saw that you can't trust the return address and that you definitely shouldn't use the return address to make a security decision (which i...

Code
Aug 16, 2006
Post comments count0
Post likes count0

Accessibility is not just for people with disabilities

Raymond Chen
Raymond Chen

When the topic of accessibility comes up, most people think it's all about people with disabilities. While it's true that people with disabilities were the original target audience for accessibility, more recent developments have highlighted the value of accessible technologies to everyone. For one thing, making your program accessible means that ...

Code
Aug 15, 2006
Post comments count0
Post likes count0

Do not change program semantics in the debug build

Raymond Chen
Raymond Chen

What you don't want is a problem that goes away when you debug it. It is expected that a program have additional debugging code inside blocks. After all, that's why it's a debug build. But what you definitely don't want to do is have that debugging to fundamentally change the program's behavior. You can perform additional validation. You can ra...

Code