/// <summary>
        /// Set up all the Wintab and Wintab extension properties.
        /// </summary>
        /// <returns></returns>
        private bool InitWintab()
        {
            bool status = false;

            try
            {
                mLogContext = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_MESSAGES);
                if (mLogContext == null)
                {
                    return(false);
                    //throw new Exception("Oops - FAILED GetDefaultDigitizingContext");
                }

                // Control system cursor.
                mLogContext.Options |= (UInt32)ECTXOptionValues.CXO_SYSTEM;

                // Verify which extensions are available for targeting.
                // Once we know what the tablet supports, we can set up the data packet
                // definition to be sent events from those control types.

                // All tablets should have at least expresskeys.
                mExpKeysMask = CWintabExtensions.GetWTExtensionMask(EWTXExtensionTag.WTX_EXPKEYS2);

                if (mExpKeysMask > 0)
                {
                    mLogContext.PktData |= (WTPKT)mExpKeysMask;
                }
                else
                {
                    Debug.WriteLine("InitWintab: WTX_EXPKEYS2 mask not found!");
                    throw new Exception("Oops - FAILED GetWTExtensionMask for WTX_EXPKEYS2");
                }

                // It's not an error if either / both of these are zero.  It simply means
                // that those control types are not supported.
                mTouchRingMask = CWintabExtensions.GetWTExtensionMask(EWTXExtensionTag.WTX_TOUCHRING);
                if (mTouchRingMask > 0)
                {
                    mLogContext.PktData |= (WTPKT)mTouchRingMask;
                }

                mTouchStripMask = CWintabExtensions.GetWTExtensionMask(EWTXExtensionTag.WTX_TOUCHSTRIP);
                if (mTouchStripMask > 0)
                {
                    mLogContext.PktData |= (WTPKT)mTouchStripMask;
                }

                status = mLogContext.Open();
                if (!status)
                {
                    //throw new Exception("Oops - failed logContext.Open()");
                    return(false);
                }

                // Query for tablet list
                mTabletList = CWintabInfo.GetFoundDevicesIndexList();

                if (mTabletList.Count == 0)
                {
                    MessageBox.Show("There are no attached tablets.");
                }

                // Create a data object and set its WT_PACKET handler.
                m_wtData = new CWintabData(mLogContext);
                m_wtData.SetWTPacketEventHandler(MyWTPacketEventHandler);

                foreach (var tabletIdx in mTabletList)
                {
                    SetupControlsForTablet(tabletIdx);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FormExtTestApp: InitWintab: " + ex.ToString());
            }

            return(true);
        }