Solved

DHTMLEdit problem

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 108
Delphi XE2 application frozen on Windows 10 10 311
Downloading email attachments 2 73
Tviruailstringtree sort multi columns on header click 1 63
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

772 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