unit f_netcare;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs; // , SHDocVw_1_1_TLB
type
{ TfrmNetCare }
TfrmNetCare = class(TForm)
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
//IEBrowser: TAxcWebBrowser;
Browser: OleVariant;
procedure LoadDefaults;
procedure LoadPersistent;
public
procedure GoToClient(const pnt_uli: String);
procedure GoToURL(const url_str: String);
end;
implementation
uses Windows, ComObj, u_gv;
{$R *.lfm}
{ TfrmNetCare }
procedure TfrmNetCare.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction := caHide;
end;
procedure TfrmNetCare.FormCreate(Sender: TObject);
begin
LoadDefaults;
LoadPersistent;
end;
procedure TfrmNetCare.FormDestroy(Sender: TObject);
begin
//GV.IEBrowser.Free;
Browser := Unassigned;
end;
procedure TfrmNetCare.LoadDefaults;
begin
//GV.IEBrowser := TAxcWebBrowser.Create(Self);
//GV.IEBrowser := TAxcWebBrowser.CreateParented(Handle);
//GV.IEBrowser.OleServer.Visible := True;
//GV.IEBrowser.OleServer.ToolBar := False;
//GV.IEBrowser.OleServer.ShowBrowserBar();
//GV.IEBrowser.OleServer.FullScreen := False;
try
Browser := CreateOleObject('InternetExplorer.Application');
Windows.SetParent(Browser.hwnd, Self.Handle);
Browser.Toolbar := False;
Browser.Fullscreen := True;
//Browser.Resizable := False;
Browser.Visible := True;
except
on E: Exception do
begin
if SameText(E.ClassName, 'EOleSysError') then
begin
GV.NetCare.OLE_Blocked := True;
//ShowMessage('It appears that a previous copy of this app was unable to release the Browser.OleObject. This means that this instance of this app will not be able to call NetCare. Instead, you can use NetCare in tne other open instance of RUBI, or, use click/copy of Client Billing ID numbers from this app and paste into NetCare manually.');
end;
end;
end;
end;
procedure TfrmNetCare.LoadPersistent;
begin
//
end;
procedure TfrmNetCare.GoToClient(const pnt_uli: String);
var go2url: String;
begin
GV.NetCare.was_used := True;
go2url := StringReplace(GV.NetCare.BaseURL, '[LOGIN_ID]', GV.UsrProps.netcare_login_id, []);
go2url := StringReplace(go2url, '[AHC_ID]', pnt_uli, []);
GoToURL(go2url);
end;
procedure TfrmNetCare.GoToURL(const url_str: String);
var
w_url_str: WideString;
ole_url, ole_null: Olevariant;
begin
w_url_str := url_str;
Browser.Silent := True;
Browser.Navigate(w_url_str, null, null, null, null);
Show;
BringToFront;
end;
end.