<?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[Fenster [SICHER] in den Vordergrund bringen!]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>und zwar hab ich mom. ein großes Problem, ein bestimmtes Fenster im Vordergrund zu halten.<br />
Es gibt manchmal folgenden Fall:<br />
Fenster ist im Hintergrund und wird nicht aktiviert, <strong>GetForegroundWindow()</strong> gibt aber das richtige Handle zurück.</p>
<p>Mein aktueller Code:</p>
<pre><code>//--------------------------------------
// Purpose: try activating frame for capturing 
//--------------------------------------
bool CCaptureFrame::DoFrameActivation( bool frame_select )
{
	if( IsWindow(m_BasehWnd) )
	{	
		if( IsIconic(m_BasehWnd) )
		{
			// restore window
			ShowWindow( m_BasehWnd, SW_RESTORE );
		}//if
		else
		{
			// simple show
			ShowWindow( m_BasehWnd, SW_SHOW );
		}

		// bring window to front, use komplex activation
		DWORD lpProcessBasehWnd = GetWindowThreadProcessId( m_BasehWnd, 0 );
		DWORD lpProcessCurrhWnd = GetWindowThreadProcessId( GetForegroundWindow(), 0 );

		// ---------------------------------------------------------------------
		// 
		// ---------------------------------------------------------------------
		if( lpProcessBasehWnd == lpProcessCurrhWnd )
		{
			SetForegroundWindow( m_BasehWnd );
		}
		else
		{
			// attach input to other process
			AttachThreadInput( lpProcessCurrhWnd, lpProcessBasehWnd, true );
			SetForegroundWindow( m_BasehWnd );
			AttachThreadInput( lpProcessCurrhWnd, lpProcessBasehWnd, false );
		}
	}//if

	return true;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/202386/fenster-sicher-in-den-vordergrund-bringen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 21:12:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/202386.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 11 Jan 2008 00:31:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fenster [SICHER] in den Vordergrund bringen! on Fri, 11 Jan 2008 00:31:52 GMT]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>und zwar hab ich mom. ein großes Problem, ein bestimmtes Fenster im Vordergrund zu halten.<br />
Es gibt manchmal folgenden Fall:<br />
Fenster ist im Hintergrund und wird nicht aktiviert, <strong>GetForegroundWindow()</strong> gibt aber das richtige Handle zurück.</p>
<p>Mein aktueller Code:</p>
<pre><code>//--------------------------------------
// Purpose: try activating frame for capturing 
//--------------------------------------
bool CCaptureFrame::DoFrameActivation( bool frame_select )
{
	if( IsWindow(m_BasehWnd) )
	{	
		if( IsIconic(m_BasehWnd) )
		{
			// restore window
			ShowWindow( m_BasehWnd, SW_RESTORE );
		}//if
		else
		{
			// simple show
			ShowWindow( m_BasehWnd, SW_SHOW );
		}

		// bring window to front, use komplex activation
		DWORD lpProcessBasehWnd = GetWindowThreadProcessId( m_BasehWnd, 0 );
		DWORD lpProcessCurrhWnd = GetWindowThreadProcessId( GetForegroundWindow(), 0 );

		// ---------------------------------------------------------------------
		// 
		// ---------------------------------------------------------------------
		if( lpProcessBasehWnd == lpProcessCurrhWnd )
		{
			SetForegroundWindow( m_BasehWnd );
		}
		else
		{
			// attach input to other process
			AttachThreadInput( lpProcessCurrhWnd, lpProcessBasehWnd, true );
			SetForegroundWindow( m_BasehWnd );
			AttachThreadInput( lpProcessCurrhWnd, lpProcessBasehWnd, false );
		}
	}//if

	return true;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1434638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1434638</guid><dc:creator><![CDATA[JayJay1]]></dc:creator><pubDate>Fri, 11 Jan 2008 00:31:52 GMT</pubDate></item><item><title><![CDATA[Reply to Fenster [SICHER] in den Vordergrund bringen! on Fri, 11 Jan 2008 00:43:48 GMT]]></title><description><![CDATA[<p>Hi, sry war eine ältere Version:</p>
<pre><code class="language-cpp">if( IsWindow(m_BasehWnd) &amp;&amp; GetForegroundWindow() != m_BasehWnd )
	{	
		if( IsIconic(m_BasehWnd) )
		{
			// restore window
			ShowWindow( m_BasehWnd, SW_RESTORE );
		}//if
		else
		{
			// simple show
			ShowWindow( m_BasehWnd, SW_SHOW );
		}

		// bring window to front, use komplex activation
		DWORD lpProcessBasehWnd = GetWindowThreadProcessId( m_BasehWnd, 0 );
		DWORD lpProcessCurrhWnd = GetWindowThreadProcessId( GetForegroundWindow(), 0 );

		// ---------------------------------------------------------------------
		// 
		// ---------------------------------------------------------------------
		if( lpProcessBasehWnd == lpProcessCurrhWnd )
		{
			SetForegroundWindow( m_BasehWnd );
		}
		else
		{
			// attach input to other process
			AttachThreadInput( lpProcessCurrhWnd, lpProcessBasehWnd, true );
			SetForegroundWindow( m_BasehWnd );
			AttachThreadInput( lpProcessCurrhWnd, lpProcessBasehWnd, false );
		}

		if( frame_select )
		{
			SelectFirstItem();
		}
	}//if
	return true;
}
</code></pre>
<p>Ich muss noch dazu sagen, dass dieser Code jede Sekunde durchgeführt wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1434640</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1434640</guid><dc:creator><![CDATA[JayJay1]]></dc:creator><pubDate>Fri, 11 Jan 2008 00:43:48 GMT</pubDate></item><item><title><![CDATA[Reply to Fenster [SICHER] in den Vordergrund bringen! on Fri, 11 Jan 2008 12:28:18 GMT]]></title><description><![CDATA[<p>Ein kleines Feedback wäre ne super Sache <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1434839</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1434839</guid><dc:creator><![CDATA[JayJay1]]></dc:creator><pubDate>Fri, 11 Jan 2008 12:28:18 GMT</pubDate></item></channel></rss>