Q1 [Marks: 10]
How do I handle key presses and key up events in the windows message loop? I need to be able to call two functions OnKeyUp (char c); and OnKeyDown (char c);
Q2 [marks: 10]
I have a list of window handles to top level windows and I want to shift them around so they are arranged in the z-order of my choosing. I started off by iterating the list (with the window I want to end up on top last), calling SetForegroundWindow on each one. This seemed to work some of the time but not always, improving a little when I paused slightly in between each call.
Is there a better way to do this?