<?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[Ausdrucken von Steuerelementen]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe in längerer Arbeit es endlich geschafft, dass die Oberfläche eines ActiveX-Elements gedruckt wird. Jetzt hab ich aber noch ein Problem. Er druckt zwar genauso groß wie die Fläche ist, allerdings druckt er auch alle anderen Objekte, die vor dieser FLäche sind. Liegt die Fläche außerhalb des Fensters, so wird der Teil schwarz dargestellt beim Drucken! D.h. er arbeitet mit Screenshots, allerdings würde ich gerne immer den Inhalt dieser Fläche ausdrucken, egal ob was davor liegt oder es außerhalb des Sichtbaren angeordnet ist.</p>
<p>Kann mir da jemand helfen? Ich würde mich freuen! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
<p>Weiter unten ist der Quelltext zu finden!</p>
<p>Vielen Dank!</p>
<pre><code class="language-cpp">LRESULT CMainDlg::printDiagramm()
{
HRESULT hr;
DOCINFO di;
DWORD dwError;
HWND hWnd = wDiag;
CPrintDialog tmp_CPD(FALSE, PD_PAGENUMS | PD_USEDEVMODECOPIES);
tmp_CPD.GetDefaults();
DEVMODE* dm=(DEVMODE*) GlobalLock(tmp_CPD.m_pd.hDevMode);
dm-&gt;dmFields|=DM_ORIENTATION;
dm-&gt;dmOrientation=DMORIENT_LANDSCAPE;
tmp_CPD.m_pd.Flags &amp;= ~PD_RETURNDEFAULT;
GlobalUnlock(tmp_CPD.m_pd.hDevMode);

if (tmp_CPD.DoModal() != IDOK)
{	  
return -1;
}

CDC printerDC = tmp_CPD.GetPrinterDC(); // bool GetPrinterInfo(HANDLE hPrinter)

CAxWindow m_wndView = wDiag;
::ShowWindow(m_wndView, SW_SHOW);
CDC screenDC = m_wndView.GetWindowDC();
CRect screenRect;	
m_wndView.GetClientRect(&amp;screenRect);

int iPrinterW = printerDC.GetDeviceCaps(HORZRES);
int iPrinterH = printerDC.GetDeviceCaps(VERTRES);
int iScreenW  = screenRect.Width();
int iScreenH  = screenRect.Height()-33;

HDC memDC = CreateCompatibleDC( printerDC );

di.cbSize = sizeof(DOCINFO) ;
bstr_t printName = &quot;MaximusGLT&quot;;
di.lpszDocName = printName;
di.lpszOutput = NULL ;

hr = printerDC.StartDoc(&amp;di) ; 
hr = printerDC.StartPage();
screen contents

hr = printerDC.StretchBlt( 0, 0, iPrinterW, iPrinterH, screenDC, 0, 0, (iScreenW), (iScreenH), SRCCOPY );

dwError = GetLastError();
hr = printerDC.EndPage();
hr = printerDC.EndDoc();

m_wndView.BringWindowToTop();
m_wndView.FlashWindow(FALSE);
m_wndView.Invalidate(TRUE);
m_wndView.RedrawWindow();
m_wndView.SetFocus();

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/203287/ausdrucken-von-steuerelementen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Apr 2026 22:02:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/203287.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 Jan 2008 10:38:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ausdrucken von Steuerelementen on Mon, 21 Jan 2008 10:38:32 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe in längerer Arbeit es endlich geschafft, dass die Oberfläche eines ActiveX-Elements gedruckt wird. Jetzt hab ich aber noch ein Problem. Er druckt zwar genauso groß wie die Fläche ist, allerdings druckt er auch alle anderen Objekte, die vor dieser FLäche sind. Liegt die Fläche außerhalb des Fensters, so wird der Teil schwarz dargestellt beim Drucken! D.h. er arbeitet mit Screenshots, allerdings würde ich gerne immer den Inhalt dieser Fläche ausdrucken, egal ob was davor liegt oder es außerhalb des Sichtbaren angeordnet ist.</p>
<p>Kann mir da jemand helfen? Ich würde mich freuen! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
<p>Weiter unten ist der Quelltext zu finden!</p>
<p>Vielen Dank!</p>
<pre><code class="language-cpp">LRESULT CMainDlg::printDiagramm()
{
HRESULT hr;
DOCINFO di;
DWORD dwError;
HWND hWnd = wDiag;
CPrintDialog tmp_CPD(FALSE, PD_PAGENUMS | PD_USEDEVMODECOPIES);
tmp_CPD.GetDefaults();
DEVMODE* dm=(DEVMODE*) GlobalLock(tmp_CPD.m_pd.hDevMode);
dm-&gt;dmFields|=DM_ORIENTATION;
dm-&gt;dmOrientation=DMORIENT_LANDSCAPE;
tmp_CPD.m_pd.Flags &amp;= ~PD_RETURNDEFAULT;
GlobalUnlock(tmp_CPD.m_pd.hDevMode);

if (tmp_CPD.DoModal() != IDOK)
{	  
return -1;
}

CDC printerDC = tmp_CPD.GetPrinterDC(); // bool GetPrinterInfo(HANDLE hPrinter)

CAxWindow m_wndView = wDiag;
::ShowWindow(m_wndView, SW_SHOW);
CDC screenDC = m_wndView.GetWindowDC();
CRect screenRect;	
m_wndView.GetClientRect(&amp;screenRect);

int iPrinterW = printerDC.GetDeviceCaps(HORZRES);
int iPrinterH = printerDC.GetDeviceCaps(VERTRES);
int iScreenW  = screenRect.Width();
int iScreenH  = screenRect.Height()-33;

HDC memDC = CreateCompatibleDC( printerDC );

di.cbSize = sizeof(DOCINFO) ;
bstr_t printName = &quot;MaximusGLT&quot;;
di.lpszDocName = printName;
di.lpszOutput = NULL ;

hr = printerDC.StartDoc(&amp;di) ; 
hr = printerDC.StartPage();
screen contents

hr = printerDC.StretchBlt( 0, 0, iPrinterW, iPrinterH, screenDC, 0, 0, (iScreenW), (iScreenH), SRCCOPY );

dwError = GetLastError();
hr = printerDC.EndPage();
hr = printerDC.EndDoc();

m_wndView.BringWindowToTop();
m_wndView.FlashWindow(FALSE);
m_wndView.Invalidate(TRUE);
m_wndView.RedrawWindow();
m_wndView.SetFocus();

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1440452</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1440452</guid><dc:creator><![CDATA[plizer]]></dc:creator><pubDate>Mon, 21 Jan 2008 10:38:32 GMT</pubDate></item><item><title><![CDATA[Reply to Ausdrucken von Steuerelementen on Mon, 21 Jan 2008 13:33:48 GMT]]></title><description><![CDATA[<p>Mir würde es auch schon weiterhelfen, wenn ich wüsste wie ich von meinem kompletten Programm einen Screenshot ausdrucken könnte, aber der Screenshot müsste alles beinhalten, auch wenn ein Teil vielleicht nicht auf dem Bildschirm zu sehen ist?</p>
<p>Mit der MFC wüsste ich wie es geht, aber ich muss es mit ATL, WTL bzw. der API machen!</p>
<p>Vielen Dank für jeden noch so kleinen Tipp!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1440593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1440593</guid><dc:creator><![CDATA[plizer]]></dc:creator><pubDate>Mon, 21 Jan 2008 13:33:48 GMT</pubDate></item></channel></rss>