Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [VB6] Eliminare database in Windows Vista

    Buongiorno, datemi una dritta gentilmente!!!!!

    Ho un problema, se da codice voglio eliminare un file (Database) presente in un sistema operativo Vista, mi esce un errore Numero 70 con descrizione "Accesso Negato".
    Penso che si l'UAC che genera questo errore, ma ho la necessità di eliminare il file in quelche modo. Qualcuno ha risolto questo problema in qualche maniera?

    Grazie

  2. #2
    soluzione trovata....

    Private Type SHFILEOPSTRUCT
    hWnd As Long
    wFunc As Long
    pFrom As String
    pTo As String
    fFlags As Integer
    fAborted As Boolean
    hNameMaps As Long
    sProgress As String
    End Type
    Private Const FO_COPY = &H2
    Private Const FO_DELETE = &H3
    Private Const FOF_NOCONFIRMATION = &H10
    Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

    Public Sub DeleteFile(ByVal vFrom As String)
    Dim SHFileOp As SHFILEOPSTRUCT
    With SHFileOp
    .wFunc = FO_DELETE
    .pFrom = vFrom
    .fFlags = FOF_NOCONFIRMATION
    End With
    SHFileOperation SHFileOp
    End Sub

    Public Sub CopyFile(ByVal vFrom As String, ByVal vTo As String)
    Dim SHFileOp As SHFILEOPSTRUCT
    With SHFileOp
    .wFunc = FO_COPY
    .pFrom = vFrom
    .pTo = vTo
    .fFlags = FOF_NOCONFIRMATION
    End With
    SHFileOperation SHFileOp
    End Sub


    invece di cancellare il file, lo sposto nel cestino....
    Certo che sono intelligentoni chi ha creato Vista e tutte le sue protezioni!!

    Alla proxima!!!!!!!!!!!!!



Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.