<?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[kurze frage (enter abfangen)]]></title><description><![CDATA[<p>wie muss die callback-funktion für eine (&quot;modale&quot;?) dialogbox aussehn, wenn ich das drücken der taste enter abfangen will?</p>
<p>das geht NICHT: (//gekürtz)</p>
<pre><code class="language-cpp">LRESULT CALLBACK DialogCallbackProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
		case WM_INITDIALOG:
		{
			//...
			return true;
		}

		case WM_COMMAND:
		{
			switch(wParam)
			{
				case 1001://&quot;GO&quot;
				{
					//GO!
					return true;
				}

				case IDCANCEL:
				{
					EndDialog(hDlg, true);
					return true;
				}

				default: return false;
			}
		}

		case WM_KEYDOWN:
		{
			MessageBox(NULL, &quot;joh1&quot;, &quot;joh1&quot;, MB_OK);//&lt;--kommt nie
			TranslateMessage((MSG*)&amp;uMsg);
			return true;
		}

		case WM_CHAR:
		{
			MessageBox(NULL, &quot;joh&quot;, &quot;joh&quot;, MB_OK);//&lt;--kommt auch nie
			if(wParam==VK_RETURN)
			{
				//GO!
				return true;
			}
		}
	}
	return false;
}
</code></pre>
<p>was mach ich falsch?</p>
<p>ahja, vllt noch die dialog-box, wenn das jemandem weiterhilft mir zu helfen <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>
<pre><code>GetIpFromHostname_Dialog DIALOGEX 300, 300, 254, 132
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_NOIDLEMSG | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION &quot;Get IP from hostname&quot;
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, &quot;Verdana&quot;
{
   CONTROL 42, 42, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 7, 11, 18, 20
   CONTROL &quot;Hostname:&quot;, 0, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 32, 17, 36, 10
   CONTROL &quot;&quot;, 5001, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 73, 14, 143, 14
   CONTROL &quot;GO&quot;, 1001, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 223, 14, 21, 14
   CONTROL &quot;&quot;, 5002, EDIT, ES_LEFT | ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 8, 36, 236, 87
}
</code></pre>
<p>lw</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/103533/kurze-frage-enter-abfangen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 16:56:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/103533.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Mar 2005 16:32:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 16:43:40 GMT]]></title><description><![CDATA[<p>wie muss die callback-funktion für eine (&quot;modale&quot;?) dialogbox aussehn, wenn ich das drücken der taste enter abfangen will?</p>
<p>das geht NICHT: (//gekürtz)</p>
<pre><code class="language-cpp">LRESULT CALLBACK DialogCallbackProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
		case WM_INITDIALOG:
		{
			//...
			return true;
		}

		case WM_COMMAND:
		{
			switch(wParam)
			{
				case 1001://&quot;GO&quot;
				{
					//GO!
					return true;
				}

				case IDCANCEL:
				{
					EndDialog(hDlg, true);
					return true;
				}

				default: return false;
			}
		}

		case WM_KEYDOWN:
		{
			MessageBox(NULL, &quot;joh1&quot;, &quot;joh1&quot;, MB_OK);//&lt;--kommt nie
			TranslateMessage((MSG*)&amp;uMsg);
			return true;
		}

		case WM_CHAR:
		{
			MessageBox(NULL, &quot;joh&quot;, &quot;joh&quot;, MB_OK);//&lt;--kommt auch nie
			if(wParam==VK_RETURN)
			{
				//GO!
				return true;
			}
		}
	}
	return false;
}
</code></pre>
<p>was mach ich falsch?</p>
<p>ahja, vllt noch die dialog-box, wenn das jemandem weiterhilft mir zu helfen <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>
<pre><code>GetIpFromHostname_Dialog DIALOGEX 300, 300, 254, 132
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_NOIDLEMSG | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION &quot;Get IP from hostname&quot;
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, &quot;Verdana&quot;
{
   CONTROL 42, 42, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 7, 11, 18, 20
   CONTROL &quot;Hostname:&quot;, 0, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 32, 17, 36, 10
   CONTROL &quot;&quot;, 5001, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 73, 14, 143, 14
   CONTROL &quot;GO&quot;, 1001, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 223, 14, 21, 14
   CONTROL &quot;&quot;, 5002, EDIT, ES_LEFT | ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 8, 36, 236, 87
}
</code></pre>
<p>lw</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741438</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741438</guid><dc:creator><![CDATA[Lawilog]]></dc:creator><pubDate>Wed, 09 Mar 2005 16:43:40 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 16:47:10 GMT]]></title><description><![CDATA[<p>gib dem go-button die IDOK statt 1001.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741453</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741453</guid><dc:creator><![CDATA[enter.]]></dc:creator><pubDate>Wed, 09 Mar 2005 16:47:10 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 16:48:18 GMT]]></title><description><![CDATA[<blockquote>
<p>TranslateMessage((MSG*)&amp;uMsg);</p>
</blockquote>
<p>Meld dich mal bei The Daily WTF. <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/741457</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741457</guid><dc:creator><![CDATA[WTF!!]]></dc:creator><pubDate>Wed, 09 Mar 2005 16:48:18 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 16:48:27 GMT]]></title><description><![CDATA[<p>Es wird wahrscheinlich nicht gehen, weil du weitere Komponenten auf deiner Dialogbox hast. Die WM_KEYDOWN Nachricht wird dann an eine dieser geschickt.</p>
<p>Loesen kann man das meines Wissens auf 2 Arten: Entweder man erzeugt eine neue Callback Funktion für das Steuerelement, bei welchem das Ereignis abgefangen werden soll (bsp.: <a href="http://www.winapi.net/index.php?inhalt=s27" rel="nofollow">http://www.winapi.net/index.php?inhalt=s27</a> )oder man arbeitet mit einem Keyboard Hook.<br />
Gruss,<br />
DeSoVoDaMu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741458</guid><dc:creator><![CDATA[DeSoVoDaMu]]></dc:creator><pubDate>Wed, 09 Mar 2005 16:48:27 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 16:50:22 GMT]]></title><description><![CDATA[<p><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/isdialogmessage.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/isdialogmessage.asp</a><br />
+ forensuche sollte dir helfen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741460</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741460</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 09 Mar 2005 16:50:22 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 16:54:33 GMT]]></title><description><![CDATA[<p>Die Dialog Prozedur hat den Rückgabetyp INT_PTR. Und benutze TRUE und FALSE statt true und false.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741466</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741466</guid><dc:creator><![CDATA[zusatztipp]]></dc:creator><pubDate>Wed, 09 Mar 2005 16:54:33 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 17:13:41 GMT]]></title><description><![CDATA[<p>WTF!! schrieb:</p>
<blockquote>
<blockquote>
<p>TranslateMessage((MSG*)&amp;uMsg);</p>
</blockquote>
<p>Meld dich mal bei The Daily WTF. <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>
</blockquote>
<p>TranslateMessage Function -&gt; &quot;WM_KEYDOWN and WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message.&quot;<br />
&quot;Windows 2000/XP: Applications must pass&quot; wParam to TranslateMessage without altering it at all.&quot;<br />
hmmmm ok, wParam. aber sonst gehts mir eigentlich schon noch ganz gut...</p>
<blockquote>
<p>gib dem go-button die IDOK statt 1001.</p>
</blockquote>
<p>und der &quot;go&quot;-button funktioniert ja, nur eben enter nicht.</p>
<blockquote>
<p>Es wird wahrscheinlich nicht gehen, weil du weitere Komponenten auf deiner Dialogbox hast. Die WM_KEYDOWN Nachricht wird dann an eine dieser geschickt.</p>
</blockquote>
<p>klingt einleuchtend. aufn Keyboard Hook hab ich jetzt eigentlich keine lust, aber ne neue Callback Funktion werd ich ma testen...</p>
<p>und was soll ich mit IsDialogMessage() ?</p>
<blockquote>
<p>TRUE und FALSE</p>
</blockquote>
<p>halt ich für ne unart...aber ma gucken</p>
<p>lw</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741478</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741478</guid><dc:creator><![CDATA[Lawilog]]></dc:creator><pubDate>Wed, 09 Mar 2005 17:13:41 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 17:16:58 GMT]]></title><description><![CDATA[<p>Lawilog schrieb:</p>
<blockquote>
<blockquote>
<p>Es wird wahrscheinlich nicht gehen, weil du weitere Komponenten auf deiner Dialogbox hast. Die WM_KEYDOWN Nachricht wird dann an eine dieser geschickt.</p>
</blockquote>
<p>klingt einleuchtend. aufn Keyboard Hook hab ich jetzt eigentlich keine lust, aber ne neue Callback Funktion werd ich ma testen...</p>
</blockquote>
<p>nen hook ist total überzogen</p>
<p>Lawilog schrieb:</p>
<blockquote>
<p>und was soll ich mit IsDialogMessage() ?</p>
</blockquote>
<p>na lesen</p>
<p>msdn schrieb:</p>
<blockquote>
<p>IsDialogMessage sends WM_GETDLGCODE messages to the dialog box procedure to determine which keys should be processed.</p>
</blockquote>
<p>und dann wirst du hierrauf stossen<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxmessages/wm_getdlgcode.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxmessages/wm_getdlgcode.asp</a><br />
und <strong>forensuche</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/post/741485</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741485</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 09 Mar 2005 17:16:58 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 17:50:55 GMT]]></title><description><![CDATA[<p>Lawilog schrieb:</p>
<blockquote>
<p>WTF!! schrieb:</p>
<blockquote>
<blockquote>
<p>TranslateMessage((MSG*)&amp;uMsg);</p>
</blockquote>
<p>Meld dich mal bei The Daily WTF. <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>
</blockquote>
<p>TranslateMessage Function -&gt; &quot;WM_KEYDOWN and WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message.&quot;<br />
&quot;Windows 2000/XP: Applications must pass&quot; wParam to TranslateMessage without altering it at all.&quot;<br />
hmmmm ok, wParam. aber sonst gehts mir eigentlich schon noch ganz gut...</p>
</blockquote>
<p>Du hast ja wirklich überhaupt keine Ahnung. TranslateMessage kommt in die Message-Loop und sonst nirgendwo anders hin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741512</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741512</guid><dc:creator><![CDATA[WTF!!]]></dc:creator><pubDate>Wed, 09 Mar 2005 17:50:55 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 17:52:04 GMT]]></title><description><![CDATA[<p>IsDialogMessage kannst du nur bei nicht-modalen Dialogen nutzen. In modalen Dialogen wird die schon für dich aufgerufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741514</guid><dc:creator><![CDATA[WTF!!]]></dc:creator><pubDate>Wed, 09 Mar 2005 17:52:04 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 17:59:31 GMT]]></title><description><![CDATA[<p>willst du das Enter den go-button auslöst? dann war meine antwort schon richtig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741524</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741524</guid><dc:creator><![CDATA[enter.]]></dc:creator><pubDate>Wed, 09 Mar 2005 17:59:31 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 18:07:02 GMT]]></title><description><![CDATA[<p>enter. schrieb:</p>
<blockquote>
<p>willst du das Enter den go-button auslöst? dann war meine antwort schon richtig.</p>
</blockquote>
<p>nich direkt, das drücken von enter im edit-feld soll die gleiche funktion aufrufen wie das drücken des &quot;GO&quot; buttons...</p>
<p>lw</p>
<p>PS: immer diese besserwisser hier...is ja schlimm</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741531</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741531</guid><dc:creator><![CDATA[Lawilog]]></dc:creator><pubDate>Wed, 09 Mar 2005 18:07:02 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 18:14:31 GMT]]></title><description><![CDATA[<p>jo, dann nimm IDOK für den button und es sollte automatisch funktionieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741538</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741538</guid><dc:creator><![CDATA[enter.]]></dc:creator><pubDate>Wed, 09 Mar 2005 18:14:31 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 19:35:15 GMT]]></title><description><![CDATA[<p>ich höre in zukunft immer gleich auf das erste posting... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
<p>mit IDOK anstelle von 1001 gehts (zu einfach um wahr zu sein...)</p>
<p>mit callback müsstes aber auch geh<br />
LRESULT CALLBACK EditWndProc(...){...return DefWindowProc(...);}<br />
case WM_INITDIALOG: {...SetWindowLongPtr(GetDlgItem(hDialogWindow, 5001), GWLP_WNDPROC, (LONG_PTR)EditWndProc);...}</p>
<p>naja. so gehts auch <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>
<p>lw</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741612</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741612</guid><dc:creator><![CDATA[Lawilog]]></dc:creator><pubDate>Wed, 09 Mar 2005 19:35:15 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 19:45:53 GMT]]></title><description><![CDATA[<p>Ich glaub du hättest dem &quot;go&quot;-Button auch den Style BS_DEFPUSHBUTTON geben können, der wird nämlich immer &quot;gedrückt&quot;, wenn man Enter in nem Dialog drückt, bin mir da aber nicht 100% sicher, irgendsowas gab es aber.</p>
<p>Hier stehts auch in der MSDN:</p>
<pre><code>[b]ES_WANTRETURN[/b] 
Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box.
If you do not specify this style, [u]pressing the ENTER key has the same effect as pressing the dialog box's default push button[/u]. This style has
no effect on a single-line edit control.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/741618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741618</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Wed, 09 Mar 2005 19:45:53 GMT</pubDate></item><item><title><![CDATA[Reply to kurze frage (enter abfangen) on Wed, 09 Mar 2005 19:44:15 GMT]]></title><description><![CDATA[<p><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="🙂"
    /><br />
du kannst es auch bei 1001 lassen, müsstest dann aber einmal die nachricht DM_SETDEFID benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/741626</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/741626</guid><dc:creator><![CDATA[enter.]]></dc:creator><pubDate>Wed, 09 Mar 2005 19:44:15 GMT</pubDate></item></channel></rss>