procedure TForm1.Button1Click(Sender: TObject);
var
lphKey: HKEY;
sKeyName: string;
sKeyValue: string;
begin
sKeyName := 'myfile';
sKeyValue := '我的文档';
RegCreateKey(HKEY—CLASSES—ROOT, pchar(sKeyName), lphKey);
RegSetValue(lphKey, '', REG—SZ, pchar(sKeyValue), 0);
sKeyName := '.xyz';
sKeyValue := 'myfile';
RegCreateKey(HKEY—CLASSES—ROOT, pchar(sKeyName), lphKey);
RegSetValue(lphKey, '', REG—SZ, pchar(sKeyValue), 0);
sKeyName := 'myfile';
sKeyValue := 'c:\Windows\NotePad.exe %1';
RegCreateKey(HKEY—CLASSES—ROOT, pchar(sKeyName), lphKey);
RegSetValue(lphKey, 'shell\open\command', REG—SZ, pchar(sKeyValue), MAX—PATH);
end;