Hi.
Does anyone know to get the handle of a TreeView20WndClass.?
Example:
Step 1. RunProgram("progX.exe","","")
Delay(5000)
Step 2. Get the handle of the TreeView20WndClass
HWND : 00330086 : < This keeps Changing.?
Class Name : TreeView20WndClass
Class Style : CS_DBLCLKS
Step 3. Get the root node. With Right Click Button.
The root node is set as the program's name.
mouse_event_(#MOUSEEVENTF_RIGHTDOWN,0,0,0,0)
mouse_event_(#MOUSEEVENTF_RIGHTUP,0,0,0,0)
Popupmenu with 2 Items
Step 4. Left Click Button On Item 2.To Open File.
mouse_event_(#MOUSEEVENTF_LEFTDOWN,0,0,0,0)
How to get handle of a TreeView20WndClass.?
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: How to get handle of a TreeView20WndClass.?
I copied the example code from the TreeViewGadget and ran it. While it was running I ran this code:
This snippet returns the hWnd of the TreeViewGadget. It won't change. You will modify the classname from SysTreeView32 to TreeView20WndClass or whatever classname you're trying to find.
Code: Select all
Global tree_hwnd.i
Procedure enumproc(hwnd, param)
class$ = Space(255)
GetClassName_(hwnd, @class$, 255)
If class$ = "SysTreeView32"
tree_hwnd = hwnd
ProcedureReturn 0
Else
ProcedureReturn 1
EndIf
EndProcedure
Repeat
hwndparent=FindWindow_(0, "ExplorerTreeGadget")
Delay(100)
Until hwndparent
EnumChildWindows_(hwndparent, @enumproc(), 0)
Debug Str(tree_hwnd)+" (0x"+Hex(tree_hwnd)+")"
BERESHEIT
Re: How to get handle of a TreeView20WndClass.?
Thanks netmaestro .
For some reason, this doesn't work for me.
Its old VB6 prog.Over 20 yrs old.
For some reason, this doesn't work for me.
Done that.netmaestro wrote: ↑Mon Dec 06, 2021 7:29 pm You will modify the classname from SysTreeView32 to TreeView20WndClass or whatever classname you're trying to find.
Its old VB6 prog.Over 20 yrs old.
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: How to get handle of a TreeView20WndClass.?
Download a program called "Greatis Windowse" and run it with your target window up. It will tell you the classname of whatever's there.
BERESHEIT
Re: How to get handle of a TreeView20WndClass.?
I already used that tool Version 5.3 and other dozen or so.
All of them show, TreeView20WndClass as Class Name.
All of them show, TreeView20WndClass as Class Name.
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: How to get handle of a TreeView20WndClass.?
Try using EnumChildWindows as I did except debug the classname and always procedurereturn 1. That will give you the class name of every child window. One of them will be some kind of treeview.
BERESHEIT
Re: How to get handle of a TreeView20WndClass.?
I will give it another try, tomorrow, I need to rest, for now.netmaestro wrote: ↑Mon Dec 06, 2021 11:29 pm Try using EnumChildWindows as I did except debug the classname and always procedurereturn 1. That will give you the class name of every child window. One of them will be some kind of treeview.
Re: How to get handle of a TreeView20WndClass.?
The issue was, the Progam's Title has an extra space between one of it's characters.
I now got the the TreeView20WndClass handle.
node_cnt=SendMessage_(tree_hwnd, #TVM_GETCOUNT, 0, 0)
I can get node_cnt which correct.
SendMessage_(tree_hwnd, #TVM_GETITEM,0,@Item)
Can not get the Item.
So, I gone lay this to bed, for a while. I got done by a space.
I now got the the TreeView20WndClass handle.
node_cnt=SendMessage_(tree_hwnd, #TVM_GETCOUNT, 0, 0)
I can get node_cnt which correct.
SendMessage_(tree_hwnd, #TVM_GETITEM,0,@Item)
Can not get the Item.
So, I gone lay this to bed, for a while. I got done by a space.