Jump to content
Fórum Script Brasil
  • 0

Alterar Imagem De Um Diretório E Do Desktop


balduino
 Share

Question

rem função para alterar a imagem de um directorio vista em miniatura

Public sub FolderImg(LocImg As String, DestImg As String, DelIfExist As Boolean)
  Dim YN As VbMsgBoxResult
  On Error GoTo error
  Set fso = New FileSystemObject
  
  DestImg = DestImg & "\Folder.jpg"
  
  If (DelIfExist = True) Then
    If (fso.FileExists(DestImg)) Then
      SetAttr DestImg, vbNormal
      Kill DestImg
    End If
    GoTo img
  ElseIf (DelIfExist = False) Then
    If (fso.FileExists(DestImg)) Then
      YN = MsgBox("Já existe um ficheiro com esse nome no directório especificado." & vbLf & _
                "Deseja eliminar a imagem existente e prosseguir?", vbYesNo)
      If (YN = vbNo) Then
        Exit Function
      ElseIf (YN = vbYes) Then
        SetAttr DestImg, vbNormal
        Kill DestImg
        GoTo img
      End If
    End If
  End If
  fso.CopyFile LocImg, DestImg
  SetAttr DestImg, vbHidden + vbSystem
error:
End sub
rem função para alterar a imagem do desktop

Public sub AlterarDesktop(DesktopImg As String, ImgPos As String, mosaico As String)
  On Error GoTo error
  Set reg = New Registry
  k_root = HKEY_CURRENT_USER
  k_name = "Control Panel\Desktop"
  
  reg.UpdateKey k_root, k_name, "Wallpaper", DesktopImg
  reg.UpdateKey k_root, k_name, "WallpaperStyle", ImgPos
  reg.UpdateKey k_root, k_name, "TileWallpaper", mosaico
  SystemParametersInfo 20, 0, DesktopImg, 0
  
error:
End sub

rem espero que gostem

Edited by kuroi
Adicionar tag Code
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.4k
×
×
  • Create New...