The reason you need to make sure you have a try except is because if you run this code on a machine that does not have active desktop support, it will give an error because it does not recognize the dwmask parameter.