设置安装项目后,代码不起作用。

编程入门 行业动态 更新时间:2024-10-26 10:34:41
本文介绍了设置安装项目后,代码不起作用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我想在另一台计算机上安装我的程序。我的目标是将图像保存到文件中以便以后使用。但图像没有被保存。

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.

更多推荐

设置安装项目后,代码不起作用。

本文发布于:2023-11-16 11:53:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1604048.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   代码   项目

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!