Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. GetRegValue and using it correctly, need help.

GetRegValue and using it correctly, need help.

Scheduled Pinned Locked Moved C / C++ / MFC
helpwindows-admin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rbwest86
    wrote on last edited by
    #1

    Ok, so after trying for hours on end to get things working correctly I am posting here. I am new to programming and trying to learn. Please provide me with clarification of how I have this screwed up. Also, please include how I can fix this. I learn through practicals. Also, I have changed things so many times trying to call the function correctly with assigning the correct arguments but I am just so confused at this point I am asking for help.

    #define _WIN32_WINNT (0x0601)
    #include <windows.h>
    #include <winbase.h>
    #include <winreg.h>
    #include <iostream>
    #include <iomanip>
    using namespace std;

    int main()
    {
    // REGISTRY PORTION
    DWORD pdwQuotaAllowed, pdwQuotaUsed;
    GetSystemRegistryQuota(&pdwQuotaAllowed, &pdwQuotaUsed);

    // Backup Current Registry
    // Open Registry Key (RegGetValue)
    DWORD dwFlags;
    RegGetValue(&dwFlags);
    // Delete Contents of the Key (RegDeleteValue)
    // Write New Content of the key (RegSetValueEx)
    // Close Registry Handle (RegCloseKey)

    // DISPLAY RESULTS
    cout << pdwQuotaAllowed << endl;
    cout << pdwQuotaUsed << endl;
    return 0;
    }

    L 1 Reply Last reply
    0
    • R rbwest86

      Ok, so after trying for hours on end to get things working correctly I am posting here. I am new to programming and trying to learn. Please provide me with clarification of how I have this screwed up. Also, please include how I can fix this. I learn through practicals. Also, I have changed things so many times trying to call the function correctly with assigning the correct arguments but I am just so confused at this point I am asking for help.

      #define _WIN32_WINNT (0x0601)
      #include <windows.h>
      #include <winbase.h>
      #include <winreg.h>
      #include <iostream>
      #include <iomanip>
      using namespace std;

      int main()
      {
      // REGISTRY PORTION
      DWORD pdwQuotaAllowed, pdwQuotaUsed;
      GetSystemRegistryQuota(&pdwQuotaAllowed, &pdwQuotaUsed);

      // Backup Current Registry
      // Open Registry Key (RegGetValue)
      DWORD dwFlags;
      RegGetValue(&dwFlags);
      // Delete Contents of the Key (RegDeleteValue)
      // Write New Content of the key (RegSetValueEx)
      // Close Registry Handle (RegCloseKey)

      // DISPLAY RESULTS
      cout << pdwQuotaAllowed << endl;
      cout << pdwQuotaUsed << endl;
      return 0;
      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      As a newbie to programming I would strongly caution you not to do anything to the registry. If you corrupt an entry you could end up with a totally unusable system. As to the code you posted you need to read the MSDN documentation for details of how to use particular functions, e.g RegGetValue()[^] needs a lot more parameters than you offered. Once again, I would suggest you find something less likely to damage your system to learn on.

      txtspeak is the realm of 9 year old children, not developers. Christian Graus

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups