挖井

类库大魔王的挖井日记

挖一口属于自己的井


编程读取其它进程中TabControl的内容

void __fastcall TMainForm::GetTabControlContent()
{
        //TODO: Add your source code here
    int nItemCount;
    int i;
    char chBuffer[256];
    DWORD dwProcessID;
    HANDLE hProcess;
    void * Pointer;
    SIZE_T nNumberOfBytesRead;
    TTCItem Item;

    nItemCount = TabCtrl_GetItemCount(hWindow);
    GetWindowThreadProcessId(hWindow, &dwProcessID);
    hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE,
                    false,
                    dwProcessID);
    Pointer = VirtualAllocEx(hProcess,
                            NULL,
                            4096,
                            MEM_RESERVE | MEM_COMMIT,
                            PAGE_READWRITE);
    try{
    for(i= 0 ; i < nItemCount ; ++i)
    {
       Item.mask = TCIF_TEXT;
       Item.cchTextMax = sizeof (chBuffer);
       Item.pszText = (LPSTR)((UINT *)Pointer + sizeof(TTCItem));

       WriteProcessMemory(hProcess,
                    Pointer,
                    &Item,
                    sizeof(TTCItem),
                    &nNumberOfBytesRead);
       SendMessage(hWindow, TCM_GETITEM , i, (LPARAM)Pointer);
       ReadProcessMemory(hProcess,
                    (void *)((UINT *)Pointer + sizeof(TTCItem)),
                    chBuffer,
                    sizeof(chBuffer),
                    &nNumberOfBytesRead);
       ContentMemo->Lines->Add(chBuffer);
    }//for(i...
    }//try
    __finally
    {
      VirtualFreeEx(hProcess,
                    Pointer,
                    0,
                    MEM_RELEASE);
      CloseHandle(hProcess);
    }
}

本文地址:

https://minidump.info/blog/2005/02/E7-BC-96-E7-A8-8B-E8-AF-BB-E5-8F-96-E5-85-B6-E5-AE-83-E8-BF-9B-E7-A8-8B-E4-B8-ADTabControl-E7-9A-84-E5-86-85-E5-AE-B9/

感觉本文不错,不妨小额鼓励我一下!
上一篇

编程读取其它进程中SysHeader的内容

void __fastcall TMainForm::GetHeaderContent(){ //TODO: Add your source code here int nItemCount; int i; char chBuffer[256]; DWOR...…

imported from CSDN 全文阅读
下一篇

编程读取其它进程中ToolBar的内容

void __fastcall TMainForm::GetToolBarContent(){ //TODO: Add your source code here int nItemCount; int i; char chBuffer[256]; DWO...…

imported from CSDN 全文阅读