Get Firefox DLL Ddeclient Source Code

Asked

Viewed 250 times

2

I know it is possible to capture the FIREFOX URL using Ddeclient, but someone else has already used it to get the source code of the open page ?

Follow the code to capture the title:

procedure TForm1.GetCurrentURL(var sURL: String; var sTitle: String; var sSource: String);
var
DDEClient : TDDEClientConv;
s : String;
begin
s := '';
try
DDEClient := TDDEClientConv.Create(self);
with DDEClient do
begin
if SetLink('IExplore','WWW_GetWindowInfo') then
begin
s := RequestData('0xFFFFFFFF, sURL, sTitle');
sSource := 'Source: IE';
end
else
if SetLink('Netscape','WWW_GetWindowInfo') then
begin
s := RequestData('0xFFFFFFFF, sURL, sTitle');
sSource := 'Source: IE';
end
else
if SetLink('Mosaic','WWW_GetWindowInfo') then
begin
s := RequestData('0xFFFFFFFF, sURL, sTitle');
sSource := 'Source: Mosaic';
end
else
if SetLink('Chrome','WWW_GetWindowInfo') then
begin
s := RequestData('0xFFFFFFFF, sURL, sTitle');
sSource := 'Source: Netscape 6';
end
else
if SetLink('Mozilla','WWW_GetWindowInfo') then
begin
s := RequestData('0xFFFFFFFF, sURL, sTitle');
sSource := 'Source: Mozilla';
end
else
if SetLink('Firefox','WWW_GetWindowInfo') then
begin
s := RequestData('0xFFFFFFFF, sURL, sTitle, sSource');
sSource := 'Source: FireFox';
end;
end;
if s <> '' then
begin
Delete(s, 1, 1);
sURL := 'URL: ' +Copy(s, 1, pos('","',s)-1);
Delete(s, 1, Pos('","', s)+2);
sTitle := 'Title: ' +Copy(s, 1, Pos('"', s) - 1);
end;
exit;
except
MessageDlg('URL attempt failed!',mtError,[mbOK],0);
end;
end;

To Use:

  procedure TForm1.Button1Click(Sender: TObject);
var
sURL, sTitle, sSource: String;
begin
GetCurrentURL(sURL, sTitle, sSource);
Memo1.Lines.Add(sURL);
Memo1.Lines.Add(sTitle);
Memo1.Lines.Add(sSource);
end;
  • boy, stop using DDE ;)

  • @Embarbosa, still I did not find the solution to capture the firefox source by Delphi rsrsrs..

  • The way the question was asked seemed like you are wanting to "spy" on what the user is doing while browsing. I think it’ll be hard for anyone to want to help you. However, you could use a component like Twebbrowser to have the user navigate through your application. The case would be different...

  • It’s not this @Embarbosa, if it was for this, would use several software ready to sell the internet and would not waste time with this, is that I’m making an advertising system, and only managed to make work in IE, FIREFOX could not. Just that. I updated the answer, see.

1 answer

1

If you already have the URL, to get the source do the following:

  1. Add a idHttp at the Form;
  2. Add a Memo at the Form;
  3. Perform the following:
Memo1.text :=   IdHTTP1.Get('URL DESEJADA');

Your source will be in Memo.

  • I don’t have the URL, it will be the URL that is open in the browser Mozilla. That’s why I need to work with Ddeclient.

  • Right, you asked how to get the font, because the URL you knew how to get. If you want to edit the answer with the function to capture the url also by Ddeclient.

  • But I only saw this actually working on IE. The premise is that you had managed to make it work on firefox. :)

  • Is it not possible to do it in firefox via Ddeclient @Filipe.Fonseca ? I know that the FIREFOX title can be captured by Ddeclient.

  • Post this function that takes the title that I try to adapt for you.

  • I updated the answer, see.... I hope you can help me out!

  • managed to do something ?

  • @user7605 with the routine you get the URL, with the URL you can by the method I gave you get the source!

  • any page that I put on the GET address even globe.com, or google.com, it from the Forbiden error, because it will be ?

  • Already solved @Filipe.Fonseca, thanks!

  • Have you solved it? Could you put an answer so that other people can be helped?

Show 6 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.