⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 phsctrllib_tlb.pas

📁 小灵猫短信发送二次开发驱动。基于DELPHI7开发
💻 PAS
字号:
unit PHSCTRLLib_TLB;

{$TYPEDADDRESS OFF}
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}

interface

uses OleCtrls, Windows;
  

const
  PHSCTRLLibMajorVersion = 1;
  PHSCTRLLibMinorVersion = 0;

  LIBID_PHSCTRLLib: TGUID = '{63191455-BE92-4835-BE14-9B639D4661A7}';

  DIID__DPHSCTRL: TGUID = '{6918EB3F-6CD9-4A2E-834A-A86BC639AE95}';
  DIID__DPHSCTRLEvents: TGUID = '{83B1EA6E-3DFD-47E5-A476-5B599F2A4C72}';
  CLASS_PHSCTRL: TGUID = '{DC5D0674-63E5-4C14-9ADE-D717119367AD}';
type

  _DPHSCTRL = dispinterface;
  _DPHSCTRLEvents = dispinterface;

  PHSCTRL = _DPHSCTRL;


  _DPHSCTRL = dispinterface
    ['{6918EB3F-6CD9-4A2E-834A-A86BC639AE95}']
    property  CSQState: Integer dispid 1;
    property  RegState: Integer dispid 2;
    property  PortNo: Integer dispid 3;
    property  csErrMsg: WideString dispid 5;
    function  StartDevice(PortNo: Smallint): WordBool; dispid 6;
    procedure StopDevice; dispid 7;
    function  SendShortMsg(const telenum: WideString; const msg: WideString): WordBool; dispid 8;
    function  Dial(const telenum: WideString): WordBool; dispid 9;
    function  OnHook: WordBool; dispid 10;
    function  CheckStatus: WordBool; dispid 11;
    procedure AboutBox; dispid -552;
  end;

  _DPHSCTRLEvents = dispinterface
    ['{83B1EA6E-3DFD-47E5-A476-5B599F2A4C72}']
    procedure OnNewSSM(const PhoneNo: WideString; const msg: WideString); dispid 1;
    procedure OnSendMsgFail(const telenum: WideString; const msg: WideString); dispid 2;
    procedure OnSendMsgSuccess(const telenum: WideString; const msg: WideString); dispid 3;
  end;


  TPHSCTRLOnNewSSM = procedure(Sender: TObject; const PhoneNo: WideString; const msg: WideString) of object;
  TPHSCTRLOnSendMsgFail = procedure(Sender: TObject; const telenum: WideString; 
                                                     const msg: WideString) of object;
  TPHSCTRLOnSendMsgSuccess = procedure(Sender: TObject; const telenum: WideString; 
                                                        const msg: WideString) of object;

  TPHSCTRL = class(TOleControl)
  private
    FOnNewSSM: TPHSCTRLOnNewSSM;
    FOnSendMsgFail: TPHSCTRLOnSendMsgFail;
    FOnSendMsgSuccess: TPHSCTRLOnSendMsgSuccess;
    FIntf: _DPHSCTRL;
    function  GetControlInterface: _DPHSCTRL;
  protected
    procedure CreateControl;
    procedure InitControlData; override;
  public
    function  StartDevice(PortNo: Smallint): WordBool;
    procedure StopDevice;
    function  SendShortMsg(const telenum: WideString; const msg: WideString): WordBool;
    function  Dial(const telenum: WideString): WordBool;
    function  OnHook: WordBool;
    function  CheckStatus: WordBool;
    procedure AboutBox;
    property  ControlInterface: _DPHSCTRL read GetControlInterface;
    property  DefaultInterface: _DPHSCTRL read GetControlInterface;
  published
    property  TabStop;
    property  Align;
    property  DragCursor;
    property  DragMode;
    property  ParentShowHint;
    property  PopupMenu;
    property  ShowHint;
    property  TabOrder;
    property  Visible;
    property  OnDragDrop;
    property  OnDragOver;
    property  OnEndDrag;
    property  OnEnter;
    property  OnExit;
    property  OnStartDrag;
    property  CSQState: Integer index 1 read GetIntegerProp write SetIntegerProp stored False;
    property  RegState: Integer index 2 read GetIntegerProp write SetIntegerProp stored False;
    property  PortNo: Integer index 3 read GetIntegerProp write SetIntegerProp stored False;
    property  csErrMsg: WideString index 5 read GetWideStringProp write SetWideStringProp stored False;
    property  OnNewSSM: TPHSCTRLOnNewSSM read FOnNewSSM write FOnNewSSM;
    property  OnSendMsgFail: TPHSCTRLOnSendMsgFail read FOnSendMsgFail write FOnSendMsgFail;
    property  OnSendMsgSuccess: TPHSCTRLOnSendMsgSuccess read FOnSendMsgSuccess write FOnSendMsgSuccess;
  end;

resourcestring
  dtlServerPage = 'ActiveX';

implementation

uses ComObj;

procedure TPHSCTRL.InitControlData;
const
  CEventDispIDs: array [0..2] of DWORD = (
    $00000001, $00000002, $00000003);
  CControlData: TControlData2 = (
    ClassID: '{DC5D0674-63E5-4C14-9ADE-D717119367AD}';
    EventIID: '{83B1EA6E-3DFD-47E5-A476-5B599F2A4C72}';
    EventCount: 3;
    EventDispIDs: @CEventDispIDs;
    LicenseKey: nil (*HR:$80004005*);
    Flags: $00000000;
    Version: 401);
begin
  ControlData := @CControlData;
  TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnNewSSM) - Cardinal(Self);
end;

procedure TPHSCTRL.CreateControl;

  procedure DoCreate;
  begin
    FIntf := IUnknown(OleObject) as _DPHSCTRL;
  end;

begin
  if FIntf = nil then DoCreate;
end;

function TPHSCTRL.GetControlInterface: _DPHSCTRL;
begin
  CreateControl;
  Result := FIntf;
end;

function  TPHSCTRL.StartDevice(PortNo: Smallint): WordBool;
begin
  DefaultInterface.StartDevice(PortNo);
end;

procedure TPHSCTRL.StopDevice;
begin
  DefaultInterface.StopDevice;
end;

function  TPHSCTRL.SendShortMsg(const telenum: WideString; const msg: WideString): WordBool;
begin
  DefaultInterface.SendShortMsg(telenum, msg);
end;

function  TPHSCTRL.Dial(const telenum: WideString): WordBool;
begin
  DefaultInterface.Dial(telenum);
end;

function  TPHSCTRL.OnHook: WordBool;
begin
  DefaultInterface.OnHook;
end;

function  TPHSCTRL.CheckStatus: WordBool;
begin
  DefaultInterface.CheckStatus;
end;

procedure TPHSCTRL.AboutBox;
begin
  DefaultInterface.AboutBox;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -