Results 1 to 4 of 4

Thread: Running Reg Files Remotely

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    UK
    Posts
    199

    Exclamation

    Hi All

    On Win95 machines only, how can I, once connected to another machine, run a .reg file and have the contents of the .reg file take place on the remote machine.


    Thanx

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    You can't! The reg file has to be opened on the computer which registry you want to add it to.
    You can however use the RegConnectRegistry function to edit the registry on a remote computer.
    On Win95 you can't, however, edit the HKEY_CLASSES_ROOT or HKEY_CURRENT_USER when using the RegConnectRegistry function.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    UK
    Posts
    199
    Joacim help. Could you mail me details of this function. Possibly a working example.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    First of all read John's excellent article on how to access the Registry using API functions.

    Then declare the RegConnectRegistry function like this:
    Code:
    Public Declare Function RegConnectRegistry _
     Lib "advapi32.dll" Alias "RegConnectRegistryA" ( _
     ByVal lpMachineName As String, _
     ByVal hKey As Long, _
     phkResult As Long) As Long
    The lpMachineName argument is the name of the computer you want to access. It must be in UNC notation ("\\ComputerName").
    The hKey argument is the value of one of the HKEY_xxx (you find the values of these in John's article).
    To the phkResult argument you pass a variable that you have declared as Long. If the function is successfull it will contain the handle to the remote registry.
    You use this handle instead of the HKEY_xxx values when you call the RegOpenKey or RegOpenKeyEx functions.

    Remember to always call RegCloseKey afterwards.

    Good luck!

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