Главная страница
    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.041 c
11-1190391967
MTsv DN
2007-09-21 20:26
2008.06.29
Как "вырезать" файл в Clipboard???


2-1212250427
Proxytel
2008-05-31 20:13
2008.06.29
Клавиатурный логер. Блокируется курсор...


8-1182507646
leonidus
2007-06-22 14:20
2008.06.29
Ищу библиотеку для работы с RAW-файлами


2-1212401918
MaryM
2008-06-02 14:18
2008.06.29
Связать данные с TtreeView ом?


9-1171446585
Vemer
2007-02-14 12:49
2008.06.29
Какие режимы OpenGl надо включить?





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский