<?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[Print Screen alle 5 Sek]]></title><description><![CDATA[<p>hi,<br />
wie kann ich den Screen alle 5 Sek in ein .jpg file speichern? hatte da glaub ich schon etwas zu print screen gesehen...kann es aber nicht mehr finden mit der suche:/</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/176396/print-screen-alle-5-sek</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 21:52:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/176396.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Mar 2007 20:05:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Tue, 20 Mar 2007 20:05:18 GMT]]></title><description><![CDATA[<p>hi,<br />
wie kann ich den Screen alle 5 Sek in ein .jpg file speichern? hatte da glaub ich schon etwas zu print screen gesehen...kann es aber nicht mehr finden mit der suche:/</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249382</guid><dc:creator><![CDATA[Waldii]]></dc:creator><pubDate>Tue, 20 Mar 2007 20:05:18 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Tue, 20 Mar 2007 20:17:27 GMT]]></title><description><![CDATA[<p>Hmm DC des betreffenden Fensters holen ... rüber kopieren in HBITMAP ... abspeichern ... nächstes Bild machen ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249398</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Tue, 20 Mar 2007 20:17:27 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Tue, 20 Mar 2007 20:26:07 GMT]]></title><description><![CDATA[<p>warum fenster? will ja vom ganzen desktop den screen speichern!</p>
<p>findest du das sample noch wo mit der suche?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249407</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249407</guid><dc:creator><![CDATA[Waldii]]></dc:creator><pubDate>Tue, 20 Mar 2007 20:26:07 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Tue, 20 Mar 2007 20:31:26 GMT]]></title><description><![CDATA[<p><a href="http://codeproject.com" rel="nofollow">codeproject.com</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249414</guid><dc:creator><![CDATA[Vertexwahn]]></dc:creator><pubDate>Tue, 20 Mar 2007 20:31:26 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 00:22:24 GMT]]></title><description><![CDATA[<p>Waldii schrieb:</p>
<blockquote>
<p>warum fenster? will ja vom ganzen desktop den screen speichern!</p>
</blockquote>
<p>Dann nimmst du als Fenster einfach NULL. Siehe auch im Forum VCL/CLX --&gt; FAQ --&gt; Screenshot.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249515</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249515</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Wed, 21 Mar 2007 00:22:24 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 12:56:30 GMT]]></title><description><![CDATA[<p>hi, hab ne konsolenanwendung erstellt die alle 5 sekunden einen screenshoot in eine .bmp datei speichern soll, ich verwende da einen timer! aber leider wird CaptureScreen nie aufgerufen...warum?</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

UINT_PTR nTimerId=0;
LPVOID pBits=NULL;
static HBITMAP	hDesktopCompatibleBitmap=NULL;
static HDC		hDesktopCompatibleDC=NULL;
static HDC		hDesktopDC=NULL;
static HWND		hDesktopWnd=NULL;
#define BITSPERPIXEL		32

void SaveBitmap(char *szFilename,HBITMAP hBitmap)
{
	HDC					hdc=NULL;
	FILE*				fp=NULL;
	LPVOID				pBuf=NULL;
	BITMAPINFO			bmpInfo;
	BITMAPFILEHEADER	bmpFileHeader;

	do{

		hdc=GetDC(NULL);
		ZeroMemory(&amp;bmpInfo,sizeof(BITMAPINFO));
		bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
		GetDIBits(hdc,hBitmap,0,0,NULL,&amp;bmpInfo,DIB_RGB_COLORS);

		if(bmpInfo.bmiHeader.biSizeImage&lt;=0)
			bmpInfo.bmiHeader.biSizeImage=bmpInfo.bmiHeader.biWidth*abs(bmpInfo.bmiHeader.biHeight)*(bmpInfo.bmiHeader.biBitCount+7)/8;

		if((pBuf=malloc(bmpInfo.bmiHeader.biSizeImage))==NULL)
		{
			MessageBox(NULL,&quot;Unable to Allocate Bitmap Memory&quot;,&quot;Error&quot;,MB_OK|MB_ICONERROR);
			break;
		}

		bmpInfo.bmiHeader.biCompression=BI_RGB;
		GetDIBits(hdc,hBitmap,0,bmpInfo.bmiHeader.biHeight,pBuf,&amp;bmpInfo,DIB_RGB_COLORS);	

		if((fp=fopen(szFilename,&quot;wb&quot;))==NULL)
		{
			MessageBox(NULL,&quot;Unable to Create Bitmap File&quot;,&quot;Error&quot;,MB_OK|MB_ICONERROR);
			break;
		}

		bmpFileHeader.bfReserved1=0;
		bmpFileHeader.bfReserved2=0;
		bmpFileHeader.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+bmpInfo.bmiHeader.biSizeImage;
		bmpFileHeader.bfType='MB';
		bmpFileHeader.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);

		fwrite(&amp;bmpFileHeader,sizeof(BITMAPFILEHEADER),1,fp);
		fwrite(&amp;bmpInfo.bmiHeader,sizeof(BITMAPINFOHEADER),1,fp);
		fwrite(pBuf,bmpInfo.bmiHeader.biSizeImage,1,fp);

	}while(false);

		if(hdc)
			ReleaseDC(NULL,hdc);

		if(pBuf)
			free(pBuf);

		if(fp)
			fclose(fp);
}

static void CALLBACK CaptureScreen(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
{
	OPENFILENAME	ofn;
	char	szFileName[512]; 

	strcpy(szFileName,&quot;C:\\ScreenShot.bmp&quot;);

	int		nWidth=GetSystemMetrics(SM_CXSCREEN);
	int		nHeight=GetSystemMetrics(SM_CYSCREEN);
	HDC		hBmpFileDC=CreateCompatibleDC(hDesktopDC);
	HBITMAP	hBmpFileBitmap=CreateCompatibleBitmap(hDesktopDC,nWidth,nHeight);
	HBITMAP hOldBitmap = (HBITMAP) SelectObject(hBmpFileDC,hBmpFileBitmap);
	BitBlt(hBmpFileDC,0,0,nWidth,nHeight,hDesktopDC,0,0,SRCCOPY|CAPTUREBLT);
	SelectObject(hBmpFileDC,hOldBitmap);

	SaveBitmap(ofn.lpstrFile,hBmpFileBitmap);

	DeleteDC(hBmpFileDC);
	DeleteObject(hBmpFileBitmap);
	SetCursor(LoadCursor(NULL,IDC_ARROW));
}

int main()
{
	BITMAPINFO	bmpInfo;
	ZeroMemory(&amp;bmpInfo,sizeof(BITMAPINFO));
	bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
	bmpInfo.bmiHeader.biBitCount=BITSPERPIXEL;
	bmpInfo.bmiHeader.biCompression = BI_RGB;
	bmpInfo.bmiHeader.biWidth=GetSystemMetrics(SM_CXSCREEN);
	bmpInfo.bmiHeader.biHeight=GetSystemMetrics(SM_CYSCREEN);
	bmpInfo.bmiHeader.biPlanes=1;
	bmpInfo.bmiHeader.biSizeImage=abs(bmpInfo.bmiHeader.biHeight)*bmpInfo.bmiHeader.biWidth*bmpInfo.bmiHeader.biBitCount/8;

	hDesktopWnd=GetDesktopWindow();
	hDesktopDC=GetDC(hDesktopWnd);
	hDesktopCompatibleDC=CreateCompatibleDC(hDesktopDC);
	hDesktopCompatibleBitmap=CreateDIBSection(hDesktopDC,&amp;bmpInfo,DIB_RGB_COLORS,&amp;pBits,NULL,0);
	if(hDesktopCompatibleDC==NULL || hDesktopCompatibleBitmap == NULL)
	{
		MessageBox(NULL,&quot;Unable to Create Desktop Compatible DC/Bitmap&quot;,&quot;Error&quot;,MB_OK|MB_ICONERROR);	return -1;
	}
	SelectObject(hDesktopCompatibleDC,hDesktopCompatibleBitmap);

	nTimerId=SetTimer(NULL,12345,5000,CaptureScreen);	//Timer set to 5000 ms.

	cin.get();

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1249759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249759</guid><dc:creator><![CDATA[Waldii]]></dc:creator><pubDate>Wed, 21 Mar 2007 12:56:30 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 13:10:03 GMT]]></title><description><![CDATA[<p>Weil du keine Message-Loop hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249770</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Wed, 21 Mar 2007 13:10:03 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 13:22:56 GMT]]></title><description><![CDATA[<p>warum brauch ich ne message loop und wie soll sie aussehen?</p>
<p>ich hab ja ein cin.get(); dabei...da sollte doch bis ich keine taste druecke die timerfunktion aufgerufen werden???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249778</guid><dc:creator><![CDATA[Waldii]]></dc:creator><pubDate>Wed, 21 Mar 2007 13:22:56 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 13:39:14 GMT]]></title><description><![CDATA[<p>Weil SetTimer() dafür sorgt das an dein Fenster WM_TIMER Nachrichten gesendet werden. In der MessageLoop wird dann erkannt das deine Callback-Funktion aufgerufen werden soll.</p>
<p>msdn: &quot;Creating a message loop&quot;:<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/usingmessagesandmessagequeues.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/usingmessagesandmessagequeues.asp</a></p>
<p>...oder in jedem WinAPI-Tutorial so ziemlich auf der erste Seite <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";D"
      alt="😉"
    /></p>
<p>...da du aber eigentlich eine Win32-Konsolenanwendung machen willst und kein Fenster: Wieso nimmst du nen WinAPI Timer? bzw. wozu brauchst du den überhaupt? - Macht dein Tool zwischendurch noch was anderes?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249791</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Wed, 21 Mar 2007 13:39:14 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 13:40:40 GMT]]></title><description><![CDATA[<p>hm da nimm ich doch lieber einen thread mit 5 sek sleep!</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249797</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249797</guid><dc:creator><![CDATA[Waldii]]></dc:creator><pubDate>Wed, 21 Mar 2007 13:40:40 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 15:37:52 GMT]]></title><description><![CDATA[<p>Du kannst einfach einen Timer mit Timer-Proc erstellen, das sollte am einfachsten sein.</p>
<p>PS: Was soll denn bitte das ?! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> :</p>
<pre><code class="language-cpp">do{
   // [...]
}while(false);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1249889</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249889</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 21 Mar 2007 15:37:52 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 15:46:23 GMT]]></title><description><![CDATA[<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> das ist ja mal nen geiles Konstrukt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249894</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Wed, 21 Mar 2007 15:46:23 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 16:48:17 GMT]]></title><description><![CDATA[<p>CodeFinder schrieb:</p>
<blockquote>
<p>Du kannst einfach einen Timer mit Timer-Proc erstellen, das sollte am einfachsten sein.</p>
</blockquote>
<p>sowas:</p>
<pre><code class="language-cpp">nTimerId=SetTimer(NULL,12345,1000,&amp;(TIMERPROC)CaptureScreen);	//Timer set to 500 ms.
</code></pre>
<p>das ohne message loop sollte ja funktionieren?</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249934</guid><dc:creator><![CDATA[Waldii]]></dc:creator><pubDate>Wed, 21 Mar 2007 16:48:17 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 17:01:40 GMT]]></title><description><![CDATA[<p>Joar mehr oder weniger...also bei Deinen Casts stehen mir die Haare zu Berge <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /></p>
<pre><code class="language-cpp">nTimerId = SetTimer(NULL, 12345, 1000, CaptureScreen);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1249954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249954</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 21 Mar 2007 17:01:40 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 17:13:32 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">nTimerId = SetTimer(NULL, 12345, 1000, CaptureScreen);	
C/C++ Code:
nTimerId = SetTimer(NULL, 12345, 1000, CaptureScreen);
</code></pre>
<p>braucht doch trotzdem ne message loop?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1249958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249958</guid><dc:creator><![CDATA[Waldii]]></dc:creator><pubDate>Wed, 21 Mar 2007 17:13:32 GMT</pubDate></item><item><title><![CDATA[Reply to Print Screen alle 5 Sek on Wed, 21 Mar 2007 17:25:11 GMT]]></title><description><![CDATA[<p>*msdn zitier aus den Remarks zu SetTimer()*</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. <strong>Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.</strong></p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1249971</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1249971</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Wed, 21 Mar 2007 17:25:11 GMT</pubDate></item></channel></rss>