Help!!

I fairly new to VB and have just got this one problem to solve to finish my application.

The problem is I dont want the program to do its stuff when its active. So I need a piece of code to check which application has focus before I do my thing.

Any ideas?

Thanks
Che