Link to home
Start Free TrialLog in
Avatar of delphi3
delphi3

asked on

Get the modem to connect with a ISP.

I have D4  standard edition and Win98. I can use a safe call to bring up most any xxxx.exe. I can write instructions similar to:

procedure TForm1.Button1Click(Sender: TObject);
var
Str1,Str2,Totalcmdline:string;
c:char;
 begin
  Str1:='C:\program Files\Netscape\Communicator\program\netscape.exe';
  Str2:='http://tycho.usno.navy.mil';
  Totalcmdline := str1+' "' + str2+' "';
  Cprocess(Totalcmdline,Self);
end;

procedure TForm1.Cprocess(sExecuteFile:string;Sender: TObject);
var
 pi: TProcessInformation;
 si: TStartupInfo;
begin
  FillMemory(@si, sizeof(si),0);
  si.cb:=sizeof(si);
  CreateProcess(Nil,PChar(sExecuteFile),nil, nil, false, NORMAL_PRIORITY_CLASS, Nil, Nil,si,pi );
  // close up shop...
   closeHandle(pi.hProcess);
   closeHandle(pi.hThread);
end;

I would like bring up my modem to call  my ISP. If I use for Str1 in the above program as  Str1 := 'MyComputer\Dial-Up Networking\MyModemConnection.exe';
However, this does not work. So what should I use instead to cause the modem to dial the ISP?

Delphi3
ASKER CERTIFIED SOLUTION
Avatar of simonet
simonet
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of delphi3
delphi3

ASKER

Hi Alex
This SafeCAll unit will show the solution in addition to the revision in RAS Test noted below that.

unit SafeCallNoFormUnit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  HarmFade;

type
  TForm1 = class(TForm)
    HarmFade1: THarmFade;
    procedure FormCreate(Sender: TObject);
    procedure HarmFade1MouseEnter(Sender: TObject);
  private
  procedure Cprocess(sExecuteFile:string;Sender: TObject);
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
// using this as a way to launch the program

procedure TForm1.FormCreate(Sender: TObject);
var
Str1,Str2,Str3,Totalcmdline:string;
 begin

  //Ras PhoneDialer
  Str1:='C:\WINDOWS\Desktop\WorkFolder\DURas\RasTest.exe';
  Totalcmdline := str1+' "';
  Cprocess(Totalcmdline,Self);

  //Custom RAS phone timer keeps track of the time used while on internet
  Str2:='C:\WINDOWS\Desktop\WorkFolder\DUS#3\DialUpSpy.exe';
   Totalcmdline := str2+' "';
  Cprocess(Totalcmdline,Self);

  //MS Outlook Express

  Str3:='C:\Program Files\Outlook Express\Msimn.exe';
  Totalcmdline := str3+' "';
  Cprocess(Totalcmdline,Self);
end;

procedure TForm1.Cprocess(sExecuteFile:string;Sender: TObject);
var
 pi: TProcessInformation;
 si: TStartupInfo;
begin
  FillMemory(@si, sizeof(si),0);
  si.cb:=sizeof(si);
  CreateProcess(Nil,PChar(sExecuteFile),nil, nil, false, NORMAL_PRIORITY_CLASS, Nil, Nil,si,pi );
  // close up shop...
   closeHandle(pi.hProcess);
   closeHandle(pi.hThread);
end;

// slide the mouse over this small rectangular
// form  that has no caption bar   will activate program closing

procedure TForm1.HarmFade1MouseEnter(Sender: TObject);
begin
Application.Terminate;
end;

end.
// form1 as text
object Form1: TForm1
  Left = 712
  Top = 330
  BorderIcons = []
  BorderStyle = bsNone
  Caption = 'Form1'
  ClientHeight = 41
  ClientWidth = 105
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object HarmFade1: THarmFade
    Left = 0
    Top = 0
    Width = 105
    Height = 41
    OnMouseEnter = HarmFade1MouseEnter
    ColorFrom = clBlue
  end
end


And this is the  addition to dialup ras  program from Alex above

procedure TfrmTest.FormCreate(Sender: TObject);
begin
  btnGetEntriesClick(Self);
  btnGetParamsClick(Self);
  btnDialEntryClick(Self);
end;

Delphi3
Avatar of delphi3

ASKER

oops,

I reread the name of the unit that I named it above at first. It should have read

unit SafeCallNoCaptionUnit1;

because later  that is what was the final outcome.

Delphi3