예제 #1
0
        /// <summary>
        /// Returns a string containing the name of the selected stylus.
        /// </summary>
        /// <param name="index_I">indicates stylus type</param>
        /// <returns></returns>
        public static string GetStylusName(EWTICursorNameIndex index_I)
        {
            string stylusName = null;
            IntPtr buf        = CMemUtils.AllocUnmanagedBuf(MAX_STRING_SIZE);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)index_I,
                    (uint)EWTICursorsIndex.CSR_NAME, buf);

                if (size < 1)
                {
                    throw new Exception("GetStylusName returned empty string.");
                }

                // Strip off final null character before marshalling.
                stylusName = CMemUtils.MarshalUnmanagedString(buf, size - 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetDeviceInfo: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return(stylusName);
        }
예제 #2
0
파일: CWintabInfo.cs 프로젝트: Bgoon/GKit
        /// <summary>
        /// Returns a string containing the name of the selected stylus.
        /// </summary>
        /// <param name="index_I">indicates stylus type</param>
        /// <returns></returns>
        public static string GetStylusName(EWTICursorNameIndex index_I)
        {
            string stylusName = null;
            IntPtr buf        = CMemUtils.AllocUnmanagedBuf(MAX_STRING_SIZE);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)index_I,
                    (uint)EWTICursorsIndex.CSR_NAME, buf);

                if (size < 1)
                {
                    throw new Exception("GetStylusName returned empty string.");
                }

                // Strip off final null character before marshalling.
                stylusName = CMemUtils.MarshalUnmanagedString(buf, size - 2);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(stylusName);
        }
예제 #3
0
        /// <summary>
        /// Returns a string containing the name of the selected stylus. 
        /// </summary>
        /// <param name="index_I">indicates stylus type</param>
        /// <returns></returns>
        public static string GetStylusName(EWTICursorNameIndex index_I)
        {
            string stylusName = null;
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(MAX_STRING_SIZE);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)index_I,
                    (uint)EWTICursorsIndex.CSR_NAME, buf);

                if (size < 1)
                {
                    throw new Exception("GetStylusName returned empty string.");
                }

                // Strip off final null character before marshalling.
                stylusName = CMemUtils.MarshalUnmanagedString(buf, size-1);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetDeviceInfo: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return stylusName;
        }