使用Dev-C ++进行注册表编辑 [英] Registry Editing with Dev-C++

查看:240
本文介绍了使用Dev-C ++进行注册表编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,对C ++编码来说还很新...我可以创建一个窗口并执行基本功能,例如对话框,文本框等...

我正在尝试访问注册表,并将密钥放在只供初学者使用的文本框中.我尝试了MS网站和其他教程中的所有内容,但都没有碰到运气.问题在于,当我尝试运行给定的代码时,Dev只会给我错误...

这是我最近的尝试,只是获取基本注册表大小信息...

Ok, fairly new to C++ coding... I can create a window and do basic functions such as dialog boxes, text boxes, etc...

I''m trying to access the registry and put the keys in a textbox just for starters. I''ve tried everything from the MS site and other tutorials with no luck. The problem is that Dev just gives me errors when I try to run the given code...

Here''s my recent try to just get basic registry size info...

#include <iostream> //Basic (cin, cout)
#include <string> //Basic (string.length(), etc..)
#include <clocale>
#include <windows.h>
#include <stdio.h>
using namespace std;

void clear();
int i1, i2;
DWORD dwQuotaAllowed, dwQuotaUsed;
GetSystemRegistryQuota(dwQuotaAllowed, i1);
GetSystemRegistryQuota(dwQuotaUsed, i2);

int main(int argc, char * argv[])
{
  
    /* printf( "Quota allowed: %uK, Quota used: %uK\n",
            dwQuotaAllowed/1024, dwQuotaUsed / 1024 ); */
  
  cout << "Locale Drive: " << setlocale(LC_ALL,NULL) << endl << endl;
  
  cout << "Total Allowable Registry Size: " << i1 << endl;
  cout << "Current Registry Size: " << i2 << endl;
  
  string sXit;
  int iXit = 1;
  char z;
  bool x = false;
  sXit.clear();
  do
  {
    sXit.clear();
    cout << "Exit? (y/n): ";
    getline(cin, sXit);
    if ((sXit == "") || (sXit == " "))
    {
      iXit = 1; //Default Exit = "y" if blank space or Enter key
      x = false;
      break;
    }
    z = sXit.at(0);
    switch (z) //User can answer yes or no ("y" or "n")
    {
      case ''y'':
        iXit = 1;
        x = false;
        break;
      case ''n'':
        iXit = 0;
        x = false;
        break;
      default:
        x = true;
    }
  } while(x);
  return 0;
}



我得到的只是GetSystemRegistryQuota的构造函数错误,有什么想法吗?

重新格式化,-EG-



All I get is constructor errors with GetSystemRegistryQuota, any ideas?

Reformatted, -EG-

推荐答案

您需要将代码行移到您的主块内main定义上方程序.就目前而言,这两个GetSystemRegistryQuota()函数调用永远无法执行.
You need to move the lines of code above your definition of main inside the main block of your program. As it stands the two GetSystemRegistryQuota() function calls can never be executed.


DWORD dwQuotaAllowed,dwQuotaUsed;
GetSystemRegistryQuota(&dwQuotaAllowed,&dwQuotaUsed);

pdwQuotaAllowed和pdwQuotaUsed必须是一个指针.
DWORD dwQuotaAllowed, dwQuotaUsed;
GetSystemRegistryQuota(&dwQuotaAllowed,&dwQuotaUsed);

pdwQuotaAllowed and pdwQuotaUsed need to be a pointer.


这篇关于使用Dev-C ++进行注册表编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆