'listview column alignment
'   检索列表视图中的列的文本对齐方式。
'   hWndControl:  控件的句柄 (例如  HWND_FORM1_LISTVIEW1)   
'   iPosition:    从零开始，列的索引。
'   Returns:      Returns the column alignment if successful, zero otherwise.
'                   %LVCFMT_CENTER      文本居中
'                   %LVCFMT_LEFT        文本是左对齐
'                   %LVCFMT_RIGHT       文本为右对齐
Function FF_ListView_GetColumnAlignment(ByVal hWndControl As HWnd, ByVal iPosition As Long) As Long
   
   Dim tlvc As LV_COLUMN
   
   '检查窗口句柄是否有效
   If IsWindow(hWndControl) Then
      
      tlvc.mask = LVCF_FMT
      If SendMessage(hWndControl, LVM_GETCOLUMN, iPosition, Cast(LPARAM, Varptr(tlvc))) Then
         If (tlvc.fmt And LVCFMT_RIGHT) = LVCFMT_RIGHT Then
            Function = LVCFMT_RIGHT : Exit Function
         End If
         If (tlvc.fmt And LVCFMT_CENTER) = LVCFMT_CENTER Then
            Function = LVCFMT_CENTER : Exit Function
         End If
         If (tlvc.fmt And LVCFMT_LEFT) = LVCFMT_LEFT Then
            Function = LVCFMT_LEFT : Exit Function
         End If
      End If
      
   End If
   
End Function

