Search the
msdn library for "focus window" and "flash window".
(you can also start by searching the script forums, as both APIs are already several times used and talked about).
sorry for not giving you a straitstraight answer, but... well you know... The msdn libary is the first thing to search in cases like this, and the search is very strait forward and easy. The above searches will give you the answer in seconds/minutes with a bit of reading.