<?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[Probleme mit GetFocus]]></title><description><![CDATA[<p>Ich habe ein kleines Problem beim ermitteln des Fenstername vom aktuellen Fenster das den Fokus hat:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;

void test()
 {

HWND focus;
char buffer[100];
int zeichern;

                       focus = GetFocus();
                       printf (&quot;%d\n&quot;,focus);

                       zeichern =  GetWindowTextLength (focus);
                       printf (&quot;%d\n&quot;,zeichern);

             GetWindowText(focus, buffer, zeichern);

printf (&quot;%s\n&quot;,buffer);

 }

int main()
{
sleep (5000);    
test(); 
system (&quot;PAUSE&quot;);
return 0;

}
</code></pre>
<p>Nur leider erhalte ich bei den ausgaben immer 0?<br />
Wieso ist das so?<br />
Was ist daran bitte verkehrt?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/202006/probleme-mit-getfocus</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 01:22:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/202006.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 06 Jan 2008 16:23:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 16:23:48 GMT]]></title><description><![CDATA[<p>Ich habe ein kleines Problem beim ermitteln des Fenstername vom aktuellen Fenster das den Fokus hat:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;

void test()
 {

HWND focus;
char buffer[100];
int zeichern;

                       focus = GetFocus();
                       printf (&quot;%d\n&quot;,focus);

                       zeichern =  GetWindowTextLength (focus);
                       printf (&quot;%d\n&quot;,zeichern);

             GetWindowText(focus, buffer, zeichern);

printf (&quot;%s\n&quot;,buffer);

 }

int main()
{
sleep (5000);    
test(); 
system (&quot;PAUSE&quot;);
return 0;

}
</code></pre>
<p>Nur leider erhalte ich bei den ausgaben immer 0?<br />
Wieso ist das so?<br />
Was ist daran bitte verkehrt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1431904</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1431904</guid><dc:creator><![CDATA[Fokus]]></dc:creator><pubDate>Sun, 06 Jan 2008 16:23:48 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 17:48:11 GMT]]></title><description><![CDATA[<p>Ist echt verdammt wichtig.<br />
Und es weiß wirklich niemand weiter?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1431970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1431970</guid><dc:creator><![CDATA[Fokus]]></dc:creator><pubDate>Sun, 06 Jan 2008 17:48:11 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 18:20:16 GMT]]></title><description><![CDATA[<p>&lt;a href= schrieb:</p>
<blockquote>
<p><a href="http://msdn2.microsoft.com/en-us/library/ms646294(VS.85).aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms646294(VS.85).aspx</a>&quot;&gt;GetFocus returns the window with the keyboard focus for the current thread's message queue. If GetFocus returns NULL, another thread's queue may be attached to a window that has the keyboard focus.</p>
</blockquote>
<p>... Ist das Fenster im selben Thread wie dein Code?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1431989</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1431989</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sun, 06 Jan 2008 18:20:16 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 18:46:30 GMT]]></title><description><![CDATA[<p>Nein.<br />
Ich habe mir das ganze jetzt so Vorgestellt.<br />
Alle Fenster werden aufgelistet und wenn ein Fesnter den Fokus hat dann soll das Ausgegeben werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1432021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1432021</guid><dc:creator><![CDATA[Fokus]]></dc:creator><pubDate>Sun, 06 Jan 2008 18:46:30 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 18:50:21 GMT]]></title><description><![CDATA[<p>Dann müsstest Du die aktive Applikation, das aktive Fenster ermitteln, dann AttachThreadInput auf diesen Thread ausführen, GetFocus machen, AttachThreadInput nicht vergessen für den detach...</p>
<p>Jeder Thread hat eben seine eigene Buchhaltung für den Fokus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1432026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1432026</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Sun, 06 Jan 2008 18:50:21 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 18:57:05 GMT]]></title><description><![CDATA[<p>Das kann ja was werden....<br />
^^<br />
Ich denke das hier ist die richtige Funktion:<br />
<a href="http://msdn2.microsoft.com/en-us/library/ms681956(VS.85).aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms681956(VS.85).aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1432036</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1432036</guid><dc:creator><![CDATA[Fokus]]></dc:creator><pubDate>Sun, 06 Jan 2008 18:57:05 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 19:26:14 GMT]]></title><description><![CDATA[<p>Könnte man das ganze nicht etwas einfacher machen?<br />
Beispielweise das man überprüft welches Fenster im Vordergrund ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1432062</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1432062</guid><dc:creator><![CDATA[Fokus]]></dc:creator><pubDate>Sun, 06 Jan 2008 19:26:14 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 22:03:36 GMT]]></title><description><![CDATA[<p>Meinst du sowas?<br />
<a href="http://msdn2.microsoft.com/en-us/library/ms633505.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms633505.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1432131</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1432131</guid><dc:creator><![CDATA[gosha16]]></dc:creator><pubDate>Sun, 06 Jan 2008 22:03:36 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetFocus on Sun, 06 Jan 2008 22:07:13 GMT]]></title><description><![CDATA[<p>Jop genau das habe ich gesucht.<br />
Danke.<br />
<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=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1432134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1432134</guid><dc:creator><![CDATA[Fokus]]></dc:creator><pubDate>Sun, 06 Jan 2008 22:07:13 GMT</pubDate></item></channel></rss>