能给一个例子子吗

解决方案 »

  1.   

    这个问题我已经回答了很多次了。
    是这样的,由于不同的进程间没有办法传递指针,所以没有办法得到其他树的内容
    建议使用钩子,
    同时也有其他的方法。
    你可以参考帖子:http://expert.csdn.net/Expert/topic/1803/1803463.xml?temp=.8687097/////////////////////////////////////////////////////////////
    a) Obtain process id of B by GetWindowThreadProcessId(hTV,&pid)b) Get the process handle of B by OpenProcess(PROCESS_VM_WRITE| PROCESS_VM_OPERATION | PROCESS_VM_READ)c) Allocate the memory in the address space of B by VirtualAllocEx. Allocated block must be large enough 
    to hold TVITEM structure and the buffer for the item text. Like this:struct S {
      TVITEM it;
      char buf[120];
    } s;S* ps=VirtualAllocEx(... sizeof(s)...)d) Fill allocated memory by WriteProcessMemory:s.it.iItem=...;
    ...
    s.pszText=LPSTR( 
        LPBYTE(ps)+(LPBYTE(s.buf)-LPBYTE(&s))  );
    s.cchTextMax=sizeof(s.buf);Now copy s struct to ps by WriteProcessMemory.e) Call TreeView_GetItem(hTV,ps);f) Read contents of ps->buf by ReadProcessMemory()g) Use VirtualFreeEx to free memory and CloseHandle to close process handle.