zoukankan      html  css  js  c++  java
  • 遍历任务栏上的窗体

    //-------Delphi-------
    uses CommCtrl;
     
    procedure TForm1.Button1Click(Sender: TObject);
    var
     vHandle: THandle;
     vCount: Integer;
     I: Integer;
     vProcessID: THandle;
     vProcess: THandle;
     vNumberOfBytesRead: DWORD;
     vPointer: Pointer;
     vBuffer: array[0..255] of Char;
    begin
     vHandle := FindWindow('Shell_TrayWnd', nil);
     vHandle := FindWindowEx(vHandle,0,'ReBarWindow32', nil);
     vHandle := FindWindowEx(vHandle,0,'MSTaskSwWClass', nil);
     vHandle := FindWindowEx(vHandle,0,'ToolbarWindow32', nil);
     vCount := SendMessage(vHandle, TB_BUTTONCOUNT,0,0);
     GetWindowThreadProcessId(vHandle,@vProcessId);
     vProcess := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or
        PROCESS_VM_WRITE, False, vProcessId);
     vPointer := VirtualAllocEx(vProcess, nil,$1000, MEM_RESERVE or MEM_COMMIT,
        PAGE_READWRITE);
     try
        for I :=0 to vCount -1 do
        begin
          SendMessage(vHandle, TB_GETBUTTONTEXT, I, Integer(vPointer));
          ReadProcessMemory(vProcess, vPointer,@vBuffer,
            SizeOf(vBuffer), vNumberOfBytesRead);
          OutputDebugString(@vBuffer);
        end;
     finally
        VirtualFreeEx(vProcess, vPointer,0, MEM_RELEASE);
        CloseHandle(vProcess);
     end;
    end;
  • 相关阅读:
    Solution -「ARC 126F」Affine Sort
    Solution -「ABC 219H」Candles
    Solution -「LOCAL」二进制的世界
    Solution Set -「ABC 217」
    Java 封装
    Java 对象和类
    Java 继承
    牛客网MySQL在线编程
    Linux uniq命令
    Linux 单引号、双引号、反引号
  • 原文地址:https://www.cnblogs.com/key-ok/p/3359022.html
Copyright © 2011-2022 走看看