?
Solved

Obtain data from an external Treeview

Posted on 2003-03-13
7
Medium Priority
?
574 Views
Last Modified: 2010-08-05
Hi Guys,

First question... hope one of you can help! I am attemtping to retrieve data from a TreeView in an external process. I have successfully connected to the Handle of the Window the TreeView is in, and stepped down to have the handle of the TreeView itself.

I have also successfully retrieved the textual parts of a StatusBar, using VirtualAllocEx in the external process.

// Get process handle
GetWindowThreadProcessID(hMain, @idProcess);
hProcess := OpenProcess(PROCESS_ALL_ACCESS, False, idProcess);
if hProcess = 0 then RaiseLastWin32Error;

// Allocate buffer in process
pBuf := VirtualAllocEx(hProcess, nil, cBuf, MEM_COMMIT, PAGE_READWRITE);
if pBuf = nil then RaiseLastWin32Error;

//Get the Tree Handles
upTreehWnd := FindWindowEx(upstathwnd,0,'SysTreeView32',nil);
dnTreehWnd := FindWindowEx(dnstathwnd,0,'SysTreeView32',nil);
Form1.ListBox1.Items.Add('Up Tree = ' + inttostr(uptreehwnd) + ', Down Tree = ' + inttostr(dntreehWnd));

//Tree Counts
utrCount := treeview_getcount(uptreehwnd);
dtrCount := treeview_getcount(dntreehwnd);
form1.listbox1.Items.add('UpCount = ' + inttostr(utrCount) + ', DownCount = ' + inttostr(dtrCount));

//Try to get TreeItems
dnRt := treeview_getnextitem(dntreehwnd,0,TVGN_FIRSTVISIBLE);
dnRtN := treeview_getnextitem(dntreehwnd,dnrt, TVGN_NEXTVISIBLE);

//Create a TV_ITEM
dnRtItem.mask := TVIF_HANDLE and TVIF_TEXT;
dnRtItem.pszText := @s;
dnRtItem.cchTextMax := 1024;
dnRtItem.hItem := dnRT;

WHAT I need to do now I believe (from another subject http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20096218.html) is that I need to write the empty TV_ITEM using WriteProcessItem to the virtual memory in the other process, then call the TreeView_GetItem to populate that item, using the Memory of the other process, and then read it back into the local environment.

//Write the TV_ITEM to the Remote Process
rBln := WriteProcessMemory(hProcess, pointer(pTreeBuf), @pTreeBuf,sizeof(pTreeBuf), nil);

I believe that my problems are in the correct set-up of the local Pointers/Objects and their usage within the WriteProcessMemory function. However I may be wring... I've been using delphi for about 15 days so far...!

Ideally, an Expert will be able to provide me with details of how to set-up the TV_ITEM locally to receive information, how to write the blank TV_ITEM to the external process, how to retrieve the TV_ITEM back to the local process, and then perhaps help get access to the TV_ITEM textual content.

I am a total newbie at this, and I have no idea whether the number of points I have posted is acceptable or not. I'm hoping someone can help regardless.

Javen
0
Comment
Question by:Javen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 8130509
listening
0
 

Author Comment

by:Javen
ID: 8145968
Hi Peter,

What does listening mean? Is this som3 sort of eXe jargon?

If the question does not have enought points attached, can someone just say so!

Cheers,

Javen
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 8147135
It's just a way to say that i'm listening to this, and i want everybody else to know that i'm here :-)

If you raise the points you will probably get more attention - dont know for sure.
I think the question is to long. Maybe thats the problem.

/Peter
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Javen
ID: 8150303
Cheers Peter,

I followed the instructions of the eXe Question posting guide, but perhaps I went a bit overboard!

I will endeavour to raise the points...

Javen
0
 

Author Comment

by:Javen
ID: 8150321
Points increased...
0
 
LVL 2

Accepted Solution

by:
PeterLarsen earned 1050 total points
ID: 8150378
Maybe you should post a question in the C++ topic area.
Don't post the entire question there - just the URL to this question and a few words.
0
 

Author Comment

by:Javen
ID: 8942029
This question is closed and dead... has been for ages, so I shall close it and award the points to PeterLarsen!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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