Showing results for Code - The Old New Thing

May 9, 2005
Post comments count0
Post likes count0

Developing a Chinese/English dictionary: Introduction

Raymond Chen
Raymond Chen

The other day, one of my colleagues mentioned that his English name "Ben" means "stupid" in Chinese: 笨/bèn/ㄅㄣˋ. (His wife is Chinese; that's why he knows this in the first place.) Knowing that the Chinese language is rich in homophones, I fired up my Chinese/English dictionary program to see if we could find anythin...

Code
May 6, 2005
Post comments count0
Post likes count0

How to query properties of the taskbar

Raymond Chen
Raymond Chen

Occasionally, people want to query properties of the taskbar. I don't quite understand why; you should just get on with your life and let the taskbar get on with its life. After all, there might not even be a taskbar, as we discussed last time. But if you really want to know (perhaps you're collecting usability data), here's how: This little...

Code
May 5, 2005
Post comments count0
Post likes count1

How do I cover the taskbar with a fullscreen window?

Raymond Chen
Raymond Chen

For some reason, people think too hard. If you want to create a fullscreen window that covers the taskbar, just create a fullscreen window and the taskbar will automatically get out of the way. Don't go around hunting for the taskbar and poking it; let it do its thing. As always, start with the scratch program and add the following: Note th...

Code
Apr 29, 2005
Post comments count0
Post likes count0

Building a dialog template at run-time

Raymond Chen
Raymond Chen

We've spent quite a bit of time over the past year learning about dialog templates and the dialog manager. Now we're going to put the pieces together to do something interesting: Building a dialog template on the fly. What we're going to write is an extremely lame version of the function. Why bother writing a bad version of something that Wind...

Code
Apr 26, 2005
Post comments count0
Post likes count0

Thread messages are eaten by modal loops

Raymond Chen
Raymond Chen

Thread messages (as generated by the function) do not go anywhere when passed to the function. This is obvious if you think about it, because there is no window handle associated with a thread message. has no idea what to do with a message with no associated window. It has no choice but to throw the message away. This has dire consequences ...

Code
Apr 25, 2005
Post comments count0
Post likes count0

What is the HINSTANCE passed to SetWindowsHookEx used for?

Raymond Chen
Raymond Chen

The function accepts a parameter. The documentation explains that it is a handle to the DLL containing the hook procedure. Why does the window manager need to have this handle? It needs the handle so it knows which DLL to load into each process when the hook fires. It injects the DLL you pass, then calls the function you pass. Clearly the fu...

Code
Apr 22, 2005
Post comments count0
Post likes count0

The new scratch program

Raymond Chen
Raymond Chen

I think it's time to update the scratch program we've been using for the past year. I hear there's this new language called C++ that's going to become really popular any day now, so let's hop on the bandwagon! The basic idea of this program is the same as our old scratch program, but now it has that fresh lemony C++ scent. Instead of keeping ou...

Code