请问能否实现截取窗口在最小化时的内容?例如开了一个窗口把它最小化后...可否截取这个窗口的内容?

解决方案 »

  1.   

    设Bordericons中的biMinize为false,窗口就不会被最小化了
    另外,最好设FormStyle为fsStayOnTop,这样就不会被其它窗口覆盖
      

  2.   

    没问题:以下程序就可以
    procedure TForm1.Button2Click(Sender: TObject);
    var
      hdw:THandle;
      st:dword;
    begin
      hdw:=FindWindow( nil,'TestForm'); //testform改成你要截取的窗口标题
      if hdw=0 then
      begin
         ShowMessage('TestForm not find!');
         exit;
      end;
      st:=$16cc0000;  // 改窗口属性
      SetWindowLong(hdw,GWL_STYLE,st);
      BringWindowToTop(hdw);  //放在最前面end;
      

  3.   

    //改进一下,刚才调用GetWindowLong一直不行,现在就没问题,真怪
    procedure TForm1.Button2Click(Sender: TObject);
    var
      hdw:THandle;
      st:dword;
    begin
      hdw:=FindWindow( nil,'TestForm');
      if hdw=0 then
      begin
         ShowMessage('TestForm not find!');
         exit;
      end;
       st:=GetWindowLong(hdw,GWL_STYLE );
      if st=0 then
      begin
        ShowMessage(SysErrorMessage(GetLastError()));
        exit;
      end;
      st:=st and (not (WS_MINIMIZEBOX or WS_MAXIMIZEBOX ) ) ;// 改窗口属性
      SetWindowLong(hdw,GWL_STYLE,st);
      SetWindowPos(hdw,HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
              SWP_NOSIZE or SWP_NOACTIVATE);     //放在最前面
    end;
      

  4.   

    每次截图时先利用setforegroundwindow(Handle)将所需截图的程序设为当前显示窗体