如题,需要得到按住Alt + Tab列出来的程序列表及句柄,而不是任务管理器中的进程列表.

解决方案 »

  1.   

    Alt-Tab出来的应该是窗口的列表,就是任务管理器里面的应用程序。
      

  2.   


    http://www.graphics.net.cn/bbs/delphi/0044/160.asp
      

  3.   

    procedure TfrmProcessList.GetProcess;
    var
      CurWin, Desktop, Len : Integer;     //当前窗口句柄,桌面句柄(也是一个句柄),窗体标题长度
      Style : longint;                  //窗体类别
      str : array[0..255] of char;
    begin
      CurWin := 0;
      Desktop := GetDesktopWindow;
      repeat
        CurWin := findwindowex(Desktop,curwin,nil,nil);   //找他的子窗体
        Len := GetWindowTextLength(CurWin) + 1;  //长度
        if IsWindowVisible(curwin)  //可见
           and ((GetWindowLong(curwin, GWL_HWNDPARENT) = 0)  or    //是一级窗体
           (HWND(GetWindowLong(curwin, GWL_HWNDPARENT)) = GetDesktopWindow))
           and((GetWindowLong(curwin, GWL_EXSTYLE) and WS_EX_TOOLWINDOW) = 0)
           then
        begin
          getwindowtext(CurWin,str,len);
          lbxProcess.Items.Add(Str);
        end;
      until CurWin=0;
      curwin:=0;
      Desktop:=GetDesktopWindow;
    end;唉,都不能得到帮助...