Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Начинающим";
Текущий архив: 2008.06.29;
Скачать: [xml.tar.bz2];

Вниз

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

 
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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.046 c
3-1200914554
Mike Kouzmine
2008-01-21 14:22
2008.06.29
"Внебрачные отношения."


2-1212586709
Михаил
2008-06-04 17:38
2008.06.29
Помогите с формой


2-1212153367
assassin8899
2008-05-30 17:16
2008.06.29
Access


15-1210747700
Stas
2008-05-14 10:48
2008.06.29
Купили fastreport4 и fastreport server


2-1212308588
leonidus
2008-06-01 12:23
2008.06.29
Как определить что мое окно наверху?





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский