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

📄 mscommlib_tlb.pas

📁 主要提供delphi 5与单片机通讯的源码及定义的通讯协议
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    property CommID: Integer read Get_CommID write Set_CommID;
    property CommPort: Smallint read Get_CommPort write Set_CommPort;
    property _CommPort: Smallint read Get__CommPort write Set__CommPort;
    property CTSHolding: WordBool read Get_CTSHolding write Set_CTSHolding;
    property CTSTimeout: Integer read Get_CTSTimeout write Set_CTSTimeout;
    property DSRHolding: WordBool read Get_DSRHolding write Set_DSRHolding;
    property DSRTimeout: Integer read Get_DSRTimeout write Set_DSRTimeout;
    property DTREnable: WordBool read Get_DTREnable write Set_DTREnable;
    property Handshaking: HandshakeConstants read Get_Handshaking write Set_Handshaking;
    property InBufferSize: Smallint read Get_InBufferSize write Set_InBufferSize;
    property InBufferCount: Smallint read Get_InBufferCount write Set_InBufferCount;
    property Break: WordBool read Get_Break write Set_Break;
    property InputLen: Smallint read Get_InputLen write Set_InputLen;
    property Interval: Integer read Get_Interval write Set_Interval;
    property NullDiscard: WordBool read Get_NullDiscard write Set_NullDiscard;
    property OutBufferSize: Smallint read Get_OutBufferSize write Set_OutBufferSize;
    property OutBufferCount: Smallint read Get_OutBufferCount write Set_OutBufferCount;
    property ParityReplace: WideString read Get_ParityReplace write Set_ParityReplace;
    property PortOpen: WordBool read Get_PortOpen write Set_PortOpen;
    property RThreshold: Smallint read Get_RThreshold write Set_RThreshold;
    property RTSEnable: WordBool read Get_RTSEnable write Set_RTSEnable;
    property Settings: WideString read Get_Settings write Set_Settings;
    property SThreshold: Smallint read Get_SThreshold write Set_SThreshold;
    property Output: OleVariant read Get_Output write Set_Output;
    property Input: OleVariant read Get_Input write Set_Input;
    property CommEvent: Smallint read Get_CommEvent write Set_CommEvent;
    property EOFEnable: WordBool read Get_EOFEnable write Set_EOFEnable;
    property InputMode: InputModeConstants read Get_InputMode write Set_InputMode;
  end;

// *********************************************************************//
// DispIntf:  IMSCommDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {E6E17E90-DF38-11CF-8E74-00A0C90F26F8}
// *********************************************************************//
  IMSCommDisp = dispinterface
    ['{E6E17E90-DF38-11CF-8E74-00A0C90F26F8}']
    property CDHolding: WordBool dispid 1;
    property CDTimeout: Integer dispid 2;
    property CommID: Integer dispid 3;
    property CommPort: Smallint dispid 4;
    property _CommPort: Smallint dispid 0;
    property CTSHolding: WordBool dispid 5;
    property CTSTimeout: Integer dispid 6;
    property DSRHolding: WordBool dispid 7;
    property DSRTimeout: Integer dispid 8;
    property DTREnable: WordBool dispid 9;
    property Handshaking: HandshakeConstants dispid 10;
    property InBufferSize: Smallint dispid 11;
    property InBufferCount: Smallint dispid 12;
    property Break: WordBool dispid 13;
    property InputLen: Smallint dispid 14;
    property Interval: Integer dispid 15;
    property NullDiscard: WordBool dispid 16;
    property OutBufferSize: Smallint dispid 17;
    property OutBufferCount: Smallint dispid 18;
    property ParityReplace: WideString dispid 19;
    property PortOpen: WordBool dispid 20;
    property RThreshold: Smallint dispid 21;
    property RTSEnable: WordBool dispid 22;
    property Settings: WideString dispid 23;
    property SThreshold: Smallint dispid 24;
    property Output: OleVariant dispid 25;
    property Input: OleVariant dispid 26;
    property CommEvent: Smallint dispid 27;
    property EOFEnable: WordBool dispid 28;
    property InputMode: InputModeConstants dispid 29;
    procedure AboutBox; dispid -552;
  end;

// *********************************************************************//
// DispIntf:  DMSCommEvents
// Flags:     (4112) Hidden Dispatchable
// GUID:      {648A5602-2C6E-101B-82B6-000000000014}
// *********************************************************************//
  DMSCommEvents = dispinterface
    ['{648A5602-2C6E-101B-82B6-000000000014}']
    procedure OnComm; dispid 1;
  end;


// *********************************************************************//
// OLE Control Proxy class declaration
// Control Name     : TMSComm
// Help String      : Microsoft Comm Control 6.0
// Default Interface: IMSComm
// Def. Intf. DISP? : No
// Event   Interface: DMSCommEvents
// TypeFlags        : (38) CanCreate Licensed Control
// *********************************************************************//
  TMSComm = class(TOleControl)
  private
    FOnComm: TNotifyEvent;
    FIntf: IMSComm;
    function  GetControlInterface: IMSComm;
  protected
    procedure CreateControl;
    procedure InitControlData; override;
    procedure Set_Output(pvarOutput: OleVariant);
    function  Get_Output: OleVariant;
    procedure Set_Input(pvarInput: OleVariant);
    function  Get_Input: OleVariant;
  public
    procedure AboutBox;
    property  ControlInterface: IMSComm read GetControlInterface;
    property  DefaultInterface: IMSComm read GetControlInterface;
    property CDTimeout: Integer index 2 read GetIntegerProp write SetIntegerProp;
    property _CommPort: Smallint index 0 read GetSmallintProp write SetSmallintProp;
    property CTSTimeout: Integer index 6 read GetIntegerProp write SetIntegerProp;
    property DSRTimeout: Integer index 8 read GetIntegerProp write SetIntegerProp;
    property Interval: Integer index 15 read GetIntegerProp write SetIntegerProp;
    property Output: OleVariant index 25 read GetOleVariantProp write SetOleVariantProp;
    property Input: OleVariant index 26 read GetOleVariantProp write SetOleVariantProp;
  published
    property CDHolding: WordBool index 1 read GetWordBoolProp write SetWordBoolProp stored False;
    property CommID: Integer index 3 read GetIntegerProp write SetIntegerProp stored False;
    property CommPort: Smallint index 4 read GetSmallintProp write SetSmallintProp stored False;
    property CTSHolding: WordBool index 5 read GetWordBoolProp write SetWordBoolProp stored False;
    property DSRHolding: WordBool index 7 read GetWordBoolProp write SetWordBoolProp stored False;
    property DTREnable: WordBool index 9 read GetWordBoolProp write SetWordBoolProp stored False;
    property Handshaking: TOleEnum index 10 read GetTOleEnumProp write SetTOleEnumProp stored False;
    property InBufferSize: Smallint index 11 read GetSmallintProp write SetSmallintProp stored False;
    property InBufferCount: Smallint index 12 read GetSmallintProp write SetSmallintProp stored False;
    property Break: WordBool index 13 read GetWordBoolProp write SetWordBoolProp stored False;
    property InputLen: Smallint index 14 read GetSmallintProp write SetSmallintProp stored False;
    property NullDiscard: WordBool index 16 read GetWordBoolProp write SetWordBoolProp stored False;
    property OutBufferSize: Smallint index 17 read GetSmallintProp write SetSmallintProp stored False;
    property OutBufferCount: Smallint index 18 read GetSmallintProp write SetSmallintProp stored False;
    property ParityReplace: WideString index 19 read GetWideStringProp write SetWideStringProp stored False;
    property PortOpen: WordBool index 20 read GetWordBoolProp write SetWordBoolProp stored False;
    property RThreshold: Smallint index 21 read GetSmallintProp write SetSmallintProp stored False;
    property RTSEnable: WordBool index 22 read GetWordBoolProp write SetWordBoolProp stored False;
    property Settings: WideString index 23 read GetWideStringProp write SetWideStringProp stored False;
    property SThreshold: Smallint index 24 read GetSmallintProp write SetSmallintProp stored False;
    property CommEvent: Smallint index 27 read GetSmallintProp write SetSmallintProp stored False;
    property EOFEnable: WordBool index 28 read GetWordBoolProp write SetWordBoolProp stored False;
    property InputMode: TOleEnum index 29 read GetTOleEnumProp write SetTOleEnumProp stored False;
    property OnComm: TNotifyEvent read FOnComm write FOnComm;
  end;

procedure Register;

implementation

uses ComObj;

procedure TMSComm.InitControlData;
const
  CEventDispIDs: array [0..0] of DWORD = (
    $00000001);
  CLicenseKey: array[0..19] of Word = ( $0043, $006F, $0070, $0079, $0072, $0069, $0067, $0068, $0074, $0020, $0028
    , $0063, $0029, $0020, $0031, $0039, $0039, $0034, $0020, $0000);
  CControlData: TControlData2 = (
    ClassID: '{648A5600-2C6E-101B-82B6-000000000014}';
    EventIID: '{648A5602-2C6E-101B-82B6-000000000014}';
    EventCount: 1;
    EventDispIDs: @CEventDispIDs;
    LicenseKey: @CLicenseKey;
    Flags: $00000000;
    Version: 401);
begin
  ControlData := @CControlData;
  TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnComm) - Cardinal(Self);
end;

procedure TMSComm.CreateControl;

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

begin
  if FIntf = nil then DoCreate;
end;

function TMSComm.GetControlInterface: IMSComm;
begin
  CreateControl;
  Result := FIntf;
end;

procedure TMSComm.Set_Output(pvarOutput: OleVariant);
begin
  DefaultInterface.Set_Output(pvarOutput);
end;

function  TMSComm.Get_Output: OleVariant;
begin
  Result := DefaultInterface.Get_Output;
end;

procedure TMSComm.Set_Input(pvarInput: OleVariant);
begin
  DefaultInterface.Set_Input(pvarInput);
end;

function  TMSComm.Get_Input: OleVariant;
begin
  Result := DefaultInterface.Get_Input;
end;

procedure TMSComm.AboutBox;
begin
  DefaultInterface.AboutBox;
end;

procedure Register;
begin
  RegisterComponents('ActiveX',[TMSComm]);
end;

end.

⌨️ 快捷键说明

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