文件管理 · 2022年8月17日

vb设置mdf文件权限|VB设置文件或文件夹的访问限权

① vb 6.0中的权限设置怎么写

权限是一个中小型以上的软件必须考虑的问题。不管是什么语言写权限的方式是多样灵活的。针对VB而言我建议初学者还是用DB和类模块结合来做。在服务器端我们建立数据库用户表的时候,就应该多建立一个权限字段,标记他是什么样的权限或者说明。在软件里初始化界面的时候我们可以通过窗体传值、后台服务,或者是检索服务器数据库表来判断权限分配。就效率和速度而言,后台服务绝对是最快的,窗体传值其次,最慢的是查数据库找用户权限。难易程度肯定正好相反。VB不能做服务底层,但是可以写类模块。从最简单的写法说起,在类模块里,我们引用ADO(不是窗体控件,要ADO库)查询数据库写成带参数的函数,参数是控件ID,公布函数,每次初始化对象调用函数,查询权限,初始化也用函数初始化,这样的办法重复做查询数据库的事情,影响程序运行效率,但是很常用。比如VB做分辨率初始化、管理员初始化都是这么写的。最简单老土的办法是窗体传值,就是在登陆事件中就把权限查出来,在窗体上建立一个文本框为例,事件响应在验证通过后,把权限信息赋值文本框,文本框隐藏起来。其他的窗体Form_Load的时候都要去判断一下 登陆窗体.Text1 的值进行初始化他的界面,哪些该用哪写不该用,就要你一个一个写判断过程了,代码绝对比第一种麻烦,老是写同样的代码,比起刚才写类模块就麻烦在这里。VB6.0界面上的控件不要单独建立,比如你要建立text控件,就建立一个作为复制依据放在窗体其他部位,设计好了后可以把他处理掉,设计的时候复制他创建控件组,这样你的控件就是一个有规律的控件,可以给控件规则,如Text1(0),Text1(1) 他的Index值是变量,Text1事件中写权限就统一设计好了所有Text1(Index)的权限,这是一个技巧。第二就是你要用虚方法,窗体名称和按钮或者控件之间要建立联系。比如按钮的Caption值可以和窗体名称是一样的,这样你就可以通过点击按钮去打开窗体,按钮是控件组,打开窗体就有了权限。如:If 登陆窗体.Adodc1.Recordset.Fields("权限")=“普通用户" ThenMsgBox("对不起,你没有权限…")ElseDim Fro as Form '定义一个抽象窗体对象Set Fro = Forms.Add(按钮(Index).Caption)Fro.ShowEnd If窗体上的所有按钮分为一级按钮、二级按钮、三级按钮,复制建立他们,就是:一级按钮(0),一级按钮(1) ….二级按钮(0) ………点一级按钮是个怎样的事件你写一下,二级按钮是个怎么样的事件你也写一下….,学过C++的人很容易理解,就是个宏事件。其实你也没必要建立那么多窗体去切换界面,完全可以用Frame,Frame也用控件组,切换到哪个Frame的时候初始化一下界面就OK了,没切换到全部隐藏,Frame就象窗体界面一样独立容器,设计好以后你就把他拉到最小放一边,隐藏起来,全部设计完毕,窗体就靠一个一个初始化Frame来做界面切换,很是美观,也方便,因为方法可以直接用类来写了。楼主有疑问可以发个实例,邮箱留下

② vb.net,如何设置/读取 某用户 对 某文件夹 的访问权限

不建议用在应用程序中操作共享文件或共享文件夹,这个东西往往会把软件做得过于死板。

③ vb和sql数据库权限设置介绍

SQL是Structured Quevy Language(结构化查询语言)的缩写。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。在使用它时,只需要发出“做什么”的命令,“怎么做”是不用使用者考虑的。SQL功能强大、简单易学、使用方便,已经成为了数据库操作的基础,并且现在几乎所有的数据库均支持SQL。 ##1 二、SQL数据库数据体系结构 SQL数据库的数据体系结构基本上是三级结构,但使用术语与传统关系模型术语不同。在SQL中,关系模式(模式)称为“基本表”(base table);存储模式(内模式)称为“存储文件”(stored file);子模式(外模式)称为“视图”(view);元组称为“行”(row);属性称为“列”(column)。名称对称如^00100009a^: ##1 三、SQL语言的组成 在正式学习SQL语言之前,首先让我们对SQL语言有一个基本认识,介绍一下SQL语言的组成: 1.一个SQL数据库是表(Table)的集合,它由一个或多个SQL模式定义。 2.一个SQL表由行集构成,一行是列的序列(集合),每列与行对应一个数据项。 3.一个表或者是一个基本表或者是一个视图。基本表是实际存储在数据库的表,而视图是由若干基本表或其他视图构成的表的定义。 4.一个基本表可以跨一个或多个存储文件,一个存储文件也可存放一个或多个基本表。每个存储文件与外部存储上一个物理文件对应。 5.用户可以用SQL语句对视图和基本表进行查询等操作。在用户角度来看,视图和基本表是一样的,没有区别,都是关系(表格)。 6.SQL用户可以是应用程序,也可以是终端用户。SQL语句可嵌入在宿主语言的程序中使用,宿主语言有FORTRAN,COBOL,PASCAL,PL/I,C和Ada语言等。SQL用户也能作为独立的用户接口,供交互环境下的终端用户使用。 ##1 四、对数据库进行操作 SQL包括了所有对数据库的操作,主要是由4个部分组成:1.数据定义:这一部分又称为“SQL DDL”,定义数据库的逻辑结构,包括定义数据库、基本表、视图和索引4部分。 2.数据操纵:这一部分又称为“SQL DML”,其中包括数据查询和数据更新两大类操作,其中数据更新又包括插入、删除和更新三种操作。 3.数据控制:对用户访问数据的控制有基本表和视图的授权、完整性规则的描述,事务控制语句等。 4.嵌入式SQL语言的使用规定:规定SQL语句在宿主语言的程序中使用的规则。 下面我们将分别介绍: ##2 (一)数据定义 SQL数据定义功能包括定义数据库、基本表、索引和视图。 首先,让我们了解一下SQL所提供的基本数据类型:(如^00100009b^) 1.数据库的建立与删除 (1)建立数据库:数据库是一个包括了多个基本表的数据集,其语句格式为: CREATE DATABASE <数据库名> 〔其它参数〕 其中,<数据库名>在系统中必须是唯一的,不能重复,不然将导致数据存取失误。〔其它参数〕因具体数据库实现系统不同而异。 例:要建立项目管理数据库(xmmanage),其语句应为: CREATE DATABASE xmmanage (2) 数据库的删除:将数据库及其全部内容从系统中删除。 其语句格式为:DROP DATABASE <数据库名> 例:删除项目管理数据库(xmmanage),其语句应为: DROP DATABASE xmmanage 2.基本表的定义及变更 本身独立存在的表称为基本表,在SQL语言中一个关系唯一对应一个基本表。基本表的定义指建立基本关系模式,而变更则是指对数据库中已存在的基本表进行删除与修改。

④ vc或vb编程如何打开mdf数据文件

这是SQL数据库文件安装SQL2000或更高版本附加数据库用ADO组件来连接希望能帮到你

⑤ VB中设置目录权限

'////'为文件夹添加新用户'添加到标准模块中:Option ExplicitPublic Const GMEM_MOVEABLE = &H2Public Const LMEM_FIXED = &H0Public Const LMEM_ZEROINIT = &H40Public Const LPTR = (LMEM_FIXED + LMEM_ZEROINIT)Public Const GENERIC_READ = &H80000000Public Const GENERIC_ALL = &H10000000Public Const GENERIC_EXECUTE = &H20000000Public Const GENERIC_WRITE = &H40000000' The file/security API call constants.' Refer to the MSDN for more information on how/what these constants' are used for.Public Const DACL_SECURITY_INFORMATION = &H4Public Const SECURITY_DESCRIPTOR_REVISION = 1Public Const SECURITY_DESCRIPTOR_MIN_LENGTH = 20Public Const SD_SIZE = (65536 + SECURITY_DESCRIPTOR_MIN_LENGTH)Public Const ACL_REVISION2 = 2Public Const ACL_REVISION = 2Public Const MAXDWORD = &HFFFFFFFFPublic Const SidTypeUser = 1Public Const AclSizeInformation = 2' The following are the inherit flags that go into the AceFlags field' of an Ace header.Public Const OBJECT_INHERIT_ACE = &H1Public Const CONTAINER_INHERIT_ACE = &H2Public Const NO_PROPAGATE_INHERIT_ACE = &H4Public Const INHERIT_ONLY_ACE = &H8Public Const INHERITED_ACE = &H10Public Const VALID_INHERIT_FLAGS = &H1FPublic Const DELETE = &H10000' Structures used by our API calls.' Refer to the MSDN for more information on how/what these' structures are used for.Type ACE_HEADER AceType As Byte AceFlags As Byte AceSize As IntegerEnd TypePublic Type ACCESS_DENIED_ACE Header As ACE_HEADER Mask As Long SidStart As LongEnd TypeType ACCESS_ALLOWED_ACE Header As ACE_HEADER Mask As Long SidStart As LongEnd TypeType ACL AclRevision As Byte Sbz1 As Byte AclSize As Integer AceCount As Integer Sbz2 As IntegerEnd TypeType ACL_SIZE_INFORMATION AceCount As Long AclBytesInUse As Long AclBytesFree As LongEnd TypeType SECURITY_DESCRIPTOR Revision As Byte Sbz1 As Byte Control As Long Owner As Long Group As Long sACL As ACL Dacl As ACLEnd Type' API calls used within this sample. Refer to the MSDN for more' information on how/what these APIs do.Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As LongDeclare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As LongDeclare Function LookupAccountName Lib "advapi32.dll" Alias "LookupAccountNameA" (lpSystemName As String, ByVal lpAccountName As String, sid As Any, cbSid As Long, ByVal ReferencedDomainName As String, cbReferencedDomainName As Long, peUse As Long) As LongDeclare Function InitializeSecurityDescriptor Lib "advapi32.dll" (pSecurityDescriptor As SECURITY_DESCRIPTOR, ByVal dwRevision As Long) As LongDeclare Function GetSecurityDescriptorDacl Lib "advapi32.dll" (pSecurityDescriptor As Byte, lpbDaclPresent As Long, pDacl As Long, lpbDaclDefaulted As Long) As LongDeclare Function GetFileSecurityN Lib "advapi32.dll" Alias "GetFileSecurityA" (ByVal lpFileName As String, ByVal RequestedInformation As Long, ByVal pSecurityDescriptor As Long, ByVal nLength As Long, lpnLengthNeeded As Long) As LongDeclare Function GetFileSecurity Lib "advapi32.dll" Alias "GetFileSecurityA" (ByVal lpFileName As String, ByVal RequestedInformation As Long, pSecurityDescriptor As Byte, ByVal nLength As Long, lpnLengthNeeded As Long) As LongDeclare Function GetAclInformation Lib "advapi32.dll" (ByVal pAcl As Long, pAclInformation As Any, ByVal nAclInformationLength As Long, ByVal dwAclInformationClass As Long) As LongPublic Declare Function EqualSid Lib "advapi32.dll" (pSid1 As Byte, ByVal pSid2 As Long) As LongDeclare Function GetLengthSid Lib "advapi32.dll" (pSid As Any) As LongDeclare Function InitializeAcl Lib "advapi32.dll" (pAcl As Byte, ByVal nAclLength As Long, ByVal dwAclRevision As Long) As LongDeclare Function GetAce Lib "advapi32.dll" (ByVal pAcl As Long, ByVal dwAceIndex As Long, pace As Any) As LongDeclare Function AddAce Lib "advapi32.dll" (ByVal pAcl As Long, ByVal dwAceRevision As Long, ByVal dwStartingAceIndex As Long, ByVal pAceList As Long, ByVal nAceListLength As Long) As LongDeclare Function AddAccessAllowedAce Lib "advapi32.dll" (pAcl As Byte, ByVal dwAceRevision As Long, ByVal AccessMask As Long, pSid As Byte) As LongPublic Declare Function AddAccessDeniedAce Lib "advapi32.dll" (pAcl As Byte, ByVal dwAceRevision As Long, ByVal AccessMask As Long, pSid As Byte) As LongDeclare Function SetSecurityDescriptorDacl Lib "advapi32.dll" (pSecurityDescriptor As SECURITY_DESCRIPTOR, ByVal bDaclPresent As Long, pDacl As Byte, ByVal bDaclDefaulted As Long) As LongDeclare Function SetFileSecurity Lib "advapi32.dll" Alias "SetFileSecurityA" (ByVal lpFileName As String, ByVal SecurityInformation As Long, pSecurityDescriptor As SECURITY_DESCRIPTOR) As LongDeclare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)Public Sub SetAccess(sUserName As String, sFileName As String, lMask As Long)Dim lResult As Long ' Result of various API calls. Dim I As Integer ' Used in looping. Dim bUserSid(255) As Byte ' This will contain your SID. Dim bTempSid(255) As Byte ' This will contain the Sid of each ACE in the ACL . Dim sSystemName As String ' Name of this computer system. Dim lSystemNameLength As Long ' Length of string that contains ' the name of this system. Dim lLengthUserName As Long ' Max length of user name. 'Dim sUserName As String * 255 ' String to hold the current user ' name.Dim lUserSID As Long ' Used to hold the SID of the ' current user. Dim lTempSid As Long ' Used to hold the SID of each ACE in the ACL Dim lUserSIDSize As Long ' Size of the SID. Dim sDomainName As String * 255 ' Domain the user belongs to. Dim lDomainNameLength As Long ' Length of domain name needed. Dim lSIDType As Long ' The type of SID info we are ' getting back. Dim sFileSD As SECURITY_DESCRIPTOR ' SD of the file we want. Dim bSDBuf() As Byte ' Buffer that holds the security ' descriptor for this file. Dim lFileSDSize As Long ' Size of the File SD. Dim lSizeNeeded As Long ' Size needed for SD for file.Dim sNewSD As SECURITY_DESCRIPTOR ' New security descriptor. Dim sACL As ACL ' Used in grabbing the DACL from ' the File SD. Dim lDaclPresent As Long ' Used in grabbing the DACL from ' the File SD. Dim lDaclDefaulted As Long ' Used in grabbing the DACL from ' the File SD. Dim sACLInfo As ACL_SIZE_INFORMATION ' Used in grabbing the ACL ' from the File SD. Dim lACLSize As Long ' Size of the ACL structure used ' to get the ACL from the File SD. Dim pAcl As Long ' Current ACL for this file. Dim lNewACLSize As Long ' Size of new ACL to create. Dim bNewACL() As Byte ' Buffer to hold new ACL. Dim sCurrentACE As ACCESS_ALLOWED_ACE ' Current ACE. Dim pCurrentAce As Long ' Our current ACE. Dim nRecordNumber As Long' Get the SID of the user. (Refer to the MSDN for more information on SIDs ' and their function/purpose in the operating system.) Get the SID of this ' user by using the LookupAccountName API. In order to use the SID ' of the current user account, call the LookupAccountName API ' twice. The first time is to get the required sizes of the SID ' and the DomainName string. The second call is to actually get ' the desired information. lResult = LookupAccountName(vbNullString, sUserName, _ bUserSid(0), 255, sDomainName, lDomainNameLength, _ lSIDType) ' Now set the sDomainName string buffer to its proper size before ' calling the API again. sDomainName = Space(lDomainNameLength) ' Call the LookupAccountName again to get the actual SID for user. lResult = LookupAccountName(vbNullString, sUserName, _ bUserSid(0), 255, sDomainName, lDomainNameLength, _ lSIDType) ' Return value of zero means the call to LookupAccountName failed; ' test for this before you continue. If (lResult = 0) Then MsgBox "Error: Unable to Lookup the Current User Account: " _ & sUserName Exit Sub End If ' You now have the SID for the user who is logged on. ' The SID is of interest since it will get the security descriptor ' for the file that the user is interested in. ' The GetFileSecurity API will retrieve the Security Descriptor ' for the file. However, you must call this API twice: once to get ' the proper size for the Security Descriptor and once to get the ' actual Security Descriptor information. lResult = GetFileSecurityN(sFileName, DACL_SECURITY_INFORMATION, _ 0, 0, lSizeNeeded) ' Redimension the Security Descriptor buffer to the proper size. ReDim bSDBuf(lSizeNeeded) ' Now get the actual Security Descriptor for the file. lResult = GetFileSecurity(sFileName, DACL_SECURITY_INFORMATION, _ bSDBuf(0), lSizeNeeded, lSizeNeeded) ' A return code of zero means the call failed; test for this ' before continuing. If (lResult = 0) Then MsgBox "Error: Unable to Get the File Security Descriptor" Exit Sub End If ' Call InitializeSecurityDescriptor to build a new SD for the ' file. lResult = InitializeSecurityDescriptor(sNewSD, _ SECURITY_DESCRIPTOR_REVISION) ' A return code of zero means the call failed; test for this ' before continuing. If (lResult = 0) Then MsgBox "Error: Unable to Initialize New Security Descriptor" Exit Sub End If ' You now have the file's SD and a new Security Descriptor ' that will replace the current one. Next, pull the DACL from ' the SD. To do so, call the GetSecurityDescriptorDacl API ' function. lResult = GetSecurityDescriptorDacl(bSDBuf(0), lDaclPresent, _ pAcl, lDaclDefaulted) ' A return code of zero means the call failed; test for this ' before continuing. If (lResult = 0) Then MsgBox "Error: Unable to Get DACL from File Security " _ & "Descriptor" Exit Sub End If ' You have the file's SD, and want to now pull the ACL from the ' SD. To do so, call the GetACLInformation API function. ' See if ACL exists for this file before getting the ACL ' information. If (lDaclPresent = False) Then MsgBox "Error: No ACL Information Available for this File" Exit Sub End If ' Attempt to get the ACL from the file's Security Descriptor. lResult = GetAclInformation(pAcl, sACLInfo, Len(sACLInfo), 2&) ' A return code of zero means the call failed; test for this ' before continuing. If (lResult = 0) Then MsgBox "Error: Unable to Get ACL from File Security Descriptor" Exit Sub End If ' Now that you have the ACL information, compute the new ACL size ' requirements. lNewACLSize = sACLInfo.AclBytesInUse + (Len(sCurrentACE) + _ GetLengthSid(bUserSid(0))) * 2 – 4 ' Resize our new ACL buffer to its proper size. ReDim bNewACL(lNewACLSize) ' Use the InitializeAcl API function call to initialize the new ' ACL. lResult = InitializeAcl(bNewACL(0), lNewACLSize, ACL_REVISION)' A return code of zero means the call failed; test for this ' before continuing. If (lResult = 0) Then MsgBox "Error: Unable to Initialize New ACL" Exit Sub End If ' If a DACL is present, it to a new DACL. If (lDaclPresent) Then ' Copy the ACEs from the file to the new ACL. If (sACLInfo.AceCount > 0) Then ' Grab each ACE and stuff them into the new ACL. nRecordNumber = 0 For I = 0 To (sACLInfo.AceCount – 1) ' Attempt to grab the next ACE. lResult = GetAce(pAcl, I, pCurrentAce) ' Make sure you have the current ACE under question. If (lResult = 0) Then MsgBox "Error: Unable to Obtain ACE (" & I & ")" Exit Sub End If ' You have a pointer to the ACE. Place it ' into a structure, so you can get at its size. CopyMemory sCurrentACE, pCurrentAce, LenB(sCurrentACE) 'Skip adding the ACE to the ACL if this is same usersid lTempSid = pCurrentAce + 8 If EqualSid(bUserSid(0), lTempSid) = 0 Then ' Now that you have the ACE, add it to the new ACL. lResult = AddAce(VarPtr(bNewACL(0)), ACL_REVISION, _ MAXDWORD, pCurrentAce, _ sCurrentACE.Header.AceSize) ' Make sure you have the current ACE under question. If (lResult = 0) Then MsgBox "Error: Unable to Add ACE to New ACL" Exit Sub End If nRecordNumber = nRecordNumber + 1 End If Next I ' You have now rebuilt a new ACL and want to add it to ' the newly created DACL. lResult = AddAccessAllowedAce(bNewACL(0), ACL_REVISION, _ lMask, bUserSid(0)) ' Make sure added the ACL to the DACL.If (lResult = 0) Then MsgBox "Error: Unable to Add ACL to DACL" Exit Sub End If 'If it's directory, we need to add inheritance staff. If GetAttr(sFileName) And vbDirectory Then ' Attempt to grab the next ACE which is what we just added. lResult = GetAce(VarPtr(bNewACL(0)), nRecordNumber, pCurrentAce) ' Make sure you have the current ACE under question. If (lResult = 0) Then MsgBox "Error: Unable to Obtain ACE (" & I & ")" Exit Sub End If ' You have a pointer to the ACE. Place it ' into a structure, so you can get at its size. CopyMemory sCurrentACE, pCurrentAce, LenB(sCurrentACE) sCurrentACE.Header.AceFlags = OBJECT_INHERIT_ACE + INHERIT_ONLY_ACE CopyMemory ByVal pCurrentAce, VarPtr(sCurrentACE), LenB(sCurrentACE) 'add another ACE for files lResult = AddAccessAllowedAce(bNewACL(0), ACL_REVISION, _ lMask, bUserSid(0)) ' Make sure added the ACL to the DACL. If (lResult = 0) Then MsgBox "Error: Unable to Add ACL to DACL" Exit Sub End If ' Attempt to grab the next ACE. lResult = GetAce(VarPtr(bNewACL(0)), nRecordNumber + 1, pCurrentAce) ' Make sure you have the current ACE under question. If (lResult = 0) Then MsgBox "Error: Unable to Obtain ACE (" & I & ")" Exit Sub End If CopyMemory sCurrentACE, pCurrentAce, LenB(sCurrentACE) sCurrentACE.Header.AceFlags = CONTAINER_INHERIT_ACE CopyMemory ByVal pCurrentAce, VarPtr(sCurrentACE), LenB(sCurrentACE) End If' Set the file's Security Descriptor to the new DACL. lResult = SetSecurityDescriptorDacl(sNewSD, 1, _ bNewACL(0), 0) ' Make sure you set the SD to the new DACL. If (lResult = 0) Then MsgBox "Error: " & _ "Unable to Set New DACL to Security Descriptor" Exit Sub End If ' The final step is to add the Security Descriptor back to ' the file! lResult = SetFileSecurity(sFileName, _ DACL_SECURITY_INFORMATION, sNewSD) ' Make sure you added the Security Descriptor to the file! If (lResult = 0) Then MsgBox "Error: Unable to Set New Security Descriptor " _ & " to File : " & sFileName MsgBox Err.LastDllError Else MsgBox "Updated Security Descriptor on File: " _ & sFileName End If End If End IfEnd Sub'添加到窗体中的代码:Option ExplicitPrivate Sub Command1_Click() Dim sUserName As String Dim sFolderName As String sUserName = Trim$(CStr(Text2.Text)) sFolderName = Trim$(CStr(Text1.Text)) SetAccess sUserName, sFolderName, GENERIC_READ Or GENERIC_EXECUTE Or DELETE Or GENERIC_WRITEEnd SubPrivate Sub Command2_Click() Dim sUserName As String Dim sFolderName As String sUserName = Trim$(Text2.Text) sFolderName = Trim$(Text1.Text) SetAccess sUserName, sFolderName, GENERIC_EXECUTE Or GENERIC_READEnd SubPrivate Sub Form_Load() Text1.Text = "enter folder name" Text2.Text = "enter username" Command1.Caption = "Change" Command2.Caption = "Read && Add"End Sub

⑥ vb中权限设置问题

在数据库中设置,建立一个Table。包含登录用户,权限的字符串,假如有四个模块:A,B,C,D设置这四个模块的权限,例如 用户=‘USER1’权限的字符串=‘1111’就表示都有权限 权限的字符串=‘0111’就表示user1在A模块中没有权限 以此类推 。至于如何设置的话:你可以在系统登录时候,根据登录的用户名称,读出权限字符串,并以此设置画面中MENU的ENable属性。简单的就是这样了

⑦ VB权限设置问题

先设置权限的初值:PublicConstGroup_User=1PublicConstGroup_App=2PublicConstGroup_Ck=4再添加(或方法)lngPower=lngPowerOrGrUser.Value*Group_User之后再判断PublicFunctionGetGroup(ByValGroup_StatusAsLong,OptionallngPowerAsLong,OptionalpFlagAsBoolean=True)AsBooleanIfpFlagThenlngPower=Val(UserGroup)GetGroup=CBool(lngPowerAndGroup_Status)EndFunction这样写起来好多代码呢欢迎转载,但请保留出处,本文章转自[华软网]原文链接:http://www.huarw.com/program/vb/vb01/200806/1594789.html

⑧ 怎样用vb设置文件夹权限

设置权限的方法:1、随意的到电脑中选择一个文件夹,点击右键,选择属性选项。2、在弹出来的属性窗口中切换到安全这一栏,然后选择最下方的高级。3、在高级设置窗口中,咱们选择所有者,然后点击编辑,最后是确定。4、在名称这一栏中选择所有者,然后将下方的“替换子容器和对象的所有者”勾选上,最后确定退出设置窗口。5、选择当前所有者即可。

⑨ Vb怎么设置用户权限

权限设置比较简单,在数据表设置一个权限字段,你可以使用字符数据即可,例如“一般”是普通用户、“专家”是专家、“管理员”是系统管理员,登录界面可以设置用户名、密码文本框,权限设置下拉框,判断用户名、密码、权限是否正确即可。在登录后将权限存储为程序级变量,即在模块中设置程序级变量,达到主程序界面,获取权限,根据权限,设置菜单的可操作性即可。

⑩ VB设置文件或文件夹的访问限权

Private Sub Command1_Click() Shell "cmd /c cacls.exe c:\a.txt /e /t /p everyone:F"End Sub'c:\a.txt要修改的文件或文件夹,everyone是用户名,F是完全控制,改成N就是拒绝访问,R是读取,W是写入,C是更改