2009. november 20., péntek

Open a webpage in a webbrowser that's allready active


Problem/Question/Abstract:

Open a webpage in a webbrowser that's allready active.

Answer:

{
This opens a webpage in a browser window that's allready active.
I found the code somewhere on the borland site.
}

procedure GotoWebPage;
var
  DDE: TDDECLientConv;
  URL: string;
  URLFired: Boolean;
begin
  URL := 'http://www.hotbot.com';

  DDE := TDDEClientConv.Create(nil);
  try
    DDE.ServiceApplication := 'iexplore';

    if DDE.SetLink('iexplore', 'WWW_OpenURL') then
      if DDE.RequestData(URL + ',,1') <> nil then
        if DDE.SetLink('iexplore', 'WWW_Activate') then
          URLFired := DDE.RequestData('0,0') <> nil;
  finally
    DDE.Free;
  end;
end;

Nincsenek megjegyzések:

Megjegyzés küldése