Forum Informatika
Silahkan Login

Kami sarankan anda register atau daftar terlebih dahulu agar anda dapat mendownload atau membuka category forum secara keseluruhan....
karena ada beberapa forum yang tertutup untuk tamu dan dengan Login Anda bisa menggunakan fasilitas Chatting yang kami miliki.

Selamat Bergabung

Forum Informatika

Created By Hanafi Sukawa Ginting
 
HomeFAQPasang Iklanfacebook InformatikaRegisterLog inNew Tab Newscomputer

Share | 
 

 Open Files & Folder hidden dengan VB6

View previous topic View next topic Go down 
AuthorMessage


Change Your Avatar -------------->


admin

Admin
Rank : Admin


My Pets :
Jumlah posting : 550
Point : 2147483647
Reputasi : 47
Join date : 2010-04-23
Age : 24
Lokasi : indonesia

PostSubject: Open Files & Folder hidden dengan VB6   Sat 09 Oct 2010, 07:15


Code:
Private Sub PB_HIDDIS_Click()

lResult = RegCreateKey(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", hKeyHandle)
    lResult = RegSetValueEx(hKeyHandle, "Hidden", 0&, REG_DWORD, 2, 4)
    lResult = RegCloseKey(hKeyHandle)
    Action.Caption = "Show Hidden Folders Disabled"
    MsgBox "Show Hidden Folders Disabled And Please Refresh", vbInformation, "Information"
End
End Sub

Private Sub PB_HIDENB_Click()
lResult = RegCreateKey(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", hKeyHandle)
    lResult = RegSetValueEx(hKeyHandle, "Hidden", 0&, REG_DWORD, 1, 4)
    lResult = RegCloseKey(hKeyHandle)
    Action.Caption = "Show Hidden Folders Enabled"
'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden
MsgBox "Show Hidden Folders Enabled And Please Refresh", vbInformation, "Information"
End
End Sub

modul

Option Explicit

    Public Declare Function RegCreateKey Lib "advapi32.dll" Alias _
      "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, _
      phkResult As Long) As Long

    Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias _
      "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _
      ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal _
      cbData As Long) As Long

    Public Declare Function RegCloseKey Lib "advapi32.dll" _
      (ByVal hKey As Long) As Long
     
Public Declare Function ShellExecute 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
Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long
Public Declare Function RegQueryValue Lib "advapi32.dll" Alias "RegQueryValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal lpValue As String, lpcbValue As Long) As Long

'Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
'Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
'Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long




Public Const ERROR_SUCCESS = 0&

Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_CONFIG = &H80000005
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003

Public Const STANDARD_RIGHTS_ALL = &H1F0000
Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_SET_VALUE = &H2
Public Const KEY_CREATE_SUB_KEY = &H4
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const KEY_CREATE_LINK = &H20
Public Const SYNCHRONIZE = &H100000
Public Const KEY_ALL_ACCESS = _
    ((STANDARD_RIGHTS_ALL Or _
    KEY_QUERY_VALUE Or _
    KEY_SET_VALUE Or _
    KEY_CREATE_SUB_KEY Or _
    KEY_ENUMERATE_SUB_KEYS Or _
    KEY_NOTIFY Or KEY_CREATE_LINK) And _
    (Not SYNCHRONIZE))
Public Const ERROR_NO_MORE_ITEMS = 259&

Public m_SelectedSection As Long

Public Const REG_BINARY = 3
Public Const REG_DWORD = 4
Public Const REG_DWORD_BIG_ENDIAN = 5
Public Const REG_DWORD_LITTLE_ENDIAN = 4
Public Const REG_EXPAND_SZ = 2
Public Const REG_FULL_RESOURCE_DESCRIPTOR = 9
Public Const REG_LINK = 6
Public Const REG_MULTI_SZ = 7
Public Const REG_NONE = 0
Public Const REG_RESOURCE_LIST = 8
Public Const REG_RESOURCE_REQUIREMENTS_LIST = 10
Public Const REG_SZ = 1


Public Const DRIVE_REMOVABLE As Long = 2
Public Const DRIVE_FIXED As Long = 3
Public Const DRIVE_REMOTE As Long = 4
Public Const DRIVE_CDROM As Long = 5  'can be a CD or a DVD
Public Const DRIVE_RAMDISK As Long = 6
     
Public Declare Function GetLogicalDriveStrings Lib "kernel32" _
    Alias "GetLogicalDriveStringsA" _
    (ByVal nBufferLength As Long, _
    ByVal lpBuffer As String) As Long

Public Declare Function GetDriveType Lib "kernel32" _
    Alias "GetDriveTypeA" _
    (ByVal nDrive As String) As Long
   
 Public Declare Function SetFileAttributes Lib "kernel32.dll" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
 
 Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
 Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
   
' Delete all the key's subkeys.
Public Sub DeleteSubkeys(ByVal section As Long, ByVal key_name As String)
Dim hKey As Long
Dim subkeys As Collection
Dim subkey_num As Long
Dim length As Long
Dim subkey_name As String

    ' Open the key.
    If RegOpenKeyEx(section, key_name, _
        0&, KEY_ALL_ACCESS, hKey) <> ERROR_SUCCESS _
    Then
            MsgBox "Error opening key '" & key_name & "'"
            Exit Sub
    End If

    ' Enumerate the subkeys.
    Set subkeys = New Collection
    subkey_num = 0
    Do
        ' Enumerate subkeys until we get an error.
        length = 256
        subkey_name = Space$(length)
        If RegEnumKey(hKey, subkey_num, _
            subkey_name, length) _
                <> ERROR_SUCCESS Then Exit Do
        subkey_num = subkey_num + 1

        subkey_name = Left$(subkey_name, InStr(subkey_name, Chr$(0)) - 1)
        subkeys.Add subkey_name
    Loop
   
    ' Recursively delete the subkeys and their subkeys.
    For subkey_num = 1 To subkeys.Count
        ' Delete the subkey's subkeys.
        If key_name <> "" Then
            DeleteSubkeys section, key_name & "" & subkeys(subkey_num)
        Else
            DeleteSubkeys section, subkeys(subkey_num)  ' lijo
        End If

        ' Delete the subkey.
        RegDeleteKey hKey, subkeys(subkey_num)
    Next subkey_num

    ' Close the key.
    RegCloseKey hKey
End Sub
' Get the key information for this key and
' its subkeys.
Public Function GetKeyInfo(ByVal section As Long, ByVal key_name As String, ByVal indent As Integer) As String
Dim subkeys As Collection
Dim subkey_values As Collection
Dim subkey_num As Integer
Dim subkey_name As String
Dim subkey_value As String
Dim length As Long
Dim hKey As Long
Dim txt As String
Dim subkey_txt As String

    Set subkeys = New Collection
    Set subkey_values = New Collection

    If Right$(key_name, 1) = "" Then key_name = Left$(key_name, Len(key_name) - 1)

    ' Open the key.
    If RegOpenKeyEx(section, _
        key_name, _
        0&, KEY_ALL_ACCESS, hKey) <> ERROR_SUCCESS _
    Then
        MsgBox "Error opening key."
        Exit Function
    End If

    ' Enumerate the subkeys.
    subkey_num = 0
    Do
        ' Enumerate subkeys until we get an error.
        length = 256
        subkey_name = Space$(length)
        If RegEnumKey(hKey, subkey_num, _
            subkey_name, length) _
                <> ERROR_SUCCESS Then Exit Do
        subkey_num = subkey_num + 1
       
        subkey_name = Left$(subkey_name, InStr(subkey_name, Chr$(0)) - 1)
        subkeys.Add subkey_name
   
        ' Get the subkey's value.
        length = 256
        subkey_value = Space$(length)
        If RegQueryValue(hKey, subkey_name, _
            subkey_value, length) _
            <> ERROR_SUCCESS _
        Then
            subkey_values.Add "Error"
        Else
            ' Remove the trailing null character.
            subkey_value = Left$(subkey_value, length - 1)
            subkey_values.Add subkey_value
        End If
    Loop
   
    ' Close the key.
    If RegCloseKey(hKey) <> ERROR_SUCCESS Then
        MsgBox "Error closing key."
    End If

    ' Recursively get information on the keys.
    For subkey_num = 1 To subkeys.Count
        subkey_txt = GetKeyInfo(section, key_name & "" & subkeys(subkey_num), indent + 2)
        txt = txt & Space(indent) & _
            subkeys(subkey_num) & _
            ": " & subkey_values(subkey_num) & vbCrLf & _
            subkey_txt
    Next subkey_num

    GetKeyInfo = txt
End Function
' Delete this key.
Public Sub DeleteKey(ByVal section As Long, ByVal key_name As String)
Dim pos As Integer
Dim parent_key_name As String
Dim parent_hKey As Long

    If Right$(key_name, 1) = "" Then key_name = Left$(key_name, Len(key_name) - 1)

    ' Delete the key's subkeys.
    DeleteSubkeys section, key_name

    ' Get the parent's name.
    pos = InStrRev(key_name, "")
    If pos = 0 Then
        ' This is a top-level key.
        ' Delete it from the section.
        RegDeleteKey section, key_name
    Else
        ' This is not a top-level key.
        ' Find the parent key.
        parent_key_name = Left$(key_name, pos - 1)
        key_name = Mid$(key_name, pos + 1)

        ' Open the parent key.
        If RegOpenKeyEx(section, _
            parent_key_name, _
            0&, KEY_ALL_ACCESS, parent_hKey) <> ERROR_SUCCESS _
        Then
            MsgBox "Error opening parent key"
        Else
            ' Delete the key from its parent.
            RegDeleteKey parent_hKey, key_name

            ' Close the parent key.
            RegCloseKey parent_hKey
        End If
    End If
End Sub


Download
Back to top Go down
http://software-download1001.blogspot.com/


Change Your Avatar -------------->


dirgaizan

soldier level 1
Rank : soldier level 1


My Pets :
Jumlah posting : 18
Point : 27
Reputasi : 1
Join date : 2011-04-06

PostSubject: Re: Open Files & Folder hidden dengan VB6   Wed 06 Apr 2011, 21:12

kk maksudnya apa Question Question
Back to top Go down


Change Your Avatar -------------->


admin

Admin
Rank : Admin


My Pets :
Jumlah posting : 550
Point : 2147483647
Reputasi : 47
Join date : 2010-04-23
Age : 24
Lokasi : indonesia

PostSubject: Re: Open Files & Folder hidden dengan VB6   Mon 11 Apr 2011, 11:35

dirgaizan wrote:
kk maksudnya apa Question Question


aplikasi ini gunanya untuk membuka file - file hidden tanpa harus membuka folder option
Back to top Go down
http://software-download1001.blogspot.com/


Change Your Avatar -------------->


dirgaizan

soldier level 1
Rank : soldier level 1


My Pets :
Jumlah posting : 18
Point : 27
Reputasi : 1
Join date : 2011-04-06

PostSubject: Re: Open Files & Folder hidden dengan VB6   Tue 21 Jun 2011, 17:22

admin wrote:
dirgaizan wrote:
kk maksudnya apa Question Question



aplikasi ini gunanya untuk membuka file - file hidden tanpa harus membuka folder option
kk cara pakenya gimana Question Question Question Question Question Question
Back to top Go down


Change Your Avatar -------------->


Sponsored content

Rank :



PostSubject: Re: Open Files & Folder hidden dengan VB6   Today at 23:02

Back to top Go down
 

Open Files & Folder hidden dengan VB6

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Forum Informatika ::  :: VB6-
Jump to:  

Private forum on Forumotion | © phpBB | Free forum support | Contact | Report an abuse | Free forum