Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Drucken: Querformat [NonVCL] (https://www.delphipraxis.net/85997-drucken-querformat-%5Bnonvcl%5D.html)

Daniel Schuhmann 7. Feb 2007 16:22


Drucken: Querformat [NonVCL]
 
Servus Leute,

ich hätt gern mal wieder ein Problem, und zwar geht es um's Drucken ohne VCL.

Delphi-Quellcode:
program Print;

{$APPTYPE CONSOLE}

uses
  Windows, Messages, WinSpool, MiniCommDlg;

procedure PrintProc;
var
  Pd : TPrintDlg;
  DocInfo: TDocInfo;
begin
  FillChar(Pd, sizeof(Pd), #0);
  Pd.lStructSize := sizeof(Pd);
  Pd.hWndOwner := 0;
  Pd.Flags := PD_RETURNDC;
  if PrintDlg(pd) then begin
    FillChar(DocInfo, sizeof(DocInfo), #0);
    DocInfo.cbSize := SizeOf(DocInfo);
    GetMem(DocInfo.lpszDocName, 32);
    lStrCpy(DocInfo.lpszDocName, 'Dokument');
    StartDoc(Pd.hDc, DocInfo);
    StartPage(Pd.hDc);
    TextOut(Pd.hDc, 00, 00, 'Seite 1', 7);
    EndPage(Pd.hDc);
    StartPage(Pd.hDc);
    TextOut(Pd.hDc, 00, 00, 'Seite 2', 7);
    EndPage(Pd.hDc);
    EndDoc(Pd.hDc);
    FreeMem(DocInfo.lpszDocName, 32);
    DeleteDC(Pd.hDC);
  end;
end;

begin
  PrintProc;
end.
Das hier funktioniert schon so, wie es soll.

Hinweis: Für's compilieren zu Hause einfach MiniCommDlg durch CommDlg ersetzen, MiniCommDlg ist nur meine miniaturisierte Unit.

Nun hätte ich nur gerne den Druckdialog mit der Option Querformat vorbelegt. Das PSDK hat da eine schöne Option pmOrientation (2=Landscape) in der DEVMODE-Struktur drin, aber ich hab es noch nicht hinbekommen, das so an den Dialog zu übermitteln, dass das Blättchen auch gedreht wird.

Vielleicht hat das schonmal jemand gemacht und weiß wie's geht?

Grüßle,
Daniel


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:55 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz