Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

telnet webbrowser

tijoentijoen Posts: 141Member
Hi
i used to be vb coder, trying to come a delphi one
i am trying to make a telnet using webbrowser
but i can't edit the innerhtml, i used vb and it did well, but it lags when the buffer get bigger
is there any example or something that can help me out with the edit form of webbrowser
i am newb :/

please, help me :)
«1

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hi
    : i used to be vb coder, trying to come a delphi one
    : i am trying to make a telnet using webbrowser
    : but i can't edit the innerhtml, i used vb and it did well, but it lags when the buffer get bigger
    : is there any example or something that can help me out with the edit form of webbrowser
    : i am newb :/
    :
    : please, help me :)
    :
    You need to first call Navigate() to create the necessary dispatch object. After that initial call you can edit the InnerHtml as you wish.
  • tijoentijoen Posts: 141Member
    : : Hi
    : : i used to be vb coder, trying to come a delphi one
    : : i am trying to make a telnet using webbrowser
    : : but i can't edit the innerhtml, i used vb and it did well, but it lags when the buffer get bigger
    : : is there any example or something that can help me out with the edit form of webbrowser
    : : i am newb :/
    : :
    : : please, help me :)
    : :
    : You need to first call Navigate() to create the necessary dispatch object. After that initial call you can edit the InnerHtml as you wish.
    :
    webbrowser1.navigate(wide_string('about:blank'));
    i tried these after navigate
    webbrowser1.document.body.innerthtml := 'Teste';
    webbrowser1.oleobject.document.innerhtml := 'teste';
    none worked

  • zibadianzibadian Posts: 6,349Member
    : : : Hi
    : : : i used to be vb coder, trying to come a delphi one
    : : : i am trying to make a telnet using webbrowser
    : : : but i can't edit the innerhtml, i used vb and it did well, but it lags when the buffer get bigger
    : : : is there any example or something that can help me out with the edit form of webbrowser
    : : : i am newb :/
    : : :
    : : : please, help me :)
    : : :
    : : You need to first call Navigate() to create the necessary dispatch object. After that initial call you can edit the InnerHtml as you wish.
    : :
    : webbrowser1.navigate(wide_string('about:blank'));
    : i tried these after navigate
    : webbrowser1.document.body.innerthtml := 'Teste';
    : webbrowser1.oleobject.document.innerhtml := 'teste';
    : none worked
    :
    :
    You need to type-case the document to an IHTMLDocument2 (MSHTML unit). Here is the code, which I ran successfully:
    [code]
    IHTMLDocument2(WebBrowser1.Document).body.innerHTML := 'test';
    [/code]
  • tijoentijoen Posts: 141Member
    : You need to type-case the document to an IHTMLDocument2 (MSHTML unit). Here is the code, which I ran successfully:
    : [code]
    : IHTMLDocument2(WebBrowser1.Document).body.innerHTML := 'test';
    : [/code]
    :
    i tried this:
    [code]procedure TfrmMain.FormCreate(Sender: TObject);
    begin
    wbbrowser.Navigate(WideString('about:blank'));
    IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    end;[/code]
    didn't work, error in telnet.exe bla bla
    i am studing it, so i found this:
    [code]procedure TfrmMain.FormCreate(Sender: TObject);
    begin
    wbbrowser.Navigate(WideString('about:blank'));
    while WbBrowser.ReadyState < READYSTATE_INTERACTIVE do
    Application.ProcessMessages;
    IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    end;[/code]
    then it worked...
    the "test" msg apeared, i would like to know what this "apllication.processmessages" did to it start working

  • tijoentijoen Posts: 141Member
    : : You need to type-case the document to an IHTMLDocument2 (MSHTML unit). Here is the code, which I ran successfully:
    : : [code]
    : : IHTMLDocument2(WebBrowser1.Document).body.innerHTML := 'test';
    : : [/code]
    : :
    : i tried this:
    : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : begin
    : wbbrowser.Navigate(WideString('about:blank'));
    : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : end;[/code]
    : didn't work, error in telnet.exe bla bla
    : i am studing it, so i found this:
    : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : begin
    : wbbrowser.Navigate(WideString('about:blank'));
    : while WbBrowser.ReadyState < READYSTATE_INTERACTIVE do
    : Application.ProcessMessages;
    : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : end;[/code]
    : then it worked...
    : the "test" msg apeared, i would like to know what this "apllication.processmessages" did to it start working
    :
    :
    now i am pasting the socket reading to the webbrowser
    but when the buffer get bigger, lag comes out
    here my read sub
    [code]procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
    var buffer:string;
    begin
    buffer := Socket.ReceiveText;
    IHTMLDocument2(WbBrowser.Document).body.innerHTML :=
    IHTMLDocument2(WbBrowser.Document).body.innerHTML + buffer;
    end;[/code]
    can you help me please?
  • zibadianzibadian Posts: 6,349Member
    : : You need to type-case the document to an IHTMLDocument2 (MSHTML unit). Here is the code, which I ran successfully:
    : : [code]
    : : IHTMLDocument2(WebBrowser1.Document).body.innerHTML := 'test';
    : : [/code]
    : :
    : i tried this:
    : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : begin
    : wbbrowser.Navigate(WideString('about:blank'));
    : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : end;[/code]
    : didn't work, error in telnet.exe bla bla
    : i am studing it, so i found this:
    : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : begin
    : wbbrowser.Navigate(WideString('about:blank'));
    : while WbBrowser.ReadyState < READYSTATE_INTERACTIVE do
    : Application.ProcessMessages;
    : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : end;[/code]
    : then it worked...
    : the "test" msg apeared, i would like to know what this "apllication.processmessages" did to it start working
    :
    :
    It does nothing but wait until the webbrowser is ready with the download. Only at the end of the download is the Document dispatch valid. Without the wait, the download starts in a separate thread, while the main thread tries to access the document, which doesn't exist yet.
  • zibadianzibadian Posts: 6,349Member
    : : : You need to type-case the document to an IHTMLDocument2 (MSHTML unit). Here is the code, which I ran successfully:
    : : : [code]
    : : : IHTMLDocument2(WebBrowser1.Document).body.innerHTML := 'test';
    : : : [/code]
    : : :
    : : i tried this:
    : : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : : begin
    : : wbbrowser.Navigate(WideString('about:blank'));
    : : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : : end;[/code]
    : : didn't work, error in telnet.exe bla bla
    : : i am studing it, so i found this:
    : : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : : begin
    : : wbbrowser.Navigate(WideString('about:blank'));
    : : while WbBrowser.ReadyState < READYSTATE_INTERACTIVE do
    : : Application.ProcessMessages;
    : : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : : end;[/code]
    : : then it worked...
    : : the "test" msg apeared, i would like to know what this "apllication.processmessages" did to it start working
    : :
    : :
    : now i am pasting the socket reading to the webbrowser
    : but when the buffer get bigger, lag comes out
    : here my read sub
    : [code]procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
    : var buffer:string;
    : begin
    : buffer := Socket.ReceiveText;
    : IHTMLDocument2(WbBrowser.Document).body.innerHTML :=
    : IHTMLDocument2(WbBrowser.Document).body.innerHTML + buffer;
    : end;[/code]
    : can you help me please?
    :
    This has several reasons. First it takes the socket longer to download a larger buffer. The second reason has something to do with the way the webbrowser gets the document. Each time you add a buffer, the entire (!) innerHTML is re-parsed. Since the innerHTML gets bigger and bigger, the parsing takes longer and longer.
    You can speed it up by using some sort of HTML index, which splits the innerHTML into smaller parts. Or you could first read the entire innerHTML into a separate string, and then parse the HTML into the webbrowser (thus removing the re-parse lag). Or if that fails buy a faster computer. The lag due to the net-communication speed is very hard to decrease, but it is possible using a compression algorithm.
  • tijoentijoen Posts: 141Member
    : : : : You need to type-case the document to an IHTMLDocument2 (MSHTML unit). Here is the code, which I ran successfully:
    : : : : [code]
    : : : : IHTMLDocument2(WebBrowser1.Document).body.innerHTML := 'test';
    : : : : [/code]
    : : : :
    : : : i tried this:
    : : : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : : : begin
    : : : wbbrowser.Navigate(WideString('about:blank'));
    : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : : : end;[/code]
    : : : didn't work, error in telnet.exe bla bla
    : : : i am studing it, so i found this:
    : : : [code]procedure TfrmMain.FormCreate(Sender: TObject);
    : : : begin
    : : : wbbrowser.Navigate(WideString('about:blank'));
    : : : while WbBrowser.ReadyState < READYSTATE_INTERACTIVE do
    : : : Application.ProcessMessages;
    : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML := 'test';
    : : : end;[/code]
    : : : then it worked...
    : : : the "test" msg apeared, i would like to know what this "apllication.processmessages" did to it start working
    : : :
    : : :
    : : now i am pasting the socket reading to the webbrowser
    : : but when the buffer get bigger, lag comes out
    : : here my read sub
    : : [code]procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
    : : var buffer:string;
    : : begin
    : : buffer := Socket.ReceiveText;
    : : IHTMLDocument2(WbBrowser.Document).body.innerHTML :=
    : : IHTMLDocument2(WbBrowser.Document).body.innerHTML + buffer;
    : : end;[/code]
    : : can you help me please?
    : :
    : This has several reasons. First it takes the socket longer to download a larger buffer. The second reason has something to do with the way the webbrowser gets the document. Each time you add a buffer, the entire (!) innerHTML is re-parsed. Since the innerHTML gets bigger and bigger, the parsing takes longer and longer.
    : You can speed it up by using some sort of HTML index, which splits the innerHTML into smaller parts. Or you could first read the entire innerHTML into a separate string, and then parse the HTML into the webbrowser (thus removing the re-parse lag). Or if that fails buy a faster computer. The lag due to the net-communication speed is very hard to decrease, but it is possible using a compression algorithm.
    :
    i know that i should do that alone, but i am rookie :/
    can you give me an example... please? please please please :D
  • tijoentijoen Posts: 141Member
    : : : now i am pasting the socket reading to the webbrowser
    : : : but when the buffer get bigger, lag comes out
    : : : here my read sub
    : : : [code]procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
    : : : var buffer:string;
    : : : begin
    : : : buffer := Socket.ReceiveText;
    : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML :=
    : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML + buffer;
    : : : end;[/code]
    : : : can you help me please?
    : : :
    : : This has several reasons. First it takes the socket longer to download a larger buffer. The second reason has something to do with the way the webbrowser gets the document. Each time you add a buffer, the entire (!) innerHTML is re-parsed. Since the innerHTML gets bigger and bigger, the parsing takes longer and longer.
    : : You can speed it up by using some sort of HTML index, which splits the innerHTML into smaller parts. Or you could first read the entire innerHTML into a separate string, and then parse the HTML into the webbrowser (thus removing the re-parse lag). Or if that fails buy a faster computer. The lag due to the net-communication speed is very hard to decrease, but it is possible using a compression algorithm.
    : :
    : i know that i should do that alone, but i am rookie :/
    : can you give me an example... please? please please please :D
    :
    is there anyway to add lines without copying all stuff ?
    liek richededit.addlines or something like it
    or a way to use string and free strings to my webbrowser

    please :)
  • zibadianzibadian Posts: 6,349Member
    : : : : now i am pasting the socket reading to the webbrowser
    : : : : but when the buffer get bigger, lag comes out
    : : : : here my read sub
    : : : : [code]procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
    : : : : var buffer:string;
    : : : : begin
    : : : : buffer := Socket.ReceiveText;
    : : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML :=
    : : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML + buffer;
    : : : : end;[/code]
    : : : : can you help me please?
    : : : :
    : : : This has several reasons. First it takes the socket longer to download a larger buffer. The second reason has something to do with the way the webbrowser gets the document. Each time you add a buffer, the entire (!) innerHTML is re-parsed. Since the innerHTML gets bigger and bigger, the parsing takes longer and longer.
    : : : You can speed it up by using some sort of HTML index, which splits the innerHTML into smaller parts. Or you could first read the entire innerHTML into a separate string, and then parse the HTML into the webbrowser (thus removing the re-parse lag). Or if that fails buy a faster computer. The lag due to the net-communication speed is very hard to decrease, but it is possible using a compression algorithm.
    : : :
    : : i know that i should do that alone, but i am rookie :/
    : : can you give me an example... please? please please please :D
    : :
    : is there anyway to add lines without copying all stuff ?
    : liek richededit.addlines or something like it
    : or a way to use string and free strings to my webbrowser
    :
    : please :)
    :
    You need to add a new string field to the form containing the webbrowser and the socket. Then in the SocketRead() event you change the code to:
    [code]
    procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
    var buffer:string;
    begin
    buffer := Socket.ReceiveText;
    HTMLBuffer := HTMLBuffer + buffer;
    end;
    [/code]
    Once the socket has finished reading the text you perfrom an assignment to the innerHTML. I don't know exactly which event is fired, when a socket is finished receiving data.
«1
Sign In or Register to comment.