开发者

Unable to fire process

I have application which loads images like this:

someImage = Image.FromFile(@"picture.png");

and another application which fires the previous one like this:

Process.Start(@"C:\dev\gallery.exe");

and if I do like this I get an Exception: "picture.png", nothing more, 开发者_StackOverflow社区but if I run this first gallery application normally using the icon or cmd then it works ok.

EDIT: I have just noticed that if I put these applications in the same folder then it works properly, why? what I can do then?


Looks like a working directory problem. Try using the Process.Start(ProcessStartInfo) overload with the WorkingDirectory property set properly.


I had a similar problem, but, in a different context. I used to use the command

Image.FromFile(@"picture.png");

twice in my code. Between the two commands the image was supposed to be overwritten. But, it failed. The problem was tracked to the way Image.FromFile works. It does not close the handle of file after reading from it.

I used an workaround posted here to resolve this problem.

Let me know if your issue gets resolved.

Thanks
Vamyip

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜