C++ Builder 将组件写入数据库,动态加载

C++ Builder`WriteComponentResFile`


```cpp
// 
void SaveFormToDatabase(TForm* Form, TDatabase* Database)
{
    // 
    TResourceStream* ResStream = new TResourceStream(HInstance, MAKEINTRESOURCE(101));

    try
    {
        // 
        Form->WriteComponentResFile(ResStream);

        // 
        TBlobField* BlobField = new TBlobField(NULL, ftBlob);
        BlobField->LoadFromStream(ResStream);
        Database->TableDefs->Add('FRME', BlobField);
    }
    __finally
    {
        delete ResStream;
    }
}

// 
void LoadFormFromDatabase(TForm* Form, TDatabase* Database)
{
    // 
    TBlobField* BlobField = dynamic_cast(Database->TableDefs->FindField('FRME'));
    if (BlobField != NULL)

你可能感兴趣的:(物联网+环保,C++,数据库,c++,c++,builder)