Solved

DHTMLEdit problem

Posted on 2002-07-20
1
674 Views
Last Modified: 2008-03-17
//DHTMLEdit problem

//Problem is when I try to free DHTMLEdit !
//Problem is as You see DHTMLEdit1DisplayChanged procedure.
//Can You fix it ?

//Thanks.

procedure TMainForm1.DHTMLEdit1DisplayChanged(Sender: TObject);
var
  ovFontName, ovFontStyle, ovFontStyles,ovFontSize, ovInVar: OleVariant;
  FontNameStatus: DWORD;
  FontSizeStatus: DWORD;
  StyleNameStatus: DWORD;
  vo: OleVariant;
  pValue: OleVariant;
begin
sasadhtmleditmess:='Pass';
if sasaclosecommand<>'Close' then
begin
  if not (TObject(Componentlist[ICount]) is TDHTMLEdit) then
  exit;
if TDHTMLEdit(ComponentList[ICount]).DOM.selection.type_ = 'Text' then
try
  ToolButton39.Down := ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_BOLD) and DECMDF_LATCHED) = DECMDF_LATCHED);
  ToolButton40.Down := ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_ITALIC) and DECMDF_LATCHED) = DECMDF_LATCHED);
  ToolButton41.Down := ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_UNDERLINE) and DECMDF_LATCHED) = DECMDF_LATCHED);

  ToolButton5.Enabled := ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_UNDO) and DECMDF_ENABLED) = DECMDF_ENABLED);
  ToolButton15.Enabled := ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_REDO) and DECMDF_ENABLED) = DECMDF_ENABLED);

if ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_GETFONTNAME) and DECMDF_DISABLED) = DECMDF_DISABLED) then
begin
ovFontName := TDHTMLEdit(ComponentList[ICount]).ExecCommand(DECMD_GETFONTNAME, OLECMDEXECOPT_DODEFAULT, ovInVar);
ComboBox1.Text:=ovFontName;
end;


if ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_GETFONTSIZE) and DECMDF_DISABLED) = DECMDF_DISABLED) then
begin
ovFontSIZE := TDHTMLEdit(ComponentList[ICount]).ExecCommand(DECMD_GETFONTSIZE, OLECMDEXECOPT_DODEFAULT, ovInVar);
ComboBox3.Text:=ovFontSize;
end;


ovFontStyles := TDHTMLEdit(ComponentList[ICount]).ExecCommand(DECMD_GETBACKCOLOR, OLECMDEXECOPT_DODEFAULT, ovInVar);

//showmessage(ovFontStyles);//ColorDialog1.Color:=ovFontStyles;

ovFontStyles := TDHTMLEdit(ComponentList[ICount]).ExecCommand(DECMD_GETFORECOLOR, OLECMDEXECOPT_DODEFAULT, ovInVar);

//ColorDialog2.Color:=ovFontStyles;
if ((TDHTMLEdit(ComponentList[ICount]).QueryStatus(DECMD_GETBLOCKFMT) and DECMDF_DISABLED) = DECMDF_DISABLED) then
begin
ovFontStyle := TDHTMLEdit(ComponentList[ICount]).ExecCommand(DECMD_GETBLOCKFMT, OLECMDEXECOPT_DODEFAULT, ovInVar);
ComboBox2.Text:=ovFontStyle;
end;
except
end;
end;
sasadhtmleditmess:='';

end;
0
Comment
Question by:cvbn
1 Comment
 
LVL 2

Accepted Solution

by:
vbmn earned 300 total points
ID: 7166441
did you try this one ?

I was able to solve this problem by changing the code in DHTMLEDLIB_TBL.PAS
getControlInterface
as follows:

function TDHTMLEdit.getControlInterface : iDHTMLEdit;
var
idsp : iDispatch;
begin
idsp := iDispatch(OleObject);
idsp.QueryInterface( IID_iDHTMLEdit, result );
end;

And you can try adding these lines to the bottom of your unit:

initialization
OleInitialize(nil);

finalization
OleUninitialize;

And if You use OnMessage:

application.onmessage:=nil;
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 104
Strange behavior when a form is closed 6 61
Convert MS Word document to a PDF file 9 92
Delphi problems to abort a printjob 9 25
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question