Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

REG_MULTI_SZ


Jon ©   (2007-12-03 04:26:00) 

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.


Jon   (2007-12-03 16:38:00) [1]

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 ;-)


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

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 13:16:00) [3]

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


Jon   (2007-12-03 05:43:00) [4]

Thank you very much.


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

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.


Наверх

Титульная страница Поиск, карта сайта Написать письмо