0

Hi. I made this program to capture the current screen in C#. In Visual Studio 2008, it worked perfectly, but now with VS 2010, I get the following exception: ExternalException - a generic error occured in GDI+ on the line where I save the bitmap:

bmp.Save("screen.jpg");

I have looked everywhere on the Net, but it's always suggested that the problem is in the code. Well it isn't, the code works fine in VS 2008.

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by __avd
0

I found the problem.
I was using bmp.Save("screens\\screen" + n + ".jpg");
(screens is a non-existing folder to be created)
but when I changed it to bmp.Save("screen" + n + ".jpg"); it worked.

When I used this:
System.IO.Directory.CreateDirectory("screens");
bmp.Save("screens\\screen" + n + ".jpg");
it also worked.

Edited by moni94: n/a

0

Please mark this thread as solved if you have found an answer to your question and good luck!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.