how to edit the registry

This is a discussion on how to edit the registry within the Windows Programming forums, part of the Platform Specific Boards category; I'm looking for someone who knows how to edit the registry values on the computer from your own program.... what ...

  1. #1
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903

    how to edit the registry

    I'm looking for someone who knows how to edit the registry values on the computer from your own program....

    what i need to be able to do is have an install file that people can just run, it would probably only run in dos or something....but it would add the registry values to the registry so that all of my *.ost files would run with my OpenScript.exe program......

    in other words, after installing it, you would be able to double click the *.ost files and they would run right through my interpreter, no matter where they are......

    thanks in advance

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,642
    You can use an INF File.
    Or modify the registry using the Win32 API.

    gg

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> You can use an INF File.

    You can, but you'd be better off not. This is old tech. Use the API functions.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Registered User
    Join Date
    Mar 2003
    Location
    UK
    Posts
    169
    Here's some code that you can modify to do what you need.
    Code:
    #include <windows.h>
    #include <stdlib.h>
    #include <stdio.h>
    
    void AddRegistry()
    {
        HKEY hk, hklm;          
        DWORD iMyNumber;
        char MyText[] = "Hello";
        LONG rc;       
    
        rc = RegConnectRegistry(NULL, HKEY_LOCAL_MACHINE, &hklm);
        rc = RegCreateKey(hklm, "SOFTWARE\\MYTEST", &hk);
        RegCloseKey(hklm);
    
        rc = RegSetValueEx(hk,"MyText", 0, REG_EXPAND_SZ, (LPBYTE) MyText, strlen(MyText) + 1); 
      
        iMyNumber = 50; 
        rc = RegSetValueEx(hk,"MyNumber1",0, REG_DWORD,(LPBYTE) &iMyNumber, sizeof(DWORD));
    
        iMyNumber = 80; 
        rc = RegSetValueEx(hk,"MyNumber2",0, REG_DWORD,(LPBYTE) &iMyNumber, sizeof(DWORD));
    
        RegCloseKey(hk);
    
        return;
    } 
    
    int main()
    {
        AddRegistry();
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiline Edit Box Parser
    By The Brain in forum Windows Programming
    Replies: 6
    Last Post: 11-01-2005, 06:15 PM
  2. Replies: 3
    Last Post: 07-23-2005, 08:00 AM
  3. Capture Enter key press in EDIT Box
    By richiev in forum Windows Programming
    Replies: 4
    Last Post: 07-14-2005, 12:03 AM
  4. edit controls
    By ZerOrDie in forum Windows Programming
    Replies: 11
    Last Post: 04-08-2003, 12:09 PM
  5. Difficulty superclassing EDIT window class
    By cDir in forum Windows Programming
    Replies: 7
    Last Post: 02-21-2002, 04:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21