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
hProcess := OpenProcess(PROCESS_ALL_AC
CESS, 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,
dnTreehWnd := FindWindowEx(dnstathwnd,0,
Up Tree = ' + inttostr(uptreehwnd) + ', Down Tree = ' + inttostr(dntreehWnd));
utrCount := treeview_getcount(uptreehw
dtrCount := treeview_getcount(dntreehw
UpCount = ' + inttostr(utrCount) + ', DownCount = ' + inttostr(dtrCount));
//Try to get TreeItems
dnRt := treeview_getnextitem(dntre
dnRtN := treeview_getnextitem(dntre
//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(hProces
s, pointer(pTreeBuf), @pTreeBuf,sizeof(pTreeBuf)
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.