I am attempting to write a program to randomly select images out of a directory and set them as a desktop background. I know windows has a tool to do this, but I thought it would be interesting to it myself.
I was able to set the background without trouble, but when I set it to loop the memory usage climbs every time an image is loaded and set. Using the task manager I was able to determine that the number of GDI Objects is not increasing though. Below is the function I use to import and resize the images.
I had hoped to just put a couple of deletes at the end of the function of the form delete pic;
this however gives me the compile error "cannot convert from Gdiplus::Image to void *"
Any suggestions of how to deal with the memory, or to close the Image objects?