Howdy, Stranger!

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

Categories

How to launch the default Web browser

I need to know how could I launch the default web browser (& of course an URL) from my application written in Delphi 3? Please!(and excuse my bad english).

Comments

  • zibadianzibadian Member Posts: 6,349
    : I need to know how could I launch the default web browser (& of course an URL) from my application written in Delphi 3? Please!(and excuse my bad english).
    :
    Here is a small code, which shows google in your browser. In case of IE, if it is already open, this code will focus the last IE window and open the url provided. I haven't got Netscape, so I don't know what happens with that. Otherwise it should create a new browser window and open the URL.
    [code]
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ShellExecute(Handle,nil,'http://www.google.com',nil,nil,sw_Show);
    end;
    [/code]
  • cycordcycord Member Posts: 148

    [code]
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ShellExecute(Handle,nil,'http://www.google.com',nil,nil,sw_Show);
    end;
    [/code]

    i have the same problem, i have writen this, but without success, maybe you are better than me, if it will run please can you post it for me...... thanks

    [code]
    procedure TForm1.WebBrowser1NewWindow2(Sender: TObject;
    var ppDisp: IDispatch; var Cancel: WordBool);
    var
    NewWindow: TForm1;

    begin
    NewWindow := TForm1.Create(self);

    NewWindow.Show;
    ShellExecute(NewWindow,nil,Webbrowser1.DefaultDispatch,nil,nil,sw_Show);

    //ppDisp := NewWindow.Webbrowser1.DefaultDispatch;
    //ppDisp.ShellExecute(Webbrowser1.DefaultDispatch);

    end;

    [/code]
  • zibadianzibadian Member Posts: 6,349
    :
    : [code]
    : procedure TForm1.Button1Click(Sender: TObject);
    : begin
    : ShellExecute(Handle,nil,'http://www.google.com',nil,nil,sw_Show);
    : end;
    : [/code]
    :
    : i have the same problem, i have writen this, but without success, maybe you are better than me, if it will run please can you post it for me...... thanks
    :
    : [code]
    : procedure TForm1.WebBrowser1NewWindow2(Sender: TObject;
    : var ppDisp: IDispatch; var Cancel: WordBool);
    : var
    : NewWindow: TForm1;
    :
    : begin
    : NewWindow := TForm1.Create(self);
    :
    : NewWindow.Show;
    : ShellExecute(NewWindow,nil,Webbrowser1.DefaultDispatch,nil,nil,sw_Show);
    :
    : //ppDisp := NewWindow.Webbrowser1.DefaultDispatch;
    : //ppDisp.ShellExecute(Webbrowser1.DefaultDispatch);
    :
    : end;
    :
    : [/code]
    :
    What do you want this code to do, either to open a new TWebBrowser (IE-based) or to open a new, default browser program?
  • cycordcycord Member Posts: 148
    : What do you want this code to do, either to open a new TWebBrowser (IE-based) or to open a new, default browser program?
    :
    i want to open a new instance of WebBrowser, separate from the other already opened WebBrowser, just like the shellExecute command but Delphi 5 seems not to recoganize the command, and i have a problem combining the ShellExecute and the IDispatch.........thanks
  • zibadianzibadian Member Posts: 6,349
    : : What do you want this code to do, either to open a new TWebBrowser (IE-based) or to open a new, default browser program?
    : :
    : i want to open a new instance of WebBrowser, separate from the other already opened WebBrowser, just like the shellExecute command but Delphi 5 seems not to recoganize the command, and i have a problem combining the ShellExecute and the IDispatch.........thanks
    :
    ShellExecute() is part of the ShellApi unit, and executes a DOS command and not a COM object. Here is a code, which open google in a new window:
    [code]
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ShellExecute(Handle, nil, 'http://www.google.com', nil, nil, sw_Show);
    end;
    [/code]
  • Justin BibJustin Bib USAMember Posts: 0

    ________ \ http://forcoder.org \ free ebooks and video tutorials about | Objective-C, C++, Delphi, Assembly, Perl, Swift, Visual Basic .NET, JavaScript, Go, MATLAB, Ruby, C, PHP, R, Visual Basic, Python, Java, PL/SQL, C#, Scratch D, Prolog, Logo, Crystal, Transact-SQL, Erlang, FoxPro, Alice, Hack, ML, Lisp, VBScript, Kotlin, Ada, Lua, Awk, Bash, Apex, Rust, Dart, LabVIEW, Julia, Scheme, SAS, F#, ABAP, Clojure, Scala, COBOL, Fortran | __

Sign In or Register to comment.