Results 1 to 2 of 2

Thread: Stupid Registery

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Montreal
    Posts
    17

    Exclamation

    o.k this is my question i need to edit the Registery, changeing the Default Value to something else BUT the probleme is that the Default Key :HKEY_CLASSES_ROOT\txtfile\shell\open\command: (Default) : C:\WINDOWS\NOTEPAD.EXE %1
    i have this
    but i have to replace with this : (Default) : C:\Path\Myprog.exe %1

    but i'v tryed with API 's but it creat a seconed String named (Default), so no there a :
    (Default) : C:\WINDOWS\NOTEPAD.EXE %1
    (Default) : C:\Path\Myprog.exe %1

    in my registery
    this is what i have, how would i change the Default string ? :

    Private Sub Command1_Click()
    savekey HKEY_CLASSES_ROOT, "txtfile\shell\open\command", "(Default)", Text1.Text
    End Sub

    Public Sub savestring(hKey As Long, strPath As String, strValue As String, strdata As String)
    Dim keyhand As Long
    Dim r As Long
    r = RegCreateKey(hKey, strPath, keyhand)
    r = RegSetValueEx(keyhand, strValue, 0, REG_SZ, ByVal strdata, Len(strdata))
    r = RegCloseKey(keyhand)
    End Sub

    [Edited by Zulander1 on 04-30-2000 at 02:23 PM]

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217

    Talking

    You're making a simple mistake, the Default entry is not actually named "Default". When you use RegSetValueEx send the strValue (that's the lpValueName argument) as vbNullString to set the Key's default value. As a side note, if all you want to do is set the Default value then you would probably find it easier to use the regular RegSetValue API call.
    Dan PM
    Analyst Programmer

    VB6 SP3 (also VB4 16-bit sometimes )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width