OK...no one's interested, so what's wrong with this...
Module stuff
Code:
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Long, _
Source As Long, ByVal Length As Long)
Public Const TV_FIRST = &H1100
Public Const TVM_GETNEXTITEM = (TV_FIRST + 10)
Public Enum TVGN
TVGN_ROOT = &H0
TVGN_NEXT = &H1
TVGN_PREVIOUS = &H2
TVGN_PARENT = &H3
TVGN_CHILD = &H4
TVGN_FIRSTVISIBLE = &H5
TVGN_NEXTVISIBLE = &H6
TVGN_PREVIOUSVISIBLE = &H7
TVGN_DROPHILITE = &H8
TVGN_CARET = &H9
TVGN_LASTVISIBLE = &HA
End Enum
Public Enum TVIF
TVIF_TEXT = &H1
TVIF_IMAGE = &H2
TVIF_PARAM = &H4
TVIF_STATE = &H8
TVIF_HANDLE = &H10
TVIF_SELECTEDIMAGE = &H20
TVIF_CHILDREN = &H40
TVIF_INTEGRAL = &H8
End Enum
Public Type TVITEMEX ' Only used for Get and Set messages.
mask As TVIF
hItem As Long
state As Integer
stateMask As Integer
pszText As Long ' Pointer to null terminated string
cchTextMax As Integer
iImage As Integer
iSelectedImage As Integer
cChildren As Integer
lParam As Long
iIntegral As Integer
End Type
Public Function TreeView_GetSelection(ByVal hwnd As Long) As Long
TreeView_GetSelection = TreeView_GetNextItem(hwnd, 0, TVGN_CARET)
End Function
Public Function TreeView_GetNextItem(ByVal hwnd As Long, ByVal hItem As Long, code As TVGN) As Long
TreeView_GetNextItem = SendMessage(hwnd, TVM_GETNEXTITEM, code, hItem)
End Function
Form stuff
Code:
Private Sub Command1_Click()
Dim hWndProject As Long
Dim hWndIDE As Long
Dim hWndTree As Long
Dim myItemEx As TVITEMEX
Dim lpItem As Long
Dim lpMyItemEx As Long
Dim i As Integer
hWndIDE = FindWindowEx(0, 0, "wndclass_desked_gsk", vbNullString)
hWndProject = FindWindowEx(hWndIDE, 0, "PROJECT", vbNullString)
hWndTree = FindWindowEx(hWndProject, 0, "SysTreeView32", vbNullString)
'i = TreeView_GetCount(hWndTree)
'i = TreeView_GetItemHeight(hWndTree)
'i = TreeView_GetIndent(hWndTree)
lpMyItemEx = VarPtr(myItemEx)
lpItem = TreeView_GetSelection(hWndTree)
CopyMemory lpMyItemEx, lpItem, LenB(myItemEx)
End Sub
I'm not getting any info back on the selected item...?
What am I doing wrong?
[Edited by Judd on 06-21-2000 at 09:46 AM]
Mmmmm.....................
[crap_pun]
Can no one give me any pointers?
[/crap_pun]