?? apexcomm.odl
字號(hào):
///////////////////////////////////////////////////////////////
// 文件: ApexComm.odl
// 功能: 使用對(duì)象定義語(yǔ)言,定義控件對(duì)外的接口
// 作者: 王念峰
// 日期: 1999.04.19 - 創(chuàng)建
// 1999.05.15 - 修改,整理
// E_mai:wnf@wisepeak.com
// Http://www.wisepeak.com
///////////////////////////////////////////////////////////////
// 版本: 1.0
///////////////////////////////////////////////////////////////
#include <olectl.h>
#include <idispids.h>
[ uuid(F0A2BEC5-F8B2-11D2-8A54-0080C8EB2FFE), version(1.0),
helpfile("ApexComm.hlp"),
helpstring("ApexComm ActiveX Control module"), control]
library APEXCOMMLib
{
importlib(STDOLE_TLB);
importlib(STDTYPE_TLB);
//控件類型定義
typedef [ uuid(D167D7B3-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
enum{
RtsEnable=0,
//RTS_CONTROL_ENABLE 缺省值,只點(diǎn)亮該信號(hào)線
RtsDisable=1,
//RTS_CONTROL_DISABLE 不點(diǎn)亮信號(hào)線
RtsHandshake=2,
//RTS_CONTROL_HANDSHAKE 握手信號(hào) 小于1/3不亮,但小于1/2亮
RtsTransmissionAvailable=3
//RTS_CONTROL_TOGGLE 有數(shù)據(jù)亮,無(wú)數(shù)據(jù)不亮
}TRtsControl;//傳輸請(qǐng)求流控
//(例如:計(jì)算機(jī)到調(diào)制解調(diào)器)(request-to-send)
typedef [ uuid(D167D7B4-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
enum{
None=0,
//無(wú)奇偶校驗(yàn),缺省值
Odd=1,
//奇校驗(yàn)
Even=2,
//偶校驗(yàn)
Mark=3,
//符號(hào)校驗(yàn)
Space=4
//空校驗(yàn)
}TParity;//校驗(yàn)方式
typedef [ uuid(D167D7B5-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
enum{
One,
//一位停止位,缺省值
One_Half,
//注:有些芯片限制不能與5個(gè)數(shù)據(jù)位連用
Two
//注:有些芯片限制不能與6,7,8個(gè)數(shù)據(jù)位連用
}TStopBits;//停止位
typedef [ uuid(D167D7B6-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
enum{
Five,
//5個(gè)字節(jié)的數(shù)據(jù)位
Six,
//6
Seven,
//7
Eight
//8缺省值
}TByteSize;//數(shù)據(jù)位
typedef [ uuid(D167D7B7-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
enum{
DtrEnable=0,
// DTR_CONTROL_ENABLE 缺省值
DtrDisable=1,
//DTR_CONTROL_DISABLE
DtrHandshake=2
//DTR_CONTROL_HANDSHAKE
}TDtrControl;//數(shù)據(jù)終端準(zhǔn)備好流控,
//(例如:計(jì)算機(jī)到調(diào)制解調(diào)器)data-terminal-ready
// 控件的發(fā)布接口
[ uuid(F0A2BEC6-F8B2-11D2-8A54-0080C8EB2FFE),
helpstring("Dispatch interface for ApexComm Control"), hidden]
dispinterface _DApexComm
{
properties:
// NOTE - ClassWizard will maintain property information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_PROP(CApexCommCtrl)
[id(1)] BSTR PortID;
[id(2)] long BaudRate;
[id(3)] boolean EnableParity;
[id(4)] boolean OutxCtsFlow;
[id(5)] boolean OutxDsrFlow;
[id(6)] TDtrControl DtrControl;
[id(7)] boolean DsrSensitivity;
[id(8)] boolean TxContinueOnXoff;
[id(9)] boolean OutxXonXoffFlow;
[id(10)] boolean InxXonXoffFlow;
[id(11)] boolean ReplaceWhenParityError;
[id(12)] boolean IgnoreNullChar;
[id(13)] TRtsControl RtsControl;
[id(14)] short XonLimit;
[id(15)] short XoffLimit;
[id(16)] TByteSize ByteSize;
[id(17)] TParity Parity;
[id(18)] TStopBits StopBits;
[id(19)] short XonChar;
[id(20)] short XoffChar;
[id(21)] short ReplacedChar;
[id(22)] long InputBufferSize;
[id(23)] long OutputBufferSize;
[id(24)] long ReadIntervalTimeout;
[id(25)] long ReadTotalTimeoutMultiplier;
[id(26)] long ReadTotalTimeoutConstant;
[id(27)] long WriteTotalTimeoutMultiplier;
[id(28)] long WriteTotalTimeoutConstant;
//}}AFX_ODL_PROP
methods:
// NOTE - ClassWizard will maintain method information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_METHOD(CApexCommCtrl)
[id(29)] void OpenPort();//啟動(dòng)串口通訊
[id(30)] void ClosePort();//終止串口通訊
[id(31)] boolean WritePort(BSTR pDataToWrite, long dwSizeofDataToWrite);//寫串口
//}}AFX_ODL_METHOD
};
// 控件的事件發(fā)布接口
[ uuid(F0A2BEC7-F8B2-11D2-8A54-0080C8EB2FFE),
helpstring("Event interface for ApexComm Control") ]
dispinterface _DApexCommEvents
{
properties:
// Event interface has no properties
methods:
// NOTE - ClassWizard will maintain event information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_EVENT(CApexCommCtrl)
[id(1)] void OnReceiveData(BSTR pDataReceived, long dwSizeOfDataReceived);
[id(2)] void OnCommHangup(boolean bReadOrWrite);
[id(3)] void ReceiveDataError(long dwEventMask);
[id(4)] void DataSendFinished();//數(shù)據(jù)傳輸完畢
//}}AFX_ODL_EVENT
};
//控件的類信息
[ uuid(F0A2BEC8-F8B2-11D2-8A54-0080C8EB2FFE),
helpstring("ApexComm Control"), control ]
coclass ApexComm
{
[default] dispinterface _DApexComm;
[default, source] dispinterface _DApexCommEvents;
};
//{{AFX_APPEND_ODL}}
//}}AFX_APPEND_ODL}}
};
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -