开发者

Delphi Streaming Problem

I'm using a blob field in a kbmMemTable to store a custom component that I've developed from TComponent and I use the read and write component stream methods of 开发者_StackOverflowthe TReader to read and write the component to the blob field. The data in the kbmMemTable is eventually stored inside a structured storage file created by GpStructuredStorage.

This has worked flawlessly, until I moved my component (along with the kbmMemtable) to a new application and tried to have the new application read the blob field. At first I was getting a component naming error (component name already exists), but later I started getting an Access Violation when the TReader tries to read a TPersistent property of my component.

As far as I know, I did not change anything with regards to the way I retrive the kbmMemTable data from the gpStructuredStorage file and the way I read the component back from the blob field using TReader. I've made no changes to the component and, I don't seem to have any problem with other components that I'm storing in other blob fields in the same table (at least I'm not getting any errors when they are read back).

I'm miffed at what could be the problem. Any help / suggestion would be greatly appreciated. I am using Delphi 2007.


Another guess. Your component name is collited with other/different one. To resolve this, always make your unit(s) after other thirst party ones: example:

from: SysUtils, YourUnitClass, Classes;
to: SysUtils, Classes, YourUnitClass;

and make sure to register your component

initialization
  RegisterClasses([TYourComponentClass]);

finalization
  UnRegisterClasses([TYourComponentClass]);

Gook luck


This is just a guess, but it sounds like the component class definition in the new application does not match that of the component that you're streaming.


I finally figured out what caused the streaming problem - although I am not sure why so perhaps someone can throw a light on this issue. I decided to check if the problem could be caused by some of the new 3rd party components I was using and lo and behold, when I disabled a skinning component (which was going to be an improvement in my new app!), everything worked as it should have. By disabling I mean I did not remove it from the program, I just made it so that the compressed skins were no longer used to paint the windows and the controls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜