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
Comments
: 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.
: : 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
: : : 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]
: [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
: : [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?
: : [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.
: : : [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.
: : : : [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
: : : 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
:
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
: : : : 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
: :
: 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.
: : : : : 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
: : :
: : 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.
:
i had an idea, but it didn't work, it still lagging me out
i put a richedit in the form, invisible one
look my receiving sub:
[code]procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
var buffer, buf, copy:string;
x, y, start:integer;
begin
buffer := Socket.ReceiveText;
edit.Lines.Add(buf);
IHTMLDocument2(WbBrowser.Document).body.innerHTML := edit.text;
end;[/code]
then i tried not using the webbrowser as buffer, the richedit didn't lag me, no matter how much i flooded...
i need to debug this
help me hehe
please
procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
var buffer, buf, copy:string;
x, y, start:integer;
begin
buffer := Socket.ReceiveText;
edit.Lines.Add(buf);
IHTMLDocument2(WbBrowser.Document).body.innerHTML := edit.text;
end;
[/code]
This code still buffers the data through the webbrowser, because it still assigns the innerHTML. Remove the last line, and place it in an event, which signals the end of the [red]entire[/red] download.
Also, why use a richedit for a buffer, if you just need a string. A richedit is quite a drain on system resources, which again slows the process down.
: procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
: var buffer, buf, copy:string;
: x, y, start:integer;
: begin
: buffer := Socket.ReceiveText;
: edit.Lines.Add(buf);
: IHTMLDocument2(WbBrowser.Document).body.innerHTML := edit.text;
: end;
: [/code]
: This code still buffers the data through the webbrowser, because it still assigns the innerHTML. Remove the last line, and place it in an event, which signals the end of the [red]entire[/red] download.
: Also, why use a richedit for a buffer, if you just need a string. A richedit is quite a drain on system resources, which again slows the process down.
:
[code]
procedure TfrmMain.SocketRead(Sender: TObject; Socket: CustomWinSocket);
var buffer:string;
begin
buffer := Socket.ReceiveText;
HTMLbuffer := HTMLbuffer + buffer;
display_text;
end;[/code]
[code]
procedure TfrmMain.Display_Text;
BEGIN
IHTMLDocument2(WbBrowser.Document).body.innerHTML := HTMLbuffer;
END;
[/code]
this still lagged the entire project
i used just the richededit to test... and it didn't lag me, i flooded it a lot :P
i dunno what to do
i did other test, i put a buttonclick2, and inside it this code:
[code]
procedure TfrmMain.Button2Click(Sender: TObject);
begin
HTMLbuffer := '';
IHTMLDocument2(WbBrowser.Document).body.innerHTML := HTMLbuffer;
end;
[/code]
and when the lag comes, i clicked it, then the lag disapeared, then i flooded it again and the lag came again
its the webbrowser buffer that lags me, i don't know what to do
do u?
please
: : procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
: : var buffer, buf, copy:string;
: : x, y, start:integer;
: : begin
: : buffer := Socket.ReceiveText;
: : edit.Lines.Add(buf);
: : IHTMLDocument2(WbBrowser.Document).body.innerHTML := edit.text;
: : end;
: : [/code]
: : This code still buffers the data through the webbrowser, because it still assigns the innerHTML. Remove the last line, and place it in an event, which signals the end of the [red]entire[/red] download.
: : Also, why use a richedit for a buffer, if you just need a string. A richedit is quite a drain on system resources, which again slows the process down.
: :
: [code]
: procedure TfrmMain.SocketRead(Sender: TObject; Socket: CustomWinSocket);
: var buffer:string;
: begin
: buffer := Socket.ReceiveText;
: HTMLbuffer := HTMLbuffer + buffer;
: display_text;
: end;[/code]
: [code]
: procedure TfrmMain.Display_Text;
: BEGIN
: IHTMLDocument2(WbBrowser.Document).body.innerHTML := HTMLbuffer;
: END;
: [/code]
: this still lagged the entire project
: i used just the richededit to test... and it didn't lag me, i flooded it a lot :P
: i dunno what to do
: i did other test, i put a buttonclick2, and inside it this code:
: [code]
: procedure TfrmMain.Button2Click(Sender: TObject);
: begin
: HTMLbuffer := '';
: IHTMLDocument2(WbBrowser.Document).body.innerHTML := HTMLbuffer;
: end;
: [/code]
: and when the lag comes, i clicked it, then the lag disapeared, then i flooded it again and the lag came again
: its the webbrowser buffer that lags me, i don't know what to do
: do u?
: please
:
You still get the lag, because you still send the text to the webbrowser after each buffer-read. Try this:
[code]
: procedure TfrmMain.SocketRead(Sender: TObject; Socket: CustomWinSocket);
: var buffer:string;
: begin
: buffer := Socket.ReceiveText;
: HTMLbuffer := HTMLbuffer + buffer;
: end;
: procedure TfrmMain.Button2Click(Sender: TObject);
: begin
: IHTMLDocument2(WbBrowser.Document).body.innerHTML := HTMLbuffer;
: end;
: [/code]
You will have to click the button to display the html-text, but this code will not display it, while it is downloading.
: [code]
: : procedure TfrmMain.SocketRead(Sender: TObject; Socket: CustomWinSocket);
: : var buffer:string;
: : begin
: : buffer := Socket.ReceiveText;
: : HTMLbuffer := HTMLbuffer + buffer;
: : end;
:
: : procedure TfrmMain.Button2Click(Sender: TObject);
: : begin
: : IHTMLDocument2(WbBrowser.Document).body.innerHTML := HTMLbuffer;
: : end;
: : [/code]
: You will have to click the button to display the html-text, but this code will not display it, while it is downloading.
:
it didn't work, when i hit the button to display the text, it lags me if the text of the HTMLbuffer is big
it isn't my computer, its athlon 2.0 256 ram gforce bla bla
dunno what to do, is there any other HTML that i can use
or anyway to stop this freaking lag in my project
can you try to build a telnet with webbrowser and flood it yourself, you aparently be a great coder, would debug it easy, me = sux
anyway thanks for the help... you rock