Call GdiplusStartup and GdiplusShutdown in each of your func