trichview.com

trichview.support




Re: TRichviewEdit in DLL


Return to index


Author

Message

Sergey Tkachenko

Posted: 06/22/2004 19:19:33


I found your e-mail.


The problem is because styles (specifically the error is because of list

styles) are not saved in RVF with document.

RVStyle in DLL does not have any list styles, but your document has 4 list

styles.

Solution: right click rve on Form1 in Delphi, choose "Settings" in the

context menu, select "Allow adding styles dynamically".


But in your case this problem is not solved.

RVF written by rve.SaveRVFToStream(St, false); (in procedure rvefunc) is

incorrect.

Why?

TRichView uses standard Delphi streaming mechanism for storing styles (and

some other entries in RVF), but this mechanism fails when called in DLL for

class created in the main program (i.e. rve).

This is because Delphi program does not understand that TRichViewEdit in DLL

and TRichViewEdit in the main application are the same classes! And the same

for all other classes.


Make a test.

Change the declaration of your procedure to

procedure rvefunc(AppHandle: HWND; rve: TCustomRichViewedit); stdcall;

and add at the beginning of this procedure:


  if not (rve is TRichViewEdit) then

    Application.MessageBox('Surprise!', 'Message', 0);


Run the application and you'll see that this message is shown.


The best solution is to store RVF to stream in the main application and pass

this stream (or better Stream.Memory) in dll procedure instead of rve.


>

> I've send you the demo yesterday. Please take a look. Thanks.





Powered by ABC Amber Outlook Express Converter