在文件夹下建立desktop.ini
具体看http://www.xianyusoft.com/article/list.asp?articleid=1872

解决方案 »

  1.   

    在文件夹下建立desktop.ini
    Desktop.ini 有一定的格式,如
    [.ShellClassInfo]
    IconFile=IconFile 'IconFile 是含有图标的文件。
    IconIndex=0 '图标在文件中的索引,0为第一个。还有将文件夹的属性改为系统属性。下面是一个读取,写入INI文件的模块。Option ExplicitDeclare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As Any, ByVal lpFileName As String) As Long
    Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long
    Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
    Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As LongFunction ReadWriteINI(FName As String, Mode As String, tmpSecname As String, tmpKeyname As String, Optional tmpKeyValue) As String
    Dim tmpString As String
    Dim FileName As String
    Dim secname As String
    Dim keyname As String
    Dim keyvalue As String
    Dim anInt
    Dim defaultkey As StringOn Error GoTo ReadWriteINIError
    If IsNull(Mode) Or Len(Mode) = 0 Then
      ReadWriteINI = "ERROR MODE"
      Exit Function
    End If
    If IsNull(tmpSecname) Or Len(tmpSecname) = 0 Then
      ReadWriteINI = "ERROR Secname"
      Exit Function
    End If
    If IsNull(tmpKeyname) Or Len(tmpKeyname) = 0 Then
      ReadWriteINI = "ERROR Keyname"
      Exit Function
    End If
    FileName = FName
      If UCase(Mode) = "WRITE" Then
          If IsNull(tmpKeyValue) Or Len(tmpKeyValue) = 0 Then
            ReadWriteINI = "ERROR KeyValue"
            Exit Function
          Else
          
          secname = tmpSecname
          keyname = tmpKeyname
          keyvalue = tmpKeyValue
          anInt = WritePrivateProfileString(secname, keyname, keyvalue, FileName)
          End If
      End If
      If UCase(Mode) = "GET" Then
      
          secname = tmpSecname
          keyname = tmpKeyname
          defaultkey = "Failed"
          keyvalue = String$(50, 32)
          anInt = GetPrivateProfileString(secname, keyname, defaultkey, keyvalue, Len(keyvalue), FileName)
          If Left(keyvalue, 6) <> "Failed" Then
             tmpString = keyvalue
             tmpString = RTrim(tmpString)
             tmpString = Left(tmpString, Len(tmpString) - 1)
          End If
          ReadWriteINI = tmpString
      End If
    Exit Function
    ReadWriteINIError:
       MsgBox Error
       Stop
    End Function
      

  2.   

    to  huangguanshu() 好东西真多啊