📄 hcontrol.h
字号:
// HControl.h : CHControl 的声明
#pragma once
#include "resource.h" // 主符号
#include <atlctl.h>
#include "_HighControl_i.c"
// IHControl
[
object,
uuid(AE6A254D-AF8F-4FE4-B13E-0A858E7C6DC5),
dual,
helpstring("IHControl 接口"),
pointer_default(unique)
]
__interface IHControl : public IDispatch
{
[propput, bindable, requestedit, id(DISPID_AUTOSIZE)]
HRESULT AutoSize([in]VARIANT_BOOL vbool);
[propget, bindable, requestedit, id(DISPID_AUTOSIZE)]
HRESULT AutoSize([out,retval]VARIANT_BOOL* pbool);
[propput, bindable, requestedit, id(DISPID_BACKCOLOR)]
HRESULT BackColor([in]OLE_COLOR clr);
[propget, bindable, requestedit, id(DISPID_BACKCOLOR)]
HRESULT BackColor([out,retval]OLE_COLOR* pclr);
[propput, bindable, requestedit, id(DISPID_BACKSTYLE)]
HRESULT BackStyle([in]long style);
[propget, bindable, requestedit, id(DISPID_BACKSTYLE)]
HRESULT BackStyle([out,retval]long* pstyle);
[propput, bindable, requestedit, id(DISPID_BORDERCOLOR)]
HRESULT BorderColor([in]OLE_COLOR clr);
[propget, bindable, requestedit, id(DISPID_BORDERCOLOR)]
HRESULT BorderColor([out, retval]OLE_COLOR* pclr);
[propput, bindable, requestedit, id(DISPID_FILLCOLOR)]
HRESULT FillColor([in]OLE_COLOR clr);
[propget, bindable, requestedit, id(DISPID_FILLCOLOR)]
HRESULT FillColor([out, retval]OLE_COLOR* pclr);
[propput, bindable, requestedit, id(DISPID_FILLSTYLE)]
HRESULT FillStyle([in]long style);
[propget, bindable, requestedit, id(DISPID_FILLSTYLE)]
HRESULT FillStyle([out, retval]long* pstyle);
[propputref, bindable, requestedit, id(DISPID_FONT)]
HRESULT Font([in]IFontDisp* pFont);
[propput, bindable, requestedit, id(DISPID_FONT)]
HRESULT Font([in]IFontDisp* pFont);
[propget, bindable, requestedit, id(DISPID_FONT)]
HRESULT Font([out, retval]IFontDisp** ppFont);
[propput, bindable, requestedit, id(DISPID_FORECOLOR)]
HRESULT ForeColor([in]OLE_COLOR clr);
[propget, bindable, requestedit, id(DISPID_FORECOLOR)]
HRESULT ForeColor([out,retval]OLE_COLOR* pclr);
[propput, bindable, requestedit, id(DISPID_ENABLED)]
HRESULT Enabled([in]VARIANT_BOOL vbool);
[propget, bindable, requestedit, id(DISPID_ENABLED)]
HRESULT Enabled([out,retval]VARIANT_BOOL* pbool);
[propput, bindable, requestedit, id(DISPID_TABSTOP)]
HRESULT TabStop([in]VARIANT_BOOL vbool);
[propget, bindable, requestedit, id(DISPID_TABSTOP)]
HRESULT TabStop([out, retval]VARIANT_BOOL* pbool);
[propput, bindable, requestedit, id(DISPID_TEXT)]
HRESULT Text([in]BSTR strText);
[propget, bindable, requestedit, id(DISPID_TEXT)]
HRESULT Text([out, retval]BSTR* pstrText);
[propput, bindable, requestedit, id(DISPID_BORDERVISIBLE)]
HRESULT BorderVisible([in]VARIANT_BOOL vbool);
[propget, bindable, requestedit, id(DISPID_BORDERVISIBLE)]
HRESULT BorderVisible([out, retval]VARIANT_BOOL* pbool);
[propput, bindable, requestedit, id(DISPID_APPEARANCE)]
HRESULT Appearance([in]short nAppearance);
[propget, bindable, requestedit, id(DISPID_APPEARANCE)]
HRESULT Appearance([out, retval]short* pnAppearance);
[propget, id(1), helpstring("属性 V1Value")] HRESULT V1Value([out, retval] SHORT* pVal);
[propput, id(1), helpstring("属性 V1Value")] HRESULT V1Value([in] SHORT newVal);
[propget, id(2), helpstring("属性 A1Value")] HRESULT A1Value([out, retval] SHORT* pVal);
[propput, id(2), helpstring("属性 A1Value")] HRESULT A1Value([in] SHORT newVal);
[propget, id(3), helpstring("属性 V2Value")] HRESULT V2Value([out, retval] SHORT* pVal);
[propput, id(3), helpstring("属性 V2Value")] HRESULT V2Value([in] SHORT newVal);
[propget, id(4), helpstring("属性 A2Value")] HRESULT A2Value([out, retval] SHORT* pVal);
[propput, id(4), helpstring("属性 A2Value")] HRESULT A2Value([in] SHORT newVal);
[propget, id(5), helpstring("属性 DTJValue")] HRESULT DTJValue([out, retval] SHORT* pVal);
[propput, id(5), helpstring("属性 DTJValue")] HRESULT DTJValue([in] SHORT newVal);
[propget, id(6), helpstring("属性 HHLValue")] HRESULT HHLValue([out, retval] SHORT* pVal);
[propput, id(6), helpstring("属性 HHLValue")] HRESULT HHLValue([in] SHORT newVal);
[propget, id(7), helpstring("属性 YWValue")] HRESULT YWValue([out, retval] SHORT* pVal);
[propput, id(7), helpstring("属性 YWValue")] HRESULT YWValue([in] SHORT newVal);
[propget, id(8), helpstring("属性 GZFS")] HRESULT GZFS([out, retval] BSTR* pVal);
[propput, id(8), helpstring("属性 GZFS")] HRESULT GZFS([in] BSTR newVal);
[propget, id(9), helpstring("属性 BaoJing")] HRESULT BaoJing([out, retval] BSTR* pVal);
[propput, id(9), helpstring("属性 BaoJing")] HRESULT BaoJing([in] BSTR newVal);
[propget, id(10), helpstring("属性 UnitName")] HRESULT UnitName([out, retval] BSTR* pVal);
[propput, id(10), helpstring("属性 UnitName")] HRESULT UnitName([in] BSTR newVal);
[id(11), helpstring("方法SendOver")] HRESULT SendOver(void);
[propget, id(12), helpstring("属性 VAState")] HRESULT VAState([out, retval] SHORT* pVal);
[propput, id(12), helpstring("属性 VAState")] HRESULT VAState([in] SHORT newVal);
[propget, id(13), helpstring("属性 SwitchState")] HRESULT SwitchState([out, retval] SHORT* pVal);
[propput, id(13), helpstring("属性 SwitchState")] HRESULT SwitchState([in] SHORT newVal);
[propget, id(14), helpstring("属性 KeepState")] HRESULT KeepState([out, retval] SHORT* pVal);
[propput, id(14), helpstring("属性 KeepState")] HRESULT KeepState([in] SHORT newVal);
[propget, id(15), helpstring("属性 DownState")] HRESULT DownState([out, retval] SHORT* pVal);
[propput, id(15), helpstring("属性 DownState")] HRESULT DownState([in] SHORT newVal);
[propget, id(16), helpstring("属性 CancelState")] HRESULT CancelState([out, retval] SHORT* pVal);
[propput, id(16), helpstring("属性 CancelState")] HRESULT CancelState([in] SHORT newVal);
[propget, id(17), helpstring("属性 RemoteState")] HRESULT RemoteState([out, retval] SHORT* pVal);
[propput, id(17), helpstring("属性 RemoteState")] HRESULT RemoteState([in] SHORT newVal);
[propget, id(18), helpstring("属性 WrongState")] HRESULT WrongState([out, retval] SHORT* pVal);
[propput, id(18), helpstring("属性 WrongState")] HRESULT WrongState([in] SHORT newVal);
[propget, id(19), helpstring("属性 DetailState")] HRESULT DetailState([out, retval] SHORT* pVal);
[propput, id(19), helpstring("属性 DetailState")] HRESULT DetailState([in] SHORT newVal);
[propget, id(20), helpstring("属性 OperateLevel")] HRESULT OperateLevel([out, retval] SHORT* pVal);
[propput, id(20), helpstring("属性 OperateLevel")] HRESULT OperateLevel([in] SHORT newVal);
[propget, id(21), helpstring("属性 DisplayNow")] HRESULT DisplayNow([out, retval] SHORT* pVal);
[propput, id(21), helpstring("属性 DisplayNow")] HRESULT DisplayNow([in] SHORT newVal);
[propget, id(22), helpstring("属性 Auto")] HRESULT AutoState([out, retval] SHORT* pVal);
[propput, id(22), helpstring("属性 Auto")] HRESULT AutoState([in] SHORT newVal);
[propget, id(23), helpstring("属性 BtState")] HRESULT BtState([out, retval] SHORT* pVal);
[propput, id(23), helpstring("属性 BtState")] HRESULT BtState([in] SHORT newVal);
[propget, id(24), helpstring("属性 DrawBkColor")] HRESULT DrawBkColor([out, retval] OLE_COLOR* pVal);
[propput, id(24), helpstring("属性 DrawBkColor")] HRESULT DrawBkColor([in] OLE_COLOR newVal);
[propget, id(25), helpstring("属性 PressColor")] HRESULT PressColor([out, retval] OLE_COLOR* pVal);
[propput, id(25), helpstring("属性 PressColor")] HRESULT PressColor([in] OLE_COLOR newVal);
[propget, id(26), helpstring("属性 FontSize")] HRESULT FontSize([out, retval] SHORT* pVal);
[propput, id(26), helpstring("属性 FontSize")] HRESULT FontSize([in] SHORT newVal);
};
// _IHControlEvents
[
uuid("17133A2B-3917-45ED-B661-EC200DD6F387"),
dispinterface,
helpstring("_IHControl事件接口")
]
__interface _IHControlEvents
{
[id(1), helpstring("方法VAPress")] HRESULT VAPress(SHORT n);
[id(2), helpstring("方法SwitchPress")] HRESULT SwitchPress(SHORT n);
[id(3), helpstring("方法DetailPress")] HRESULT DetailPress(BSTR strName);
[id(4), helpstring("方法KeepPress")] HRESULT KeepPress(SHORT n);
[id(5), helpstring("方法DownPress")] HRESULT DownPress(SHORT n);
[id(6), helpstring("方法CancelPress")] HRESULT CancelPress(SHORT n);
};
#define FD_TEST 0 //仪表的自检状态,流量自动变化
#define FD_WORK 1 //仪表的工作状态,等待流量的变化
#define FD_SHUTDOWN 2 //仪表的关闭状态,不作任何动作
// CHControl
[
coclass,
threading("apartment"),
vi_progid("HighControl.HControl"),
progid("HighControl.HControl.1"),
version(1.0),
uuid("FDADA597-5E3C-4A06-B173-C2F5C184ADEC"),
helpstring("HControl Class"),
event_source("com"),
support_error_info(IHControl),
registration_script("control.rgs")
]
class ATL_NO_VTABLE CHControl :
public CStockPropImpl<CHControl, IHControl>,
public IPersistStreamInitImpl<CHControl>,
public IOleControlImpl<CHControl>,
public IOleObjectImpl<CHControl>,
public IOleInPlaceActiveObjectImpl<CHControl>,
public IViewObjectExImpl<CHControl>,
public IOleInPlaceObjectWindowlessImpl<CHControl>,
public IObjectWithSiteImpl<CHControl>,
public IServiceProviderImpl<CHControl>,
public IPersistStorageImpl<CHControl>,
public ISpecifyPropertyPagesImpl<CHControl>,
public IQuickActivateImpl<CHControl>,
public IDataObjectImpl<CHControl>,
public CComControl<CHControl>
{
public:
unsigned short m_s_v1;
unsigned short m_s_a1;
unsigned short m_s_v2;
unsigned short m_s_a2;
unsigned short m_s_dtj;
unsigned short m_s_hhl;
unsigned short m_s_yw;
CString m_str_gzfs;
CString m_str_alarm;
CString m_str_name;
unsigned short m_max_v;
unsigned short m_max_a;
unsigned short m_bool_va;
unsigned short m_bool_switch;
unsigned short m_bool_switch_wrong; //提示故障状态,
unsigned short m_bool_bt; //备妥信息
unsigned short m_bool_view_detail; //查看详细的信息
unsigned short m_bool_keep;
unsigned short m_bool_down;
unsigned short m_bool_cancel;
unsigned short m_bool_remote;
unsigned short m_bool_va_dis;
unsigned short m_bool_active; //用于提示是否有等待结果的过程出现,比如上升下降取消等
unsigned short m_bool_display; //当前窗口时候是顶端窗口,CLIENT-MONITOR
unsigned short m_bool_opl;
CPoint point_pos;
BOOL m_bool_mouse_down;
BOOL m_bool_mouse_up;
//-------------------------------------------
// CComFont FD_Font; //仪表的刻度文字的字体
unsigned int FD_FontSize; //仪表的刻度文字的字体大小
OLE_COLOR FD_TextColor; //仪表的刻度文字颜色
CPoint FD_TextOffset; //仪表的刻度文字相对于仪表的刻度线末端的偏移量
int FD_GridXOffset; //仪表的刻度相对于原点的X方向偏移量
unsigned int FD_BigGridLength; //仪表的大刻度线的长度
unsigned int FD_BigGridNum; //仪表的大刻度格子数目
unsigned int FD_SmallGridLength;//仪表小刻度线的长度
unsigned int FD_SmallGridNum; //仪表小刻度的格子数目
OLE_COLOR FD_GridColor; //仪表的刻度线颜色
OLE_COLOR FD_BkColor; //背景色
OLE_COLOR FD_PressColor; //按下的颜色
unsigned int FD_FrameRadius; //仪表的框架半径
OLE_COLOR FD_FrameFrontColor; //仪表的框架外表面颜色
OLE_COLOR FD_FrameBackColor; //仪表的框架内表面颜色
unsigned int FD_FrameLength; //仪表的框架长度
double FD_MiddleLevelRatio; //仪表的中、低流量的分界比例
double FD_HighLevelRatio; //仪表的高、中流量的分界比例
OLE_COLOR FD_LowLevelColor; //流量管液体在低流量时的颜色
OLE_COLOR FD_MiddleLevelColor; //流量管液体在中流量时的颜色
OLE_COLOR FD_HighLevelColor; //流量管液体在高流量时的颜色
unsigned int FD_PipeRadius; //流量管的半径
unsigned int FD_PipeLength; //流量管的长度
double FD_CurrentFlux; //被检测流量的当前值
double FD_MaxFlux; //被检测流量的最大值
int FD_TestDirection; //仪表自检状态下的流量变化率
unsigned int FD_Status; //仪表的当前状态
unsigned int FD_Height; //仪表的高度
unsigned int FD_Width; //仪表的宽度
CPoint FD_Origin; //仪表的内部坐标系原点
short m_bool_auto;
CHControl()
{
m_bWindowOnly = TRUE;
m_s_v1 = 0;
m_s_a1 = 0;
m_s_v2 = 0;
m_s_a2 = 0;
m_s_dtj = 0;
m_s_hhl = 0;
m_s_yw = 0;
m_str_gzfs = _T("定值火花率");
m_str_alarm= _T("瓦斯报警");
m_str_name = _T("1室1电场");
m_bool_va = 0;
m_bool_switch = 0;
m_bool_switch_wrong = 0;
m_bool_view_detail = 0;
m_bool_keep = 0;
m_bool_down = 0;
m_bool_cancel = 0;
m_bool_remote = 0;
m_bool_mouse_down = FALSE;
m_bool_mouse_up = FALSE;
m_bool_va_dis = FALSE;
m_bool_active = 0;
m_bool_display = 1;
m_bool_opl = 3; //
m_bool_bt = 0;
m_max_v = 72;
m_max_a = 1000;
FD_Width = 40; //仪表的默认尺寸
FD_Height = 210;
FD_Origin.x = 10; //仪表的内部坐标系原点
FD_Origin.y = 200;
FD_Status = FD_WORK; //仪表的默认状态
FD_TestDirection = 1; //仪表测试状态下,初始油量变化方向
FD_HighLevelRatio = 0.8; //油量的高/中档分界
FD_MiddleLevelRatio = 0.3; //油量的中/低档分界
FD_PipeLength = 190; //默认的油量筒长
FD_PipeRadius = 15; //默认的油管半径
FD_FrameLength = 10; //油管两头框架的长度
FD_FrameRadius = 10; //默认的框架半径
FD_MaxFlux = 1000; //默认的最大流量
FD_CurrentFlux = 0; //默认的当前流量
FD_BigGridNum = 5; //默认的大刻度的格子数目
FD_SmallGridNum = 25; //默认的小刻度的格子数目
FD_GridXOffset = 0; //默认的刻度线相对于原点的X方向偏移量
FD_TextOffset.x = 1; //标注文字相对于刻度线的位置偏移
FD_TextOffset.y = -4;
FD_FontSize = 8; //默认的标注文字字体大小
FD_GridColor = RGB(255, 255, 255); //默认的刻度颜色
FD_TextColor = RGB( 55,0, 0); //默认的文字颜色
FD_HighLevelColor = RGB(255, 255, 0); //高流量状态的油筒颜色
FD_MiddleLevelColor = RGB(255, 220, 0); //中流量状态的油筒颜色
FD_LowLevelColor = RGB(255, 0, 0); //低流量状态的油筒颜色
FD_FrameFrontColor = RGB(240, 240, 240);//油筒框架外表面的颜色
FD_FrameBackColor = RGB(130, 130, 130); //油筒框架内表面的颜色
FD_BkColor = RGB( 192,192,255);
FD_PressColor = RGB(255,100,100);
m_bool_auto = 0;
}
DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE |
OLEMISC_CANTLINKINSIDE |
OLEMISC_INSIDEOUT |
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -