Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2008.06.29;
Скачать: CL | DM;

Вниз

Пример ключа в реестр   Найти похожие ветки 

 
Pi:=3.14...   (2008-05-31 12:10) [0]

Пожалуйста. Напишите пример кода как добавить ключь в реестр.Заранее спасибоnull


 
engine ©   (2008-05-31 12:19) [1]

This OnClick event handler adds the value specified in the ValueforKey edit box to the registry key specified by the NameofKey edit box. If the named key does not already exist, it creates one. (Note that if you don’t want to give the user a choice, this could be accomplished more simply by setting the CanCreate parameter of the OpenKey call to true).

procedure TForm1.Button1Click(Sender: TObject);
var
 Reg: TRegIniFile;
begin
 if Length(NameofKey.Text) or Length(ValueforKey.Text) <=0 then
   Showmessage("Either the key name or value is missing.")
 else begin
   Reg:=TRegIniFile.Create("MyApp");
   try
     Reg.RootKey:=HKey_Local_Machine; // Section to look for within the registry
     if not Reg.OpenKey(NameofKey.Text,False) then
       if MessageDlg("The specified key does not exist, create it?"

                ,Mtinformation,[mbYes,mbNo],0)=mryes then
       begin
         Reg.CreateKey(NameofKey.Text);
         if not Reg.OpenKey(NameofKey.Text,False) then
           ShowMessage("Error in Opening Created Key")
         else
           Reg.WriteString("Main Section","Value1",ValueForKey.Text);
       end
    else
      Reg.WriteString("Main Section","Value1",ValueForKey.Text);
   finally

     Reg.Free;
   end;
 end;
end;


 
Loginov Dmitry ©   (2008-05-31 12:34) [2]

>     if not Reg.OpenKey(NameofKey.Text,False) then
>       if MessageDlg("The specified key does not exist,
> create it?"


С чего такой однозначный вывод: "The specified key does not exist"?


 
engine ©   (2008-05-31 12:49) [3]

> [2] Loginov Dmitry ©   (31.05.08 12:34)

Этот вопрос к разработчикам справки Delphi


 
LightRipple ©   (2008-05-31 13:05) [4]

> [3] engine ©   (31.05.08 12:49)
> Этот вопрос к разработчикам справки Delphi

Это где ты такую "справку Delphi" нашел ?


 
engine ©   (2008-05-31 13:23) [5]

Delphi 7


 
LightRipple ©   (2008-05-31 13:27) [6]

> [5] engine ©   (31.05.08 13:23)
> Delphi 7

> Offtop
Что-то меня за сегодня уже второй раз в справку Delphi 7 посылают.
Видать к дождю :) Нет у меня на компьютере Delphi 7 - не могу проверить :)


 
Leonid Troyanovsky ©   (2008-05-31 15:33) [7]


> engine ©   (31.05.08 12:49) [3]

> Этот вопрос к разработчикам справки Delphi

>          Reg.CreateKey(NameofKey.Text);
>          if not Reg.OpenKey(NameofKey.Text,False) then
>            ShowMessage("Error in Opening Created Key")

А это из какой справки?

Может, все же
if not Reg.OpenKey(NameofKey.Text, True) then
 ShowMessage("The registry key could not be opened or created.")

--
Regards, LVT.


 
имя   (2008-06-03 23:10) [8]

Удалено модератором


 
имя   (2008-06-04 00:26) [9]

Удалено модератором



Страницы: 1 вся ветка

Текущий архив: 2008.06.29;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.022 c
15-1210936135
Kolan
2008-05-16 15:08
2008.06.29
SQLite не может получить доступ на Висте, почему?


15-1211024318
may be I am noob...
2008-05-17 15:38
2008.06.29
Вопрос по Apache (.htaccess)


15-1210800305
Антенна
2008-05-15 01:25
2008.06.29
Коды


2-1212152946
Dmitry
2008-05-30 17:09
2008.06.29
Регулярные выражения


3-1201096295
stud
2008-01-23 16:51
2008.06.29
композитный отчет quickreport