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

Вниз

REG_MULTI_SZ   Найти похожие ветки 

 
Jon ©   (2007-12-03 04:26) [0]

Can you please provide an example of how to read registry key of type REG_MULTI_SZ. I have tried RegKeyGetBinary but I do not know how to transfer value out of buffer. The data is transferred to a PChar, but then I get a Runtime Error.


 
Дмитрий К ©   (2007-12-03 05:25) [1]

program Project1;

uses
 Windows, KOL;

var Key: HKey; S: string; Count: Cardinal;
begin
 Key := RegKeyOpenRead(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control");
 try
   Count := RegKeyGetBinary(Key, "PreshutdownOrder", S, 0);
   SetLength(S, Count);
   RegKeyGetBinary(Key, "PreshutdownOrder", Pointer(S)^, Count);
   while StrReplace(S, #0, #13#10) do;
   MsgOK(S);
 finally
   RegKeyClose(Key);
 end;
end.


 
Jon ©   (2007-12-03 05:43) [2]

Thank you very much.


 
Jon ©   (2007-12-03 13:16) [3]

Does there exist a method within KOL to write REG_MULTI_SZ?
Using RegKeySetBinary results in key type of REG_BINARY.


 
Дмитрий К ©   (2007-12-03 14:06) [4]

AFAIK there does not. Try this:
function RegKeySetStrMulti(Key: HKey; const ValueName: KOLString; const Value: KOLString): Boolean;
begin
 Result := (Key <> 0) and (RegSetValueEx(Key, PKOLChar(ValueName), 0, REG_MULTI_SZ,
           PKOLChar(Value), (Length(Value) + 1)*Sizeof(KOLChar)) = ERROR_SUCCESS);
end;


 
Jon ©   (2007-12-03 16:38) [5]

Thanks again. I did use RegSetValueEx, but I thought that I had missed in KOL.pas - maybe this will be included in the next version ;-)



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

Форум: "KOL";
Текущий архив: 2009.01.18;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.005 c
6-1197449836
AnatV
2007-12-12 11:57
2009.01.18
Как это называется?


2-1228517788
Ksander
2008-12-06 01:56
2009.01.18
Как взять данные с указателя?


2-1228144125
St1m
2008-12-01 18:08
2009.01.18
Наследник TForm


1-1205853001
Ega23
2008-03-18 18:10
2009.01.18
Наследование фреймов - подводные камни


4-1204111796
POP
2008-02-27 14:29
2009.01.18
Как узнать скорость USB - COM порта?





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