大家好, 我想在另一台计算机上安装我的程序。我的目标是将图像保存到文件中以便以后使用。但图像没有被保存。
Hello all, I want to install my program on another computer. My aim is saving an image to a file for using later. But the image isn't being saved.
image.Save(Application.StartupPath + "\\" + "data" + "\\" + "config" + "\\" + "Choosen.bmp");(Application.StartupPath = C:\Program Files(x86)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\成为该行之后的目录中的图像。当我从解决方案执行代码时它可以工作,但是当我在另一台计算机上设置程序时它不起作用。我用InstallShield编写了te setup项目。我检查了目录(C:\Program Files(x86)\ PT\ My Product Name \ data \ config),它存在。我添加了我在解决方案项目中用于设置项目的所有dll文件。等待你的帮助。 谢谢
(Application.StartupPath = C:\Program Files (x86)\PT\My Product Name) There has to be an image in the directory after that line. It works when i execute the code from the solution, but it doesn't work when i set the program up on another computer. I prepared te setup project with InstallShield. I checked the directory (C:\Program Files (x86)\PT\My Product Name\data\config) , and it exists. I added all dll files which i used in solution project to setup project. Waiting for your helps. Thanks
推荐答案不,图像不会保存。 在生产中安装应用程序时,它被安装在折叠的Program Files或Program Files(x86)下面的文件夹中 - 默认情况下,这些文件夹都是写保护的,以帮助减少影响特洛伊木马,病毒等等。 所以当你尝试写入它时,你会遇到访问冲突,并且文件不会写在那里。 /> 虽然有可能解决这个问题,但实际上并不推荐 - 并且无法保证在未来的操作系统版本中它不会受到更严格的限制)所以最好的办法是改变存储数据的位置:我应该在哪里存储我的数据? [ ^ ] shou ld help。 No, the image won't save. When you install an application in production, it is installed in a folder below the "Program Files" or "Program Files (x86)" folded - and by default these folders are all write protected to help reduce the impact of Trojans, viruses, and so forth. So when you try to write to it, you get an access violation and the file isn't written there. While it is possible to get round this, it really isn't recommended - and there is no guarantee that it won't get even more restrictive in future releases of the OS) so the best thing to do is to change where you store data: Where should I store my data?[^] should help.
更多推荐
设置安装项目后,代码不起作用。
发布评论