www.pudn.com > fbdelphisw > SendSMS.pas


unit SendSMS; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  StdCtrls,sms; 
 
type 
  TfrmSendSMS = class(TForm) 
    txtDestination: TEdit; 
    btnSend: TButton; 
    Label24: TLabel; 
    mmoText: TMemo; 
    lblTo: TLabel; 
    procedure btnSendClick(Sender: TObject); 
    procedure FormCreate(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  frmSendSMS: TfrmSendSMS; 
 
implementation 
 
uses MainUnit; 
 
{$R *.DFM} 
 
procedure TfrmSendSMS.btnSendClick(Sender: TObject); 
var 
  imsgLength:longint; 
begin 
  imsgLength:=length(mmoText.text); 
  if imsgLength > 150 then 
    begin 
      if messageDlg('Your SMS Message is greater than 150 characters. Your message will be split into '+inttostr(trunc(imsgLength div 150)+1)+' Messages. Continue ?', mtWarning,[mbYes,mbNo],0)=mrYes then 
        frmMain.FBUS1.SMS.SendSMSMessage(txtDestination.text,mmoText.text,1,fbSMSClassNormal); 
    end 
  else 
    frmMain.FBUS1.SMS.SendSMSMessage(txtDestination.text,mmoText.text,1,fbSMSClassNormal); 
end; 
 
procedure TfrmSendSMS.FormCreate(Sender: TObject); 
begin 
  mmoText.lines.Clear; 
end; 
 
end.