<?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[screenshot auf z.B. 800*600 verkleinern]]></title><description><![CDATA[<p>hallo,</p>
<p>ich habe hier einen code der ein screenshot macht und<br />
ihn im bmp-format auf der hdd abspeichert.</p>
<p>der screenshot ist dank GetSystemMetrics() so groß wie die<br />
auflösung... nur ich würde den screenshot gerne auf z.b: 800*600<br />
verkleinern.</p>
<p>wenn ich die werte 800 und 600 festlege, wird das bild allerdings<br />
nicht verkleinert, sondern nur 800*600 bildpunkte gespeichert.</p>
<p>ich hoffe ihr wisst was ich machen möchte <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="🙂"
    /> und ich weis nicht ob<br />
es leicht wird oder nicht, würde mich deswegen über antworten freuen.</p>
<p>hier der ganze code:</p>
<pre><code>#include &lt;windows.h&gt; 
#include &lt;stdlib.h&gt; 
#include &lt;string&gt; 
#include &lt;sstream&gt; 
#include &lt;iostream&gt; 
#include &lt;stdio.h&gt; 
using namespace std; 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIsntance, LPSTR lpCmdine, int nShowCmd) 
{ 

 HDC hdc, hdc2;
 int width,height;

 width = GetSystemMetrics(SM_CXSCREEN);
 height = GetSystemMetrics(SM_CYSCREEN);

 char *filename=&quot;c:\\desk.bmp&quot;; 
 hdc=GetDC(NULL); 

 HBITMAP aBmp; 
    BITMAPINFO bi; 
    HGDIOBJ OldObj; 
    void *dibvalues; 
    HANDLE fileHandle; 

    BITMAPFILEHEADER bmfh; 
    BITMAPINFOHEADER bmih; 
        DWORD bytes_write; 
    DWORD bytes_written; 

    hdc2=CreateCompatibleDC(hdc); 

    ZeroMemory(&amp;bmih,sizeof(BITMAPINFOHEADER)); 
    bmih.biSize=sizeof(BITMAPINFOHEADER); 
      bmih.biHeight=height; 
        bmih.biWidth=width; 
        bmih.biPlanes=1; 
        bmih.biBitCount=16; 
    bmih.biCompression=BI_RGB; 
    bmih.biSizeImage = ((((bmih.biWidth * bmih.biBitCount) + 31) &amp; ~31) &gt;&gt; 3) * bmih.biHeight; 
        bmih.biXPelsPerMeter = 0; 
        bmih.biYPelsPerMeter = 0; 
        bmih.biClrImportant = 0; 
    //bmih.biSizeImage=(3*bmih.biHeight*bmih.biWidth); 
        //bmih.biSizeImage = 0; 

    bi.bmiHeader=bmih; 

    aBmp=CreateDIBSection(hdc,&amp;bi,DIB_RGB_COLORS,(void**)&amp;dibvalues,NULL,NULL); 

    if (aBmp==NULL) 
    { 
        OutputDebugString(&quot;CreateDIBSection failed!\n&quot;); 
    } 

    OldObj=SelectObject(hdc2,aBmp); 
    BitBlt(hdc2,0,0,width,height,hdc,0,0,SRCCOPY); 

    ZeroMemory(&amp;bmfh,sizeof(BITMAPFILEHEADER)); 
    bmfh.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); 
    bmfh.bfSize=(3*bmih.biHeight*bmih.biWidth)+sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); 
        bmfh.bfType=0x4d42; 
        bmfh.bfReserved1 = 0; 
        bmfh.bfReserved2 = 0; 

    fileHandle=CreateFile(filename,GENERIC_READ | GENERIC_WRITE,(DWORD)0,NULL, 
                                                    CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL); 
    if (fileHandle==INVALID_HANDLE_VALUE) 
    { 
        OutputDebugString(&quot;CreateFile failed!\n&quot;); 
    } 

        // Write the BITMAPFILEHEADER 
        bytes_write=sizeof(BITMAPFILEHEADER); 
    if (!WriteFile(fileHandle,(void*)&amp;bmfh,bytes_write,&amp;bytes_written,NULL)) 
    { 
        OutputDebugString(&quot;WriteFile failed!\n&quot;); 
    } 

        //Write the BITMAPINFOHEADER 
    bytes_write=sizeof(BITMAPINFOHEADER); 
    if (!WriteFile(fileHandle,(void*)&amp;bmih,bytes_write,&amp;bytes_written,NULL)) 
    { 
        OutputDebugString(&quot;WriteFile failed!\n&quot;); 
    } 

        //Write the Color Index Array??? 
        bytes_write=bmih.biSizeImage;//3*bmih.biHeight*bmih.biWidth; 
    if (!WriteFile(fileHandle,(void*)dibvalues,bytes_write,&amp;bytes_written,NULL)) 
    { 
        OutputDebugString(&quot;WriteFile failed!\n&quot;); 
    } 

    CloseHandle(fileHandle); 

    DeleteObject(SelectObject(hdc2,OldObj)); 
    DeleteDC(hdc2);

}
</code></pre>
<p>danke schonmal, Babel</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/103118/screenshot-auf-z-b-800-600-verkleinern</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 12:47:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/103118.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Mar 2005 22:54:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to screenshot auf z.B. 800*600 verkleinern on Fri, 04 Mar 2005 22:54:52 GMT]]></title><description><![CDATA[<p>hallo,</p>
<p>ich habe hier einen code der ein screenshot macht und<br />
ihn im bmp-format auf der hdd abspeichert.</p>
<p>der screenshot ist dank GetSystemMetrics() so groß wie die<br />
auflösung... nur ich würde den screenshot gerne auf z.b: 800*600<br />
verkleinern.</p>
<p>wenn ich die werte 800 und 600 festlege, wird das bild allerdings<br />
nicht verkleinert, sondern nur 800*600 bildpunkte gespeichert.</p>
<p>ich hoffe ihr wisst was ich machen möchte <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="🙂"
    /> und ich weis nicht ob<br />
es leicht wird oder nicht, würde mich deswegen über antworten freuen.</p>
<p>hier der ganze code:</p>
<pre><code>#include &lt;windows.h&gt; 
#include &lt;stdlib.h&gt; 
#include &lt;string&gt; 
#include &lt;sstream&gt; 
#include &lt;iostream&gt; 
#include &lt;stdio.h&gt; 
using namespace std; 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIsntance, LPSTR lpCmdine, int nShowCmd) 
{ 

 HDC hdc, hdc2;
 int width,height;

 width = GetSystemMetrics(SM_CXSCREEN);
 height = GetSystemMetrics(SM_CYSCREEN);

 char *filename=&quot;c:\\desk.bmp&quot;; 
 hdc=GetDC(NULL); 

 HBITMAP aBmp; 
    BITMAPINFO bi; 
    HGDIOBJ OldObj; 
    void *dibvalues; 
    HANDLE fileHandle; 

    BITMAPFILEHEADER bmfh; 
    BITMAPINFOHEADER bmih; 
        DWORD bytes_write; 
    DWORD bytes_written; 

    hdc2=CreateCompatibleDC(hdc); 

    ZeroMemory(&amp;bmih,sizeof(BITMAPINFOHEADER)); 
    bmih.biSize=sizeof(BITMAPINFOHEADER); 
      bmih.biHeight=height; 
        bmih.biWidth=width; 
        bmih.biPlanes=1; 
        bmih.biBitCount=16; 
    bmih.biCompression=BI_RGB; 
    bmih.biSizeImage = ((((bmih.biWidth * bmih.biBitCount) + 31) &amp; ~31) &gt;&gt; 3) * bmih.biHeight; 
        bmih.biXPelsPerMeter = 0; 
        bmih.biYPelsPerMeter = 0; 
        bmih.biClrImportant = 0; 
    //bmih.biSizeImage=(3*bmih.biHeight*bmih.biWidth); 
        //bmih.biSizeImage = 0; 

    bi.bmiHeader=bmih; 

    aBmp=CreateDIBSection(hdc,&amp;bi,DIB_RGB_COLORS,(void**)&amp;dibvalues,NULL,NULL); 

    if (aBmp==NULL) 
    { 
        OutputDebugString(&quot;CreateDIBSection failed!\n&quot;); 
    } 

    OldObj=SelectObject(hdc2,aBmp); 
    BitBlt(hdc2,0,0,width,height,hdc,0,0,SRCCOPY); 

    ZeroMemory(&amp;bmfh,sizeof(BITMAPFILEHEADER)); 
    bmfh.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); 
    bmfh.bfSize=(3*bmih.biHeight*bmih.biWidth)+sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); 
        bmfh.bfType=0x4d42; 
        bmfh.bfReserved1 = 0; 
        bmfh.bfReserved2 = 0; 

    fileHandle=CreateFile(filename,GENERIC_READ | GENERIC_WRITE,(DWORD)0,NULL, 
                                                    CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL); 
    if (fileHandle==INVALID_HANDLE_VALUE) 
    { 
        OutputDebugString(&quot;CreateFile failed!\n&quot;); 
    } 

        // Write the BITMAPFILEHEADER 
        bytes_write=sizeof(BITMAPFILEHEADER); 
    if (!WriteFile(fileHandle,(void*)&amp;bmfh,bytes_write,&amp;bytes_written,NULL)) 
    { 
        OutputDebugString(&quot;WriteFile failed!\n&quot;); 
    } 

        //Write the BITMAPINFOHEADER 
    bytes_write=sizeof(BITMAPINFOHEADER); 
    if (!WriteFile(fileHandle,(void*)&amp;bmih,bytes_write,&amp;bytes_written,NULL)) 
    { 
        OutputDebugString(&quot;WriteFile failed!\n&quot;); 
    } 

        //Write the Color Index Array??? 
        bytes_write=bmih.biSizeImage;//3*bmih.biHeight*bmih.biWidth; 
    if (!WriteFile(fileHandle,(void*)dibvalues,bytes_write,&amp;bytes_written,NULL)) 
    { 
        OutputDebugString(&quot;WriteFile failed!\n&quot;); 
    } 

    CloseHandle(fileHandle); 

    DeleteObject(SelectObject(hdc2,OldObj)); 
    DeleteDC(hdc2);

}
</code></pre>
<p>danke schonmal, Babel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/737868</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/737868</guid><dc:creator><![CDATA[babelduo]]></dc:creator><pubDate>Fri, 04 Mar 2005 22:54:52 GMT</pubDate></item><item><title><![CDATA[Reply to screenshot auf z.B. 800*600 verkleinern on Fri, 04 Mar 2005 23:15:20 GMT]]></title><description><![CDATA[<p>BitBlt() durch StretchBlt() ersetzen und height/width an einigen Stellen abändern...<br />
...oder das ganze mit GDI+ machen (was z.B. den Vorteil hat, das die Qualität beim resizen besser ist und du Bitmaps z.B. auch als png, jpg und gif speichern kannst...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/737870</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/737870</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Fri, 04 Mar 2005 23:15:20 GMT</pubDate></item><item><title><![CDATA[Reply to screenshot auf z.B. 800*600 verkleinern on Sat, 05 Mar 2005 01:21:01 GMT]]></title><description><![CDATA[<p>ok, ich habe die zeile nun so umgeschrieben:</p>
<pre><code>StretchBlt(hdc2,0,0,800,600,hdc,0,0,width,height,SRCCOPY);
</code></pre>
<p>nur das problem ist das das bild dann immernoch width<em>height groß ist.<br />
es sind zwar nur 800</em>600 pixel so gefüllt wie ich es wollte... aber auch<br />
die dateigröße hat sich halt nicht verändert, und das war auch eines meider<br />
ziele!</p>
<p>also wie kann ich es noch machen das das bild dann nur 800*600 groß ist?</p>
<p>aber danke schonmal, Babelduo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/737909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/737909</guid><dc:creator><![CDATA[babelduo]]></dc:creator><pubDate>Sat, 05 Mar 2005 01:21:01 GMT</pubDate></item><item><title><![CDATA[Reply to screenshot auf z.B. 800*600 verkleinern on Sat, 05 Mar 2005 11:07:42 GMT]]></title><description><![CDATA[<p>das Bitmap, welches in hdc2 steckt muss dann natürlich auch nur noch 600*800 Pixel groß sein</p>
]]></description><link>https://www.c-plusplus.net/forum/post/737988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/737988</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Sat, 05 Mar 2005 11:07:42 GMT</pubDate></item><item><title><![CDATA[Reply to screenshot auf z.B. 800*600 verkleinern on Sat, 05 Mar 2005 23:23:01 GMT]]></title><description><![CDATA[<p>stimmt <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>danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/738456</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/738456</guid><dc:creator><![CDATA[Babelduo(net eingeloggt)]]></dc:creator><pubDate>Sat, 05 Mar 2005 23:23:01 GMT</pubDate></item></channel></rss>