public void Close() { if (m_hCTX != IntPtr.Zero) { WinTab.WTClose(m_hCTX); m_hCTX = IntPtr.Zero; } else { throw new Exception("Context is not initialized."); } }
public unsafe WinTabContext Open(IntPtr hWnd, bool bEnable) { fixed(LOGCONTEXT *p = &m_srLogContext) { WinTab.WTInfo(InfoCategory.DEFCONTEXT, 0, p); m_srLogContext.lcOptions = ContextOption.MESSAGES | ContextOption.SYSTEM | ContextOption.CSRMESSAGES; m_srLogContext.lcPktData = WinTab.WTPKT_ALL_WITHOUT_XY; m_srLogContext.lcPktMode = WTPKT.BUTTONS; m_srLogContext.lcSysMode = 0; m_hCTX = WinTab.WTOpen(hWnd, p, Convert.ToInt32(bEnable)); } m_bEnabled = bEnable; return(this); }
protected override void WndProc(ref Message eventMsg) { // Listen for operating system messages //parent.testTextBox.AppendText("msg: " + eventMsg + "\n"); switch (eventMsg.Msg) { case WM_ACTIVATE: { HCTX hCtx = parent.HLogContext; if (hCtx > 0) { Int32 activateState = eventMsg.WParam.ToInt32() & 0xFFFF; CWintabFuncs.WTEnable(parent.HLogContext, (activateState > 0)); if (activateState > 0) { CWintabFuncs.WTOverlap(hCtx, true); } } } break; case (int)WintabEventMessage.WT_PACKET: { // Notify the parent form that a data packet was received. UInt32 pktSerialNum = (UInt32)eventMsg.WParam; UInt32 hContext = (UInt32)eventMsg.LParam; parent.HandleEvent_WT_PACKET(hContext, pktSerialNum); } break; default: base.WndProc(ref eventMsg); break; } }
public WinTabContext(HCTX i) { m_hCTX = i; }
public WinTabContext() { m_hCTX = IntPtr.Zero; }