/// <summary>
        /// 列情報を取得します。
        /// </summary>
        /// <param name="handle">ウィンドウハンドル。</param>
        /// <param name="col">列。</param>
        /// <param name="column">列情報。</param>
        /// <returns>成否。</returns>
        private static bool GetColumnInTarget(IntPtr handle, int col, LVCOLUMN column)
        {
            bool isUni = NativeMethods.IsWindowUnicode(handle);
            int LVM_GETCOLUMN = isUni ? LVM_GETCOLUMNW : LVM_GETCOLUMNA;

            //文字列取得の場合バッファサイズを指定する。
            if ((column.mask & LVCF.TEXT) == LVCF.TEXT)
            {
                column._core.cchTextMax = 256;
            }

            while (true)
            {
                //バッファ確保。
                if (0 < column._core.cchTextMax)
                {
                    column._core.pszText = Marshal.AllocCoTaskMem((column._core.cchTextMax + 1) * 8);
                }
                try
                {
                    if (!NativeDataUtility.ToBool(NativeMethods.SendMessage(handle, LVM_GETCOLUMN, new IntPtr(col), ref column._core)))
                    {
                        return false;
                    }
                    
                    //文字列取得がない場合は終了。
                    if (column._core.pszText == IntPtr.Zero)
                    {
                        return true;
                    }

                    //文字列に変換。
                    column.pszText = isUni ? Marshal.PtrToStringUni(column._core.pszText) :
                                                Marshal.PtrToStringAnsi(column._core.pszText);

                    //サイズに収まっていれば終了。
                    if (column.pszText.Length < column._core.cchTextMax - 1)
                    {
                        return true;
                    }

                    //リトライ。
                    column._core.cchTextMax *= 2;
                }
                finally
                {
                    if (column._core.pszText != IntPtr.Zero)
                    {
                        Marshal.FreeCoTaskMem(column._core.pszText);
                    }
                }
            }
        }
        public void TestGetColumnOver256()
        {
            NativeListControl list = new NativeListControl(testDlg.IdentifyFromDialogId(1037));
            StringBuilder overText = new StringBuilder();
            for (int i = 0; i < 259; i++)//ツリーの文字数最大がデフォルトで259。
            {
                overText.Append((i % 10).ToString());
            }

            //設定
            LVCOLUMN_CORE setData = new LVCOLUMN_CORE();
            setData.mask = (int)LVCF.TEXT;
            setData.iSubItem = 0;
            SetLVCOLUMN(list, setData, overText.ToString());

            //取得
            LVCOLUMN getData = new LVCOLUMN();
            getData.mask = LVCF.TEXT;
            list.GetColumn(0, getData);
            Assert.AreEqual(overText.ToString(), getData.pszText);
        }
        /// <summary>
        /// Obtains column information.
        /// </summary>
        /// <param name="col">Column.</param>
        /// <param name="column">Column information.</param>
        /// <returns>Success or failure.</returns>
#else
        /// <summary>
        /// 列情報を取得します。
        /// </summary>
        /// <param name="col">列。</param>
        /// <param name="column">列情報。</param>
        /// <returns>成否。</returns>
#endif
        public bool GetColumn(int col, LVCOLUMN column)
        {
            AppVar inTarget = App.Dim(column);
            bool ret = (bool)App[GetType(), "GetColumnInTarget"](Handle, col, inTarget).Core;
            LVCOLUMN data = (LVCOLUMN)inTarget.Core;
            column._core = data._core;
            column._pszText = data._pszText;
            return ret;
        }
        public void TestGetColumn()
        {
            NativeListControl list = new NativeListControl(testDlg.IdentifyFromDialogId(1037));
            LVCOLUMN_CORE setData = new LVCOLUMN_CORE();
            LVCOLUMN column = new LVCOLUMN();
            foreach (LVCF element in (LVCF[])Enum.GetValues(typeof(LVCF)))
            {
                setData.mask |= (int)element;
                column.mask |= element;
            }

            //検証データを設定
            setData.fmt = 0x4802;
            setData.cx = 30;
            setData.iSubItem = 1;
            setData.iImage = 2;
            setData.iOrder = 1;
            setData.cxMin = 20;
            setData.cxDefault = 25;
            setData.cxIdeal = 30;
            SetLVCOLUMN(list, setData, "abc");

            //取得
            list.GetColumn(1, column);
            
            //比較
            Assert.AreEqual(setData.fmt, column.fmt);
            Assert.AreEqual(setData.cx, column.cx);
            Assert.AreEqual("abc", column.pszText); 
            Assert.AreEqual(setData.iSubItem, column.iSubItem);
            Assert.AreEqual(setData.iImage, column.iImage);
            Assert.AreEqual(setData.iOrder, column.iOrder);
            if (isUni && OSUtility.Is7or8())
            {
                Assert.AreEqual(setData.cxMin, column.cxMin);
                Assert.AreEqual(setData.cxDefault, column.cxDefault);
                Assert.AreEqual(setData.cxIdeal, column.cxIdeal);
            }
        }