Solved

DHTMLEdit problem

Posted on 2002-07-20
1
665 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now