• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TRegistry的典型用法代码示例。如果您正苦于以下问题:C++ TRegistry类的具体用法?C++ TRegistry怎么用?C++ TRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TRegistry

void __fastcall TRegAssociationsForm::FormActivate(TObject *Sender)
{
  ValueListEditorAssoc->Strings->Clear();

  TRegistry * reg = new TRegistry();
  try
  {
    reg->RootKey = HKEY_LOCAL_MACHINE;

    reg->OpenKey("\\SOFTWARE\\Gis center\\Journal\\Associations", true);

    TStringList * val = new TStringList;
    try
    {
      reg->GetValueNames(val);
      for (int i = 0; i < val->Count; i++)
          ValueListEditorAssoc->InsertRow (val->Strings[i], reg->ReadString(val->Strings[i]), true);
    }
    __finally
    {
      safe_delete (val);
//      delete val;
    }

    reg->CloseKey();
  }
  __finally
  {
    safe_delete (reg);
//    delete reg;
  }
}
开发者ID:IronBrainSoft,项目名称:journal,代码行数:32,代码来源:FormRegAssociations.cpp


示例2: init

int init()
{
  OutputDebugString("RPCInterface init");
TRegistry * reg;
AnsiString str;
  if (frmPluginMain == NULL)
  {
    try
    {
      // pass on the provided parameters
	  // this gets better behaviour for VCL dlls
      Application->Handle = plugin.hwndParent;
      frmPluginMain = new TfrmPluginMain(Application);
      try
      {
        // set parent handle
        reg = new TRegistry();
        reg->OpenKey("software\\PMMSoft\\Winamp controller\\server settings", true);
        str = reg->ReadString("Visible");
        if (str.LowerCase() == "true")
          frmPluginMain->Show();
      }
      __finally
      {
        delete reg;
      }
    }
    catch (...)
    {
      delete frmPluginMain;
      frmPluginMain = NULL;
    }
  }
  return 0;
}
开发者ID:patrickmmartin,项目名称:winampremote,代码行数:35,代码来源:gen_plugin.cpp


示例3: GetMatlab6Root

//---------------------------------------------------------------------------
AnsiString __fastcall GetMatlab6Root(void)
{
   AnsiString S = "";
   __TRY
   TRegistry *RR = new TRegistry();
   try
    {
    // Для Matlab 6.5

     RR->RootKey = HKEY_CLASSES_ROOT;
     if (RR->OpenKey("\\Matlab.Application.Single.6\\CLSID",false))
       S = RR->ReadString("");
     if (RR->OpenKey("\\CLSID\\"+S+"\\LocalServer32",false))
       S = RR->ReadString("");
     int ps = S.AnsiPos("matlab.exe");
     if (ps) {
      S = S.SubString( 1, ps-2);
     // S содержит размещение matlab.exe (полный путь)
      S = ExtractFileDir(S);
      S = ExtractFileDir(S);
      }
    }
      __finally {
      delete RR;
      }
  if (!DirectoryExists(S)) {
    S = "";
    }
  __CATCH
  return S;
}
开发者ID:GraffLittle,项目名称:first,代码行数:32,代码来源:Commons.cpp


示例4: TRegistry

void __fastcall TMainForm::LoadFromRegistry ()
{
  m_use_date_interval = false;

  TRegistry * reg = new TRegistry (KEY_READ);
  try
  {
    reg->RootKey = HKEY_LOCAL_MACHINE;
    reg->OpenKey ("\\SOFTWARE\\Gis center\\Journal", true);

    m_use_date_interval = reg->ReadBool("UseDateInterval");
    m_date_begin = reg->ReadDate("DateBegin");
    m_date_end = reg->ReadDate("DateEnd");

    m_auto_login = reg->ReadBool("AutoLogin");
    m_user_name = reg->ReadString("UserName");
    m_password = reg->ReadString("Password");
    m_server = reg->ReadString("Server");
    m_notification_days = StrToInt (reg->ReadString ("NotifyInterval"));
  }
  __finally
  {
    //delete reg;
    safe_delete (reg);
  }
}
开发者ID:IronBrainSoft,项目名称:journal,代码行数:26,代码来源:FormMain.cpp


示例5: TRegistry

//---------------------------------------------------------------------------
bool __fastcall TXirconForm::EraseXircServers( void )
// Delete XiRCON Server list
{
  TRegistry * MyRegistry = new TRegistry();

  try
  {
    MyRegistry->RootKey = HKEY_CURRENT_USER;

    try
    {
      MyRegistry->DeleteKey(RegKey);
    }
    catch(ERegistryException &E)
    {
      return false;
    }
  }
  __finally
  {
    if ( MyRegistry )
      delete MyRegistry;
  }

  return true;
}
开发者ID:dxzl,项目名称:xircon-server-importer,代码行数:27,代码来源:MainForm.cpp


示例6: ReadDataFromRegistry

//===========================================================================
void Tform_Main::ReadDataFromRegistry()
{
    AnsiString Name;
    TRegistry *Reg = NULL;
    try {
        try {
           Reg = new TRegistry;
           AnsiString appName = ExtractFileName(Application->ExeName);
           appName.SetLength(appName.Length() - 4);

           Reg->RootKey = HKEY_LOCAL_MACHINE;
           Reg->OpenKey("Software\\InnalabsUA\\ccg_QFactor", true);

            DFT_DeltaFreq = Reg->ReadFloat("DFT_DeltaFreq");

            DTF_InterpolationPointsCount = Reg->ReadInteger("DTF_InterpolationPointsCount");
            FFT_MaxPointsCount = Reg->ReadInteger("FFT_MaxPointsCount");
            SoundCardIndex = Reg->ReadInteger("SoundCardIndex");
            FreqSoundCardIndex = Reg->ReadInteger("FreqSoundCardIndex");

       } catch ( ... ){
            Reg->CloseKey();
            SaveDataToRegistry();
        }
    } __finally {
        Reg->CloseKey();
        if (Reg != NULL)
            delete Reg;
    }
}
开发者ID:Medcheg,项目名称:sources_old,代码行数:31,代码来源:unit_main.cpp


示例7: GetRegistryValue

//---------------------------------------------------------------------------
// Common functions
//---------------------------------------------------------------------------
AnsiString __fastcall GetRegistryValue(AnsiString KeyName, AnsiString Value)
{
  AnsiString S = "";
  __TRY
  TRegistry *Registry = new TRegistry;
  try {
    Registry->RootKey = HKEY_CLASSES_ROOT; //HKEY_LOCAL_MACHINE;
    Registry->OpenKey(KeyName,false);
    S = Registry->ReadString(Value);
  } __finally {
    delete Registry;
    }
  __CATCH
  return S;
}//---------------------------------------------------------------------------
开发者ID:GraffLittle,项目名称:first,代码行数:18,代码来源:Commons.cpp


示例8: TRegistry

//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
	String sKeyName = "Software\\DD2\\TEST";// キーの名前
	TRegistry *Registry = new TRegistry(KEY_ALL_ACCESS);
	try {
		Registry->RootKey = HKEY_CURRENT_USER;
		Registry->OpenKey(sKeyName,true);// 第二引数がtrueのとき、なければ作成 falseのとき、なくても作成しない
		// 書き込み
		Registry->WriteString("HOGE","TAMA");
		Registry->CloseKey();
	}
	catch(...) {
		ShowMessage("レジストリの処理に失敗しました");
	}
	delete Registry;
}
开发者ID:naoya-tamamura,项目名称:test_repository,代码行数:17,代码来源:Unit1.cpp


示例9: Copy

bool TRegistryStorage::Copy(TRegistryStorage * Storage)
{
  TRegistry * Registry = Storage->FRegistry;
  bool Result = true;
  std::unique_ptr<TStrings> Names(new TStringList());
  try__finally
  {
    rde::vector<uint8_t> Buffer(1024);
    Registry->GetValueNames(Names.get());
    intptr_t Index = 0;
    while ((Index < Names->GetCount()) && Result)
    {
      UnicodeString Name = MungeStr(Names->GetString(Index), GetForceAnsi());
      DWORD Size = static_cast<DWORD>(Buffer.size());
      DWORD Type;
      int RegResult = 0;
      do
      {
        RegResult = ::RegQueryValueEx(Registry->GetCurrentKey(), Name.c_str(), nullptr,
          &Type, &Buffer[0], &Size);
        if (RegResult == ERROR_MORE_DATA)
        {
          Buffer.resize(Size);
        }
      }
      while (RegResult == ERROR_MORE_DATA);

      Result = (RegResult == ERROR_SUCCESS);
      if (Result)
      {
        RegResult = ::RegSetValueEx(FRegistry->GetCurrentKey(), Name.c_str(), 0, Type,
          &Buffer[0], Size);
        Result = (RegResult == ERROR_SUCCESS);
      }

      ++Index;
    }
  }
  __finally
  {
/*
    delete Names;
*/
  };
  return Result;
}
开发者ID:skyformat99,项目名称:Far-NetBox,代码行数:46,代码来源:HierarchicalStorage.cpp


示例10: TRegistry

//---------------------------------------------------------------------------
 void __fastcall TestCarte::Scan_Arduino()
{
TRegistry *registre = new TRegistry();
registre->RootKey = HKEY_LOCAL_MACHINE;
if (registre->OpenKeyReadOnly("SYSTEM\\CurrentControlSet\\Services\\usbser\\Enum") && registre->ValueExists("0"))
	{
	EtatDetect = true;
	}
	else
		{
		EtatDetect = false;
		}
delete registre;
//valable seulement pour 1 carte Arduino, sinon incrémente...
//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbser\Enum -> 0 -> USB\VID_2341&PID_0042\6493633303735151D061
//HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM -> \Device\USBSER000 -> COMxx
 }
开发者ID:cccczl,项目名称:s2aio-control-panel,代码行数:18,代码来源:Detect.cpp


示例11:

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//修复代码
TRegistry *reg = new TRegistry;
try
{
reg->RootKey = HKEY_CLASSES_ROOT;
reg->OpenKey(".exe",true);
reg->WriteString("","exefile");
reg->CloseKey();

reg->OpenKey("exefile\\shell\\open\\command\\",true);
reg->WriteString ("","\"%1\" %*");
reg->CloseKey() ;

ShowMessage("所有错误已经成功修复!");
SG->Color = clWindow;
Button1->Enabled = false;
//Form1->DoHide ();
Form1->DoShow ();
}
  __finally
  {
    delete reg;
  }
}
开发者ID:rogertl,项目名称:cbuilder,代码行数:27,代码来源:Unit1.cpp


示例12: TIniFile

//---------------------------------------------------------------------------
void __fastcall TFormMain::ExtractParam() {
	if (FileExists(ExtractFilePath(Application->ExeName) + PARAM_FILE) == false)
		return;
	TIniFile *ini = new TIniFile(ExtractFilePath(Application->ExeName)+PARAM_FILE);
	this->EditHost->Text = this->Crypt(ini->ReadString("ftp", "Host", ""));
	this->EditLogin->Text = this->Crypt(ini->ReadString("ftp", "Login", ""));
	this->EditPassword->Text = this->Crypt(ini->ReadString("ftp", "Password", ""));
	this->EditPort->Text = this->Crypt(ini->ReadString("ftp", "Port", ""));
	this->EditPwd->Text = this->Crypt(ini->ReadString("ftp", "Pwd", ""));
	ini->Free();
	TRegistry *regedit = new TRegistry();
	regedit->RootKey = HKEY_CURRENT_USER;
	regedit->OpenKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", false);
	if (regedit->ValueExists("ScreenShot") == true)
		this->AutoRun->Checked = true;
	regedit->CloseKey();
	regedit->Free();
}
开发者ID:alex-rassanov,项目名称:screenshoot,代码行数:19,代码来源:Unit1.cpp


示例13: TRegistry

void __fastcall TfrmPluginMain::FormCloseQuery(TObject *Sender, bool &CanClose)
{

    TRegistry * reg;

    try {
        reg = new TRegistry();
        reg->OpenKey("software\\PMMSoft\\Winamp controller\\server settings", true);

        // should implement end point edits
        // reg->WriteString("EndPoint", "");

        reg->WriteString("Visible", Visible?"true":"false");
    }
    __finally {
        delete reg;
    }

}
开发者ID:patrickmmartin,项目名称:winampremote,代码行数:19,代码来源:ServerDLLF.cpp


示例14: actUnregisterExecute

//---------------------------------------------------------------------------
void __fastcall TMainForm::actUnregisterExecute(TObject *Sender)
{
  try
  {
    TRegistry *reg = new TRegistry;
    reg->RootKey = HKEY_CLASSES_ROOT;
    reg->DeleteKey(".avm");
    reg->DeleteKey("AVBARMatrix");
    reg->DeleteKey(".avl");
    reg->DeleteKey("AVBARStudList");
    delete reg;
    Application->MessageBoxA("File types have been successfully unregistered!",
      "Register", MB_OK | MB_ICONINFORMATION);
  }
  catch (Exception &)
  {
    ShowError("An unrecognized error during registering!");
  }
}
开发者ID:aababilov,项目名称:bcb-programs,代码行数:20,代码来源:Main.cpp


示例15: TRegistry

//---------------------------------------------------------------------------
String CUtilites::GetRegInfoS(String RegKey, String KeyName)
{
    String RetVal = "";
    TRegistry *MyRegistry = new TRegistry();
    MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
    try
    {
       if(MyRegistry->OpenKey(RegKey, false))
       {
          RetVal = MyRegistry->ReadString(KeyName);
          MyRegistry->CloseKey();
       }
    }
    catch(ERegistryException &E)
    {
       Application->MessageBoxA(E.Message.c_str(), "Error", MB_OK);
    }
    delete MyRegistry;
    return RetVal;
}
开发者ID:BHjr132,项目名称:fonline,代码行数:21,代码来源:utilites.cpp


示例16: Regread

//---------------------------------------------------------------------------
AnsiString __fastcall Regread(AnsiString folder,AnsiString Key,int mode)
{
 AnsiString S="";
 int p,p1;
 TRegistry *Registry = new TRegistry;
 try
 {
  Registry->RootKey = HKEY_LOCAL_MACHINE;
  if(Registry->OpenKeyReadOnly(folder))
  {
   if(mode==0)
    S = Registry->ReadString(Key);
   if(mode==1)
    Registry->WriteString("ServerN",Key);
   if(mode==2)
	Registry->WriteString("DB",Key);

  }
  Registry->CloseKey();
 }
 __finally
 {
  delete Registry;
 }
 return S;
}
开发者ID:apdapd,项目名称:CBuilder,代码行数:27,代码来源:MainFunc.cpp


示例17: TRegistry

void __fastcall TFormMain::AutoRunClick(TObject *Sender)
{
	TRegistry *regedit = new TRegistry();
	regedit->RootKey = HKEY_CURRENT_USER;
	regedit->OpenKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", false);
	if (this->AutoRun->Checked == true) {
		try {
			regedit->WriteString("ScreenShot", Application->ExeName);
			ShowMessage("Given program will be launched at start computer");
		} catch (Exception *e) {
			ShowMessage("Error: I can not remove autorun");
			DebugOutput(e->Message);
		}
	} else {
		try {
			regedit->DeleteValue("ScreenShot");
			ShowMessage("Autorun was deleted");
		} catch (Exception *e) {
			ShowMessage("Error: i Can't delete a autorun");
            DebugOutput(e->Message);
		}
	}
	regedit->CloseKey();
	regedit->Free();
}
开发者ID:alex-rassanov,项目名称:screenshoot,代码行数:25,代码来源:Unit1.cpp


示例18: TRegistry

TStringList* TCommThread::GetAvailableDevicesNames(bool IncludeSerial, bool IncludeParallel, TStringList * AvaiableDevicesNames)
{
        TRegistry       *Registro = new TRegistry();
        TStringList     *StringsTemp = new TStringList();
        int Indice;
        if (AvaiableDevicesNames!=NULL)
                AvaiableDevicesNames->Clear();
        else
                AvaiableDevicesNames = new TStringList();

        Registro->RootKey=HKEY_LOCAL_MACHINE;

        if(IncludeSerial==true)
        {
                StringsTemp->Clear();

                Registro->OpenKey("hardware\\devicemap\\serialcomm",false);
                Registro->GetValueNames(StringsTemp);

                for (Indice=0;Indice<StringsTemp->Count;Indice++)
                        AvaiableDevicesNames->Add(Registro->ReadString(StringsTemp->Strings[Indice]));
                Registro->CloseKey();
        }

        if(IncludeParallel==true)
        {
                StringsTemp->Clear();

                Registro->OpenKey("hardware\\devicemap\\parallel ports",false);
                Registro->GetValueNames(StringsTemp);

                for (Indice=0;Indice<StringsTemp->Count;Indice++)
                        AvaiableDevicesNames->Add(ExtractFileName(Registro->ReadString(StringsTemp->Strings[Indice])));
                Registro->CloseKey();
        }
        AvaiableDevicesNames->Sort();
        delete Registro;
        delete StringsTemp;
        return AvaiableDevicesNames;

}
开发者ID:JaconsMorais,项目名称:repcomputaria,代码行数:41,代码来源:CommThread_Unit.cpp


示例19: RGB

void __fastcall TForm1::FormShow(TObject *Sender)
{

SG->Cells[0][0] ="正常项目";
SG->Cells[1][0] = "目前注册表项目";


TRegistry *reg = new TRegistry;
try
{
reg->RootKey = HKEY_CLASSES_ROOT;
reg->OpenKey(".exe",false);


SG->Cells[0][1] = "位置:HKEY_CLASSES_ROOT\\.exe 键值:exefile";
SG->Cells[1][1] = reg->ReadString("");
reg->CloseKey();

SG->Cells[0][2] =  "位置:HKEY_CLASSES_ROOT\\exefile\\shell\\open\\command 键值:\"%1\" %*";
reg->OpenKey("exefile\\shell\\open\\command\\",false);
SG->Cells[1][2] = reg->ReadString("");
reg->CloseKey() ;

if (SG->Cells[1][1]  != "exefile" | SG->Cells[1][2] != "\"%1\" %*" )
        {
        SG->Color = RGB(255,0,0);
        Button1->Enabled = true;
        ShowMessage("发现注册表设置异常,请点击修复进行修改!");
        }
else
{
ShowMessage("所有设置都是正常的,如果还是有问题,\n请参照说明的键值在注册表中手动修复。");
}
}
  __finally
  {
    delete reg;
  }



}
开发者ID:rogertl,项目名称:cbuilder,代码行数:42,代码来源:Unit1.cpp


示例20: SaveDataToRegistry

//===========================================================================
void Tform_Main::SaveDataToRegistry()
{
    TRegistry *Reg = NULL;
    try {
        Reg = new TRegistry;
        AnsiString appName = ExtractFileName(Application->ExeName);
        appName.SetLength(appName.Length() - 4);

        Reg->RootKey = HKEY_LOCAL_MACHINE;
        Reg->OpenKey("Software\\InnalabsUA\\ccg_QFactor", true);

        Reg->WriteFloat("DFT_DeltaFreq", DFT_DeltaFreq);

        Reg->WriteInteger("DTF_InterpolationPointsCount", DTF_InterpolationPointsCount);
        Reg->WriteInteger("FFT_MaxPointsCount", FFT_MaxPointsCount);
        Reg->WriteInteger("SoundCardIndex", SoundCardIndex);
        Reg->WriteInteger("FreqSoundCardIndex", FreqSoundCardIndex);

    } __finally {
        Reg->CloseKey();
        if (Reg != NULL)
            delete Reg;
    }
}
开发者ID:Medcheg,项目名称:sources_old,代码行数:25,代码来源:unit_main.cpp



注:本文中的TRegistry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TResourceReader类代码示例发布时间:2022-05-31
下一篇:
C++ TRegion类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap