Link to home
Start Free TrialLog in
Avatar of drama22
drama22

asked on

delphi and embeddedwb

hi i have chat application that cleint send message and show it to other connected clients in  tmemo  iam done with the application but i decided to change the TMEMO WITH Tembeddedwb  but i dont know how to get it work i found example like this

procedure addChatText(WB: TEmbeddedWB; const html: string;add:integer = 0);
var
   Range: IHTMLTxtRange;
   mText : string;
   ext : string;
   sURL : string;
   i : Integer;
begin
  if not joined then Exit;

  if Not Assigned(Wb.Document) then exit;
  Range := ((WB.Document AS IHTMLDocument2).body AS IHTMLBodyElement).createTextRange;
  Range.Collapse(False) ;

  if add = 1 then
  begin
    if ChatContent <> nil then
    begin
      ChatContent.Add(html+'<BR>');
      mText := ChatContent.Text;
    end else
    begin
      mText := html+'<BR>';
    end;
  end else begin
    mText := html+'<BR>';
  end;

  if ChatContent <> nil then
  begin
    if ChatContent.Count > ChatContentTotal then
    begin
      for i := 0 to 10 do
      begin
        ChatContent.Delete(0);
      end;
    end;
//   while (ChatContent.Count) > ChatContentTotal do ChatContent.Delete(0);
  end;
end;{ * chatPMAppend *}

Open in new window



but that doesn't work in delphi xe5 i did not recive any message that i sent

i send message like this

addChatText(weblog,'<span class="Name">'+Name+':</span> '+ message,1);

Open in new window


Note : Weblog is my  Tembeddedwb .
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

TEmbeddedWB is a quite large - try use smaller HtmlViewer component. You need to be sure what you post o ewb/html viewer. Try save to file first as html file and try to open in common web browser. Sometimes you need to have common html header at top...
Avatar of drama22
drama22

ASKER

Html viewer can show embedded youtube videos ? If yes can I have sample code of how client message can be showing after they send it ,, I know its sounds very odd but iam very beginner to understand everybthing without code sample .
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of drama22

ASKER

that not what i need i test it before  not doing the job the code above that i post in my main question would be helpful if some fixes added but thats not solve for the main need ..
Grab html encoded text form one user and send to another (code in older question) (from one ewb to another ewb)
Avatar of drama22

ASKER

Better yet xan I grab the messages from tmemo and show it in embeddedwb ?
like this:
if EditDesigner1.ConnectDesigner = S_OK then
  begin
     EmbeddedWB1.LoadFromStrings(Memo1.Lines);
  end;

Open in new window