各位大哥帮帮忙啊

解决方案 »

  1.   

    Add a memo1 and button1 on your form:uses Winspool;procedure TForm1.Button1Click(Sender: TObject);
    const     {Uses winspool}
      PName = 'HP LaserJet 4050 Series';   // Your printer name.
      PPort = 'HPLaserJet4050Series';      // Your Printer port. 
      Pager_Name_Length = 64;              // constant length of pager name.
    var
      i, iLoop : Integer;
      pBuf : PChar;
    begin
      GetMem(pBuf ,Pager_Name_Length * DeviceCapabilities(PName,PPort,DC_PAPERNAMES,nil,nil));
      with Memo1, Lines do begin
        Clear;
        iLoop :=DeviceCapabilities(PName,PPort,DC_PAPERNAMES,pBuf,nil);
        // Printer support below pages:
        for i:=1 to iLoop do
          Add(pBuf + Pager_Name_Length * (i-1));
      end;
      FreeMem(pBuf);
    end;