Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,094 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,599 people online right now. Registration is fast and FREE... Join Now!




gdi+ error in windows service

 
Reply to this topicStart new topic

gdi+ error in windows service

prabhat003
22 Nov, 2007 - 03:40 AM
Post #1

New D.I.C Head
*

Joined: 22 Nov, 2007
Posts: 1


My Contributions
Will anyone please help me in starting windows service.
Can we run a windows service into a network drive?Is the network path
accessible via service?
I have written a code on windows service using c#.net.It takes the screenshot every 5seconds.It works well in my computer and saves the screenshot in the given path.But when I give the path to save the .jpeg file taken as a screenshot within the network,its shows the exception "A generic error occurred in GDI+." Can there be a solution for this exception?
Thank u.
If code is also required then the main part to take screenshot is below:


int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmp = new Bitmap(screenWidth, screenHeight, PixelFormat.Format32bppArgb);
Graphics gfx = Graphics.FromImage((Image)bmp);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));

string filename = @"\\202.79.41.205\common\path\" + Environment.MachineName + "--" + getipaddress() + "--" + DateTime.Now.ToString().Replace(":", "").Replace(@"/", "") + ".jpeg";
bmp.Save(filename);
bmp.Dispose();
gfx.Dispose();








This post has been edited by prabhat003: 22 Nov, 2007 - 08:55 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 08:23PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month