Ver Mensaje Individual
  #3  
Antiguo 30-10-2012
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
Gerson12,

Revisa el siguiente código tomado del link : http://www.delphipages.com/forum/sho...d.php?t=152828
Código Delphi [-]
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    Function OpenObject(strObjectPath:string) : boolean;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

Function TForm1.OpenObject(strObjectPath:string) : boolean;
var
   h : integer;
   zFname: array[0..79] of Char;

begin

   result := true;

   h := ShellExecute
        (
           0,
           'open',
           StrPcopy(zFname,'http://www.google.com/search?hl=en&q=' + strobjectpath),
           NIL,
           NIL,
           SW_SHOWNORMAL
        );

   if h < 33 then result := false;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   if not OpenObject(Edit1.Text) then
      MessageDlg('Can''t open default WEB Browser.', mtError,[mbOk], 0);
end;

end.
El código anterior invoca al Browser por defecto y realiza una búsqueda en Google pasando un TEdit como parámetro.

Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 30-10-2012 a las 06:41:18.
Responder Con Cita