void __fastcall TRegAssociationsForm::ButtonExitClick(TObject *Sender) { TRegistry * reg = new TRegistry (); try { reg->RootKey = HKEY_LOCAL_MACHINE; if (reg->KeyExists("\\SOFTWARE\\Gis center\\Journal\\Associations")) reg->DeleteKey("\\SOFTWARE\\Gis center\\Journal\\Associations"); reg->OpenKey ("\\SOFTWARE\\Gis center\\Journal\\Associations", true); for (int row = 1; row < ValueListEditorAssoc->RowCount; row++) { reg->WriteString (ValueListEditorAssoc->Cells [0][row], ValueListEditorAssoc->Cells [1][row]); } reg->CloseKey(); } __finally { safe_delete (reg); //delete reg; } }
//--------------------------------------------------------------------------- AnsiString CheckOffice() { AnsiString S=""; TRegistry *Registry = new TRegistry; Registry->RootKey = HKEY_LOCAL_MACHINE; if (Registry->KeyExists("SOFTWARE\\Microsoft\\Office\\9.0\\Word")) S="MSO"; if (Registry->KeyExists("SOFTWARE\\Microsoft\\Office\\10.0\\Word")) S="MSO"; if (Registry->KeyExists("SOFTWARE\\Microsoft\\Office\\11.0\\Word")) S="MSO"; if (Registry->KeyExists("SOFTWARE\\Microsoft\\Office\\12.0\\Word")) S="MSO"; if (Registry->KeyExists("SOFTWARE\\OpenOffice.org\\OpenOffice.org")) S="OO"; delete Registry; return S; }