Sign in to follow this  
Followers 0
Sam137

Unable to get the handle and content

10 posts in this topic

#Include <GuiListBox.au3>
$windownm = "Current Summaries"
Global $sWin = "[TITLE:" & $windownm & "; CLASS:TElTreeView]"
Global $sCtrl = "[CLASS:TElTreeView; INSTANCE:1]"
Global $sTxtBuf, $sTxt
Global $hParent = WinGetHandle($sWin)
ConsoleWrite('+$hParent = ' & $hParent & @CRLF)
If IsHWnd($hParent) = 0 Then Exit MsgBox(4096, "TElTreeView", "Error: Window handle not returned")
Global $hTListBox = ControlGetHandle($hParent, "", $sCtrl)
ConsoleWrite('+$hTListBox = ' & $hTListBox & @CRLF)
If IsHWnd($hParent) = 0 Then Exit MsgBox(4096, "TElTreeView", "Error: Control handle not returned")
For $i = 0 To _GUICtrlTreeView_GetCount($hTListBox) -1
    $sTxt = "Index[" & $i & "] Text: " & _GUICtrlTreeView_GetText($hTListBox, $i)
    $sTxtBuf &= $sTxt & @CRLF
    ConsoleWrite('-' & $sTxt & @CRLF)
Next
MsgBox(4096, "Report Access Definitions", $sTxtBuf)

Can you please help in getting the handle, it says "Error: Window handle not returned"?

Also can you see attached screen shot of the window i am trying

Share this post


Link to post
Share on other sites



Try replacing the string in $sWin with just the window's title.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

i tried that also. I am not getting the handle..

I tried like this:

Global $sWin = "[TITLE:Current Summaries; CLASS:TElTreeView]"

Still the same error "Error: Window handle not returned"

Share this post


Link to post
Share on other sites

Have you tried it like this, as I suggested above?

Global $sWin = "Current Summaries"


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Yes i tried this above code. Now there is no error. Its showing the empty message box... Do you have any idea how to get the content?

Share this post


Link to post
Share on other sites

#include <GuiTreeView.au3>
;$windownm = "Current Summaries"
;Global $sWin = "[TITLE:" & $windownm & "; CLASS:TElTreeView]"
Global $sWin = "Current Summaries"
Global $sCtrl = "[CLASS:TElTreeView; INSTANCE:1]"
Global $sTxtBuf, $sTxt
Global $hParent = WinGetHandle($sWin)
ConsoleWrite('+$hParent = ' & $hParent & @CRLF)
If IsHWnd($hParent) = 0 Then Exit MsgBox(4096, "TElTreeView", "Error: Window handle not returned")

Global $hTListBox = ControlGetHandle($hParent, "", $sCtrl)
ConsoleWrite('+$hTListBox = ' & $hTListBox & @CRLF)
If IsHWnd($hParent) = 0 Then Exit MsgBox(4096, "TElTreeView", "Error: Control handle not returned")

[b]MsgBox(0,"I am Here", _GUICtrlTreeView_GetCount($hTListBox))[/b]

For $i = 0 To _GUICtrlTreeView_GetCount($hTListBox) -1
    $sTxt = "Index[" & $i & "] Text: " & _GUICtrlTreeView_GetText($hTListBox, $i)
    $sTxtBuf &= $sTxt & @CRLF
    ConsoleWrite('-' & $sTxt & @CRLF)
Next
MsgBox(4096, "Report Access Definitions", $sTxtBuf)
when i put the message box to see the count its returning. It gives 0. i have attached the code.

Share this post


Link to post
Share on other sites

Can you guys please help with this issue? I am stucked up for the past 1 week. appreciate your help.

Share this post


Link to post
Share on other sites

Can you guys please help with this issue? I am stucked up for the past 1 week. appreciate your help.

Share this post


Link to post
Share on other sites

TElTreeView is an unreadable (by windows messages, and possibly ownerdrawn as well) custom control,

with a format not based on the MS common control treeview.

A Delphi TTreeView class control can be read, but not this one.

Try contacting the vendor 3M, and see if there are COM (or any other) methods for automating the interface,

or perhaps there is some other automating software like AutoIt that can read these controls...


I see fascists...

Share this post


Link to post
Share on other sites

Thanks Rover very much. I appreciate your help...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0