Impossibilité d'ouvrir une page web

Résolu
emirej Messages postés 90 Date d'inscription mercredi 14 mars 2007 Statut Membre Dernière intervention 31 mai 2009 - 27 juil. 2008 à 13:25
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 - 28 juil. 2008 à 01:57
Bonjour , je n'arrive pas a ouvrir une page internet avec Delphi c'est très étrange , voici mon code source

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls, ShellApi;

type
  TForm1 = class(TForm)
    Image1: TImage;
    GroupBox1: TGroupBox;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Edit1: TEdit;
    Button3: TButton;
    Button4: TButton;
    Label2: TLabel;
    Button6: TButton;
    Button7: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.show;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
Shellexecute(handle,nil,'Edit1.caption',nil,nil,0);
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
Shellexecute(handle,nil,'C:\Program Files\mozilla.org\Mozilla\mozilla.exe','Edit1.caption',nil,0);
end;

end.

J'ai même essayé avec Edit1.text mais rien ne vas :\

5 réponses

f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
27 juil. 2008 à 20:18
var
  cmd : string;
begin
  cmd := Edit1.Caption;
  Shellexecute(0,'open',PChar(cmd), nil, nil, SW_SHOW);
end;




<hr size="2" width="100%" />
3
Cirec Messages postés 3833 Date d'inscription vendredi 23 juillet 2004 Statut Modérateur Dernière intervention 18 septembre 2022 50
27 juil. 2008 à 22:00
var
  cmd : string;
begin
 <strike> cmd := Edit1.Caption;</strike>
  cmd := Edit1. Text ;
  Shellexecute(0,'open',PChar(cmd), nil, nil, SW_SHOW);
end;

 
@+
Cirec

<hr siz ="" />
3
Utilisateur anonyme
27 juil. 2008 à 22:09
Pas d'accord avec vous les gars : si IE est son explorateur par défaut, sa page web s'affichera avec lui et non avec FF en utilisant votre procédure.
0
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
28 juil. 2008 à 01:41
"Pas d'accord avec vous les gars : si IE est son explorateur par défaut,
sa page web s'affichera avec lui et non avec FF en utilisant votre
procédure."

on s'en fout, il n'a qu'a faire de FX son navigateur par defaut (ou opera, ou safari, ou maxthon).

<hr size="2" width="100%" />
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
28 juil. 2008 à 01:57
et voici le GW pour recuperer firefox :

RootKey:HKLM / HKCU

Key:SOFTWARE\Mozilla\Mozilla Firefox -> SZ:CurrentVersion

Key:SOFTWARE\Mozilla\Mozilla Firefox\{SZ:CurrentVersion}\Main -> SZ:PathToExe

ou

RootKey:HKEY_CLASSES_ROOT

Key:Applications\FIREFOX.EXE\shell\open\command -> SZ:@

<hr size="2" width="100%" />
pour recuperer Opera :

RootKey:HKLM / HKCU

Key:Software\Opera Software -> SZ:Last CommandLine

ou

RootKey:HKEY_CLASSES_ROOT

Key:Applications\Opera.exe\shell\open\command -> SZ:@

<hr size="2" width="100%" />
pour recuperer Safari :

RootKey:HKEY_CLASSES_ROOT

Key:Applications\Safari.exe\shell\open\command -> SZ:@

<hr size="2" width="100%" />
0
Rejoignez-nous