<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Drucken mit Schriftart-Einstellung]]></title><description><![CDATA[<p>Hallo,</p>
<p>kann mir jemand verraten, weshalb nachfolgender Code nicht das tut was ich eigentlich erhoffe ... ? Wahrscheinlich bin ich blind, aber es müsste doch möglich sein, die Schriftart für den Druck zu ändern, oder ... ?</p>
<pre><code class="language-cpp">BOOL TextDrucken (char* szINText)
{
	PRINTDLG pd={0};

	DOCINFO di={0};

	di.cbSize=sizeof(DOCINFO); 

	pd.lStructSize=sizeof(PRINTDLG);
	pd.hDevMode=NULL;
	pd.hDevNames=NULL;
	pd.Flags=PD_RETURNDC | PD_NOPAGENUMS | PD_NOSELECTION;
	pd.hwndOwner=NULL;
	pd.hDC=NULL;
	pd.nFromPage=0;
	pd.nToPage=0;
	pd.nMinPage=0;
	pd.nMaxPage=0;
	pd.nCopies=1;
	pd.hInstance=NULL;
	pd.lCustData=0L;
	pd.lpfnPrintHook=NULL;
	pd.lpfnSetupHook=NULL;
	pd.lpPrintTemplateName=NULL;
	pd.lpSetupTemplateName=NULL;
	pd.hPrintTemplate=NULL;
	pd.hSetupTemplate=NULL;

	if(PrintDlg(&amp;pd)==0)
	{
		DeleteDC(pd.hDC);

		return FALSE;
	}

	// Warum kann ich die Font nicht setzen ... ?

    SelectObject(pd.hDC,MyCreateFont()))

	// Hiermit erhaltene ich die Font und die folgende MessageBox
        // zeigt mir diese korrekt auch an ! Aber Drucken tut er nur immer das gleiche

	char szFont[50]={0};

	GetTextFace(pd.hDC,50,szFont);
	MessageBox(NULL,szFont,&quot;Nachher-&gt;&quot;,0);

	// Eigentliches Drucken beginnen wenn nicht möglich, abbrechen

	if(StartDoc(pd.hDC,&amp;di)&lt;=0)
	{
		DeleteDC(pd.hDC);

		return FALSE;
	}

	// Seite starten

	StartPage(pd.hDC);

	// Druckausgabe
/*
	int iBreite=(GetDeviceCaps(pd.hDC,HORZRES))-30;
	int iHoehe=(GetDeviceCaps(pd.hDC,VERTRES))-20;
*/
	TextOut(pd.hDC,10,20,szINText,strlen(szINText));

	// Seite beenden

	EndPage(pd.hDC);
	EndDoc(pd.hDC);

	DeleteDC(pd.hDC);

	return TRUE;
}

// Diese Funktion ist aus dem SDK geklaut und gibt mir auch 100prozentig ne Schriftart zurück !

HFONT FAR PASCAL MyCreateFont( void ) 
{ 
    CHOOSEFONT cf; 
    LOGFONT lf; 
    HFONT hfont; 

    // Initialize members of the CHOOSEFONT structure. 

    cf.lStructSize = sizeof(CHOOSEFONT); 
    cf.hwndOwner = (HWND)NULL; 
    cf.hDC = (HDC)NULL; 
    cf.lpLogFont = &amp;lf; 
    cf.iPointSize = 0; 
    cf.Flags = CF_SCREENFONTS; 
    cf.rgbColors = RGB(0,0,0); 
    cf.lCustData = 0L; 
    cf.lpfnHook = (LPCFHOOKPROC)NULL; 
    cf.lpTemplateName = (LPSTR)NULL; 
    cf.hInstance = (HINSTANCE) NULL; 
    cf.lpszStyle = (LPSTR)NULL; 
    cf.nFontType = SCREEN_FONTTYPE; 
    cf.nSizeMin = 0; 
    cf.nSizeMax = 0; 

    // Display the CHOOSEFONT common-dialog box. 

    ChooseFont(&amp;cf); 

    // Create a logical font based on the user's 
    // selection and return a handle identifying 
    // that font. 

    hfont = CreateFontIndirect(cf.lpLogFont); 
    return (hfont); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/134387/drucken-mit-schriftart-einstellung</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 02:40:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/134387.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 Jan 2006 17:04:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Drucken mit Schriftart-Einstellung on Wed, 25 Jan 2006 17:04:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>kann mir jemand verraten, weshalb nachfolgender Code nicht das tut was ich eigentlich erhoffe ... ? Wahrscheinlich bin ich blind, aber es müsste doch möglich sein, die Schriftart für den Druck zu ändern, oder ... ?</p>
<pre><code class="language-cpp">BOOL TextDrucken (char* szINText)
{
	PRINTDLG pd={0};

	DOCINFO di={0};

	di.cbSize=sizeof(DOCINFO); 

	pd.lStructSize=sizeof(PRINTDLG);
	pd.hDevMode=NULL;
	pd.hDevNames=NULL;
	pd.Flags=PD_RETURNDC | PD_NOPAGENUMS | PD_NOSELECTION;
	pd.hwndOwner=NULL;
	pd.hDC=NULL;
	pd.nFromPage=0;
	pd.nToPage=0;
	pd.nMinPage=0;
	pd.nMaxPage=0;
	pd.nCopies=1;
	pd.hInstance=NULL;
	pd.lCustData=0L;
	pd.lpfnPrintHook=NULL;
	pd.lpfnSetupHook=NULL;
	pd.lpPrintTemplateName=NULL;
	pd.lpSetupTemplateName=NULL;
	pd.hPrintTemplate=NULL;
	pd.hSetupTemplate=NULL;

	if(PrintDlg(&amp;pd)==0)
	{
		DeleteDC(pd.hDC);

		return FALSE;
	}

	// Warum kann ich die Font nicht setzen ... ?

    SelectObject(pd.hDC,MyCreateFont()))

	// Hiermit erhaltene ich die Font und die folgende MessageBox
        // zeigt mir diese korrekt auch an ! Aber Drucken tut er nur immer das gleiche

	char szFont[50]={0};

	GetTextFace(pd.hDC,50,szFont);
	MessageBox(NULL,szFont,&quot;Nachher-&gt;&quot;,0);

	// Eigentliches Drucken beginnen wenn nicht möglich, abbrechen

	if(StartDoc(pd.hDC,&amp;di)&lt;=0)
	{
		DeleteDC(pd.hDC);

		return FALSE;
	}

	// Seite starten

	StartPage(pd.hDC);

	// Druckausgabe
/*
	int iBreite=(GetDeviceCaps(pd.hDC,HORZRES))-30;
	int iHoehe=(GetDeviceCaps(pd.hDC,VERTRES))-20;
*/
	TextOut(pd.hDC,10,20,szINText,strlen(szINText));

	// Seite beenden

	EndPage(pd.hDC);
	EndDoc(pd.hDC);

	DeleteDC(pd.hDC);

	return TRUE;
}

// Diese Funktion ist aus dem SDK geklaut und gibt mir auch 100prozentig ne Schriftart zurück !

HFONT FAR PASCAL MyCreateFont( void ) 
{ 
    CHOOSEFONT cf; 
    LOGFONT lf; 
    HFONT hfont; 

    // Initialize members of the CHOOSEFONT structure. 

    cf.lStructSize = sizeof(CHOOSEFONT); 
    cf.hwndOwner = (HWND)NULL; 
    cf.hDC = (HDC)NULL; 
    cf.lpLogFont = &amp;lf; 
    cf.iPointSize = 0; 
    cf.Flags = CF_SCREENFONTS; 
    cf.rgbColors = RGB(0,0,0); 
    cf.lCustData = 0L; 
    cf.lpfnHook = (LPCFHOOKPROC)NULL; 
    cf.lpTemplateName = (LPSTR)NULL; 
    cf.hInstance = (HINSTANCE) NULL; 
    cf.lpszStyle = (LPSTR)NULL; 
    cf.nFontType = SCREEN_FONTTYPE; 
    cf.nSizeMin = 0; 
    cf.nSizeMax = 0; 

    // Display the CHOOSEFONT common-dialog box. 

    ChooseFont(&amp;cf); 

    // Create a logical font based on the user's 
    // selection and return a handle identifying 
    // that font. 

    hfont = CreateFontIndirect(cf.lpLogFont); 
    return (hfont); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/976187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976187</guid><dc:creator><![CDATA[OhneKopf]]></dc:creator><pubDate>Wed, 25 Jan 2006 17:04:57 GMT</pubDate></item></channel></rss>