×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How can I insert registry keys on Borland C++ Builder?
2

How can I insert registry keys on Borland C++ Builder?

How can I insert registry keys on Borland C++ Builder?

(OP)
How can I insert registry keys to windows OS's Registry on Borland C++ Builder? what is the source code for this?

thanks in advance.

RE: How can I insert registry keys on Borland C++ Builder?

2
There is a special class TRegistry for such purposes. With the methods of this class you can read, write, delete etc. Registry keys.

hnd
hasso55@yahoo.com
 
 

RE: How can I insert registry keys on Borland C++ Builder?

(OP)
How can I find out about this special class?

thanks

RE: How can I insert registry keys on Borland C++ Builder?

You could use the Online-Help or today in the evening i will post an example.

hnd
hasso55@yahoo.com
 
 

RE: How can I insert registry keys on Borland C++ Builder?

Following an abbreviated Example for the Use of TRegistry
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
.
.
.

#include <Registry.hpp>
.
.
.
void __fastcall TForm1::Setup(TObject *Sender)
{
.
.
.
TRegistry *dbconfig;
.
.
.
    dbconfig=new TRegistry();
    dbconfig->CloseKey();
    dbconfig->RootKey=HKEY_LOCAL_MACHINE;
// Check if Key "First Time" exists

    if(dbconfig->KeyExists("SOFTWARE\\CBS\\FIRST_TIME"))
        {
// if yes Open the Path Data
// 1. Configuration Data Path
        if(dbconfig->OpenKey("Software\\CBS\\Path",false))
            {
            keystring=dbconfig->ReadString("Config");
            strcpy(parameter->cnfgpath,keystring.c_str());
            for (cnt=0;cnt<strlen( parameter->cnfgpath );cnt++)
                {
                if(parameter->cnfgpath[cnt]=='\\')
                    parameter->cnfgpath[cnt]='/';
                }
// 2. Program Path
            keystring=dbconfig->ReadString("Prog");
            strcpy(parameter->progpath,keystring.c_str());
            for (cnt=0;cnt<strlen( parameter->progpath );cnt++)
                {
                if(parameter->progpath[cnt]=='\\')
                    parameter->progpath[cnt]='/';
                }
// 3. Data Path
            keystring=dbconfig->ReadString("Data");
            strcpy(parameter->datapath,keystring.c_str());
            for (cnt=0;cnt<strlen( parameter->datapath );cnt++)
                {
                if(parameter->datapath[cnt]=='\\')
                    parameter->datapath[cnt]='/';
                }
            }
        else
            {
// If Key on Path data does not exist => Errormessage
            Application->MessageBox(parameter->Tofl[147],parameter->Tofl[91],MB_OK|MB_ICONHAND);
            }
        }
        dbconfig->CloseKey();
    dbconfig->RootKey=HKEY_CURRENT_USER;
    if(dbconfig->KeyExists("\\Software\\CBS\\LANGUAGE"))
        {
        if(dbconfig->OpenKey("\\Software\\CBS\\LANGUAGE",false))
            {
            parameter->language=dbconfig->ReadInteger("Langdef");
            }
        }
    else
        parameter->language=0;

    dbconfig->CloseKey();


     delete(dbconfig);
//==========================================================


hnd
hasso55@yahoo.com
 
 

RE: How can I insert registry keys on Borland C++ Builder?

(OP)
thank you very much for your help!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close