Func _GUICtrlTreeView_GetText32($hWnd, $hItem = 0)
If Not IsHWnd($hItem) Then $hItem = _GUICtrlTreeView_GetItemHandle($hWnd, $hItem)
If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
If $hItem = 0x00000000 Then Return SetError(1, 1, "")
; All 8 byte data types for a 64 bit system changed to 4 byte uint's for a 32 bit system
Local $tagTVITEMEX32 = "struct; uint Mask;struct; uint hItem;uint State;uint StateMask;uint Text;int TextMax;int Image;int SelectedImage;int Children;uint Param; endstruct;" & _
"int Integral;uint uStateEx;uint hwnd;int iExpandedImage;int iReserved; endstruct"
Local $tTVITEM = DllStructCreate($tagTVITEMEX32)
Local $tText
Local $fUnicode = _GUICtrlTreeView_GetUnicodeFormat($hWnd)
If $fUnicode Then
$tText = DllStructCreate("wchar Buffer[4096]"); create a text 'area' for receiving the text
Else
$tText = DllStructCreate("char Buffer[4096]"); create a text 'area' for receiving the text
EndIf
DllStructSetData($tTVITEM, "Mask", $TVIF_TEXT)
DllStructSetData($tTVITEM, "hItem", BitShift( $hItem, -32 )) ; 8 byte value --> 4 byte value
DllStructSetData($tTVITEM, "TextMax", 4096)
If _WinAPI_InProcess($hWnd, $__ghTVLastWnd) Then
DllStructSetData($tTVITEM, "Text", DllStructGetPtr($tText))
_SendMessage($hWnd, $TVM_GETITEMW, 0, $tTVITEM, 0, "wparam", "struct*")
Else
Local $iItem = DllStructGetSize($tTVITEM)
Local $tMemMap
Local $pMemory = _MemInit($hWnd, $iItem + 4096, $tMemMap)
Local $pText = $pMemory + $iItem
DllStructSetData($tTVITEM, "Text", BitShift( $pText, -32 )) ; 8 byte value --> 4 byte value
_MemWrite($tMemMap, $tTVITEM, $pMemory, $iItem)
If $fUnicode Then
_SendMessage($hWnd, $TVM_GETITEMW, 0, BitShift( $pMemory, -32 ), 0, "wparam", "ptr") ; 8 byte value --> 4 byte value
Else
_SendMessage($hWnd, $TVM_GETITEMA, 0, $pMemory, 0, "wparam", "ptr")
EndIf
_MemRead($tMemMap, $pText, $tText, 4096)
_MemFree($tMemMap)
EndIf
Return DllStructGetData($tText, "Buffer")
EndFunc