管理员

编程入门 行业动态 更新时间:2024-10-09 11:18:39
本文介绍了管理员 - 我该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨...抱歉再次打扰,但这个对我来说很难!! 我的应用程序在c:\program files中有效并保存一些设置,我使用.ini文件,访问此文件,我需要以管理员身份运行我的应用程序。但是,我希望我的应用程序在Windows启动时运行..因为我在StartUp文件夹中安装了一个图标! 现在......问题是如果管理员设置关闭,我的应用程序只能在启动时运行!!! 我该怎么做才能解决这个问题呢? 谢谢! 我尝试了什么: i什么也没试过......我对这一个完全失明......不知道从哪里开始!!!!

解决方案

将.INI或您正在使用的任何设置文件放在适当的文件夹中,例如 CommonApplicationData [ ^ ]。您可以使用 Enivornment.GetFolderPath() [ ^ ]。 一旦你有了这条路径,你就可以在它上面添加你的公司和应用程序文件夹并将你的设置文件存储在那里。

好的我找到了办法

Dim path 作为 字符串 = Directory.GetCurrentDirectory() Dim pathy = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) 如果 My.Computer.FileSystem.FileExists(pathy& \ APP \Settings.ini)然后 Else My.Computer.FileSystem.CopyFile(path& \ Settingtings \Settings.ini,pathy& \ APP \Settings.ini)

感谢无论如何:)

Hi...sorry to bother again but this one is very hard for me!! My app is instaled in "c:\program files" and to save some settings i use a .ini file, to access this file i need to run my app as administrator..however i want my app to run on windows startup..for that i installed an icon in the StartUp folder! Now ... the problem is that my app only runs on startup if the administrator setting is off!!! What can i do to overpass this problem? Thank you! What I have tried: i tried nothing ...i am completely blind on this one..do not know where to start!!!!

解决方案

Put the .INI or whatever settings file you're using in an appropriate folder, like CommonApplicationData[^]. You can get the path to this folder using Enivornment.GetFolderPath()[^]. Once you have that path, you can build on it to add your company and application folders to it and store your settings file in there.

ok i found a way

Dim path As String = Directory.GetCurrentDirectory() Dim pathy = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) If My.Computer.FileSystem.FileExists(pathy & "\APP\Settings.ini") Then Else My.Computer.FileSystem.CopyFile(path & "\Settings\Settings.ini", pathy & "\APP\Settings.ini")

thanks anyway : )

更多推荐

管理员

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

发布评论

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

>www.elefans.com

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