Why are you trying to solve this problem?
I tend to be an Answer Guy. People like to ask me questions about technical things because I like to help them solve problems. It cool because it inflates my ego and gives me an outlet for my chronic intellectualism.
Most of the time, the questions I get are of the “How come doing Ridiculous Thing X doesn’t work?” variety, and while I’m not always quite perfect at recognizing the fact, the first thing I should be doing is to ask “Why are you trying to do this?”
To pick an example, a friend today asked me “Why does calling SetCursorPos() to the center of my window instead move it to its bottom edge?”
We never did figure out what was going on, (I am not as smart as Raymond Chen) but we didn’t need to. Upon asking the fellow why he is doing this, everything snapped into place:
“I’m doing mouselook [for a game].”
Now the solution becomes very simple: instead of trying to rig the mouse up so that it is stuck in the middle of the window, he can just use DirectInput to poll its motion directly.
So, the next time you find yourself banging your head against a hard problem that feels like it should be easy, before you go to your own answer guy, you should ask yourself “Why am I trying to do this?” and reconsider all the assumptions that lead you down the path you’re on.
And if you are still stuck, be sure to let your own Answer Guy know what your goal is, so he can help you figure out what the right problem is.