?
Solved

getting Treeview info from a third party application (using VBA (excel or Access)

Posted on 2011-05-02
8
Medium Priority
?
603 Views
Last Modified: 2012-05-11
Hey, I have been trying to figure this out for several days...
HELLLPPPP>>>> PLEEEEZZZE>>>>>>
I have n application I am trying to extract info from. The info is stored in a treeview
This app has several treeviews, so I need to figure out which one is correct (right now I am trying shotgun approach and testing each treeview.
but, I seem to have no items in them (or I am doing something WRONG, which I know is the case)
Here is my code:

Any ideas why I am not finding anything? I know SOME of them are populated.

Next issue I would LIKE to either copy to an array, or to a local treeview in my memory space. (is that what the issue is that I am working in another programs memory? If so, how would I correct this as the wparm and lparm both are zero?

Thanks!

Function FindCSGCustEditScreen(ByVal hchild As Long, ByVal lParam As Long) As Long
'enumerating through each window in parent app.
    Dim wClass As String, wText As String
    Dim j As Integer
    Dim hWndTvw  As Long
    Dim hNode As Long
    Dim varReturn As Long
    Dim tvcount As Long
    wClass = Space(64)
' get class name
    j = GetClassName(hchild, wClass, 63) 
    wClass = Left(wClass, j)
    wText = Space(256)
    j = SendMessageS(hchild, WM_GETTEXT, 255, wText)
    wText = Left(wText, j)
    Debug.Print wText
    
 'if it is a treeview, we will go to testtree
If wClass = "SysTreeView32" Then
'testtree is to test for the treeview and try to extract data.
testtree hchild
End If
    FindCSGCustEditScreen = 1  ' Continue enumeration
End Function

Sub testtree(mytv As Long)
Dim z As Long
    Dim wClass As String, wText As String
    Dim hWndTvw  As Long
    Dim hNode As Long
    Dim varReturn As Long
    Dim tvcount As Long
    Dim hchild As Long
    Dim j As Integer
'the below is just to make sure we ARE in a systree32.
    hchild = mytv
    wClass = Space(64)
    j = GetClassName(hchild, wClass, 63)
    wClass = Left(wClass, j)
    wText = Space(256)
    j = SendMessageS(hchild, WM_GETTEXT, 255, wText)
    wText = Left(wText, j)
    Debug.Print wText
'this is always returning 0
'Parameters wParam Must be zero, lParam Must be zero.
'Return Value Returns the count of items.
'my sendmessage declare is:Private Declare Function  
' SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal _
'        wParam As Long, lParam As Any) As Long

z = SendMessage(mytv, TVM_GETCOUNT, 0&, 0&)
MsgBox z

End Sub

Open in new window

0
Comment
Question by:Bruj
  • 3
  • 3
  • 2
8 Comments
 
LVL 85
ID: 35509543
Information in a Treeview is generally built from a database, textfile, XML etc etc. Wouldn't you be better off getting the data from that source, rather than trying to grab a Treeview control? You may not be able to work with that Treeview from within Access, since you'd need to be able to work with the Nodes and such of that treeview control.
0
 
LVL 35

Expert Comment

by:Norie
ID: 35509616
What 3rd party application is it?

Are you sure it's standard TreeView controls you are seeing?
0
 

Author Comment

by:Bruj
ID: 35509621
I DO agree with you.
That would be  the method I perfer. I .know databases and such. and I new to using APIs

I dont have access to that. I have been trying for 2 years to get the data dumps, but the way they come to me, there are several "key fields" that are missing and I have not been able to relate the child data. the reports team dont know what they are doing, and dont seem to understand relational data.
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
LVL 35

Expert Comment

by:Norie
ID: 35509638
Could there be a reason you don't have access to the source data?
0
 

Author Comment

by:Bruj
ID: 35509647
imnorie:, This is a cusstomer support app. (youve been helping me with it for a while.. We call is CGS, it is by ACSR http://www.csgsystems.com/CSG_Content.aspx?L1=3&L2=9&L3=23 
When I look at it through Winspector, it DOES report "SysTreeView32", so I guess it is normal....
0
 
LVL 35

Accepted Solution

by:
Norie earned 1000 total points
ID: 35509682
Thought I recognised it from somewhere, and I think I might have made a similar suggestion as LMSConsulting.

Have you never considered that for whatever reason this data just isn't available?

Perhaps it's a permission/security thing.

If you are getting some data, no matter how badly formed it might be worth expending energy on that - it must be of some use.

In fact it might even be the data you want, just not how you want or expect it.

PS No treeviews in the page that link leads to - but I realise it's probably not what you are working with.
0
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 35509707
In most cases, "scraping" data from another source is not something we can help with due to EE restrictions. The only exceptions would be publicly available websites that specifically state you may do so.
0
 

Author Comment

by:Bruj
ID: 35700931
LSMConsulting, I can kinda see why... I have tested the code on another app that also has a Systreview32 class and I can get the count of items....
So, I will try another route, yet again....


Thanks though!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question