Saturday, February 16, 2008

Menambah Item Pada Klik Kanan

Private Sub Form_Load()
 frmAdditemstorightclickmenuinWindows.Caption = Cap1
 cmdAction.Caption = Cap2
 lblInfo.Caption = Cap6
End Sub
Private Sub SetKeyDataValue(RegKeyRoot As Long, RegKeyName As String, RegOtherKeyName As String, KeyDataType As Long, KeyValueName As String, KeyValueDate1 As Variant, KeyValueDate2 As Variant)
    
    Dim OpenKey As Long, SetValue As Long, hKey As Long
    
    OpenKey = RegOpenKeyEx(RegKeyRoot, RegKeyName & “\” & KeyValueName, 0, KEY_ALL_ACCESS, hKey)
    
    If (OpenKey <> 0) Then
        Call RegCreateKey(RegKeyRoot, RegKeyName & “\” & KeyValueName, hKey)
        SetValue = RegSetValueEx(hKey, “”, 0&, KeyDataType, ByVal CStr(KeyValueDate1 & Chr$(0)), Len(KeyValueDate1))
        
        Call RegCreateKey(RegKeyRoot, RegKeyName & “\” & KeyValueName & “\” & RegOtherKeyName, hKey)
        SetValue = RegSetValueEx(hKey, “”, 0&, KeyDataType, ByVal CStr(KeyValueDate2 & Chr$(0)), Len(KeyValueDate2))
    End If
    
    SetValue = RegCloseKey(hKey)
        MsgBox Cap5 & KeyValueName, vbInformation + vbOKOnly, App.Title
    cmdAction.Caption = Cap4
End Sub
Function WindowsDir() As String
‘ Call to get the current windows directory
‘  MyString = WindowsDir
    Dim x As Long
    Dim strPath As String
    strPath = Space$(1024)
    x = GetWindowsDirectory(strPath, Len(strPath))
    strPath = Left$(strPath, x)
    If Right$(strPath, 1) <> “\” Then strPath = strPath & “\”
    WindowsDir = strPath
End Function

Nb:
Buat 1 command dan beri nama cmdAction
Buat 1 label dan beri nama lblInfo

Posted by Administrator in 05:22:25
Comments

Leave a Reply