Re: Open Internet Explorer (6.0) at a specified url


Posted by Met@ on August 27, 2002

In Reply to: Re: Open Internet Explorer (6.0) at a specified url posted by webmaster Guido on August 27, 2002

: For opening a registered file under control of your Delphi program, you can use the Windows API-function ShellExecute. You have to specify the path of that file as one of the parameters of the function. Now here's the trick: if instead you pass a URL, your default web-browser is opened with that URL. Example:
:
: ShellExecute(Handle, 'open', PChar('http://www.festra.com/'), nil, nil, SW_SHOW);

: By the way, that same function can also be used for running an external application, opening a folder, printing a file, and so on.
:
: In DelphiLand's section "Code snips", there is a short article about this under the heading "Running an external application". There's also a downloadable example project.

LOL TNX FOR YOUR REPLY! WHY DIDN'T I SEE THAT? *sigh* LOL

Anywayz, I made my code as follows (changed a bit, cuz I wanted to open more sites, but with the code you gave me, everytime a new site was opened, it was opened in the same window):

unit tijd;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', PChar('D:\Program Files\Microsoft Office\Office\OUTLOOK.EXE'), nil, nil, SW_SHOW);
ShellExecute(Handle, 'open', PChar('D:\Program Files\Outlook Express\MSIMN.EXE'), nil, nil, SW_SHOW);
ShellExecute(Handle, 'open', PChar('D:\Program Files\Internet Explorer\IEXPLORE.EXE'), PChar('http://thesimssite.endoria.net/indexECHT.htm'), nil, SW_SHOW);
ShellExecute(Handle, 'open', PChar('D:\Program Files\Internet Explorer\IEXPLORE.EXE'), PChar('http://thesimssite.endoria.net/CC/phpBB2/index.php'), nil, SW_SHOW);
ShellExecute(Handle, 'open', PChar('D:\Program Files\Internet Explorer\IEXPLORE.EXE'), PChar('http://www.the-forums.nl'), nil, SW_SHOW);

end;

end.

Anywayz, my mailprograms open a bit slow...and I want my opened windows to be in a specific order in my "start bar". To accomplish this, Outlook.exe has to be loaded first (3 seconds) and after those 5 seconds, Outlook Express has to be loaded (takes 10 seconds). After that, the webpages have to be loaded. How can I make the script work like this?


Related Articles and Replies:


[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]