How to make up a waiting function/subroutine

I need a waiting function/subroutine to wait
a key input or a mouse-down/up event when my program is running. I used a do-loop, but the program refused to display. Could you tell me how to make a waiting function/subroutine?

Thanks in advance.

Ma

Are you using Visual C++ ?