Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

lunch browser

hi
i would like to know how can i add a the option to my program that do the folow thing ..
when i push on some Tbuttom the program automaticly lunch the browser (explorer/navigatore or other ... the program should find out witch is the current browser)
with a specific Http address ;
10x
asi
0
asi
Asked:
asi
  • 2
1 Solution
 
chrbCommented:
Hi,

Just use the shellexecute and send the address as file to execute, maybe you must run "start" as program with the address as parameter
0
 
asiAuthor Commented:
hi
1)but how can i find out what browser does any local computer has ?
2) what do u mean "maybe you must run                        "start" as program with the address as parameter " can u be more specific , example ?
10x
asi


0
 
chrbCommented:
I will give you an example, just have to make it first :)

Chr
0
 
itamarCommented:

Here goes the D2 source-code. Just copy, paste and run !
(Please, think about increasing points if you like this ;)


            >>>>>>>>>>> 

            unit Unit1;

            interface

            uses
              Windows, Messages, SysUtils, Classes, Graphics,
            Controls, Forms, Dialogs,
            StdCtrls,
            ShellAPI;

            type
              TForm1 = class(TForm)
                btnGO: TButton;
                edtURL: TEdit;
            procedure btnGOClick(Sender: TObject);
            procedure ExecuteFile(Command, Params,
            WorkDir:string);
              private
                { Private declarations }
              public
                { Public declarations }
              end;

            var
              Form1: TForm1;

            implementation

            {$R *.DFM}

            procedure TForm1.ExecuteFile(Command, Params,
            WorkDir:string);
            var aux : integer;
            begin
            { convert Pascal string to Null-termintated strings }
            Command := Command + #0;
            Params := Params + #0;
            WorkDir := WorkDir + #0;
            { run/open application/file }
            aux := ShellExecute(Self.Handle,'Open',@Command[1],

            @Params[1], @WorkDir[1], SW_SHOWNORMAL);
            if aux < 32 Then
            MessageDlg('Could not execute ' +
            Command,mtError,[mbOK],0);
            end;

            procedure TForm1.btnGOClick(Sender: TObject);
            begin
            If edtURL.Text <> '' Then
            ExecuteFile('http://' + edtURL.Text,'','');
            end;

            end.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now