<?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[Taschenrechner]]></title><description><![CDATA[<p>Hallo!<br />
Ich will mir in C einen grafischen Taschenrechner programmieren. Das Fenstergerüst mit Buttons und Editfeldern hab ich schon. Ich will zwei Zahlen in zwei Editfelder eingeben und wenn ich dann auf den entsprechenden Button drücke soll das Ergebnis in einem dritten Editfeld stehen.<br />
Ich weiss aber nicht wie ich eine Zahl aus dem Editfeld lesen kann. Die Tuts die ich mit google gefunden habe beschreiben nur wie man ein Zeichen aus dem Feld liest.<br />
Hat jemand eine Idee wie ich das hinkriegen könnte?</p>
<p>hier das Programm:</p>
<p>#include &lt;windows.h&gt;</p>
<p>LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);</p>
<p>int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPreInstance, LPSTR nCmdLine, int nCmdShow)<br />
{</p>
<p>HWND hwnd;<br />
WNDCLASS wcl;<br />
MSG msg;<br />
char szName[] = &quot;Fensterklasse&quot;;<br />
HBRUSH MyBrush = CreateSolidBrush ( RGB (50, 0, 150) );</p>
<p>wcl.cbClsExtra = 0;<br />
wcl.cbWndExtra = 0;<br />
wcl.hbrBackground = MyBrush;<br />
wcl.hCursor = 0;<br />
wcl.hIcon = LoadIcon (NULL, IDI_APPLICATION);<br />
wcl.hInstance = hInstance;<br />
wcl.lpfnWndProc = WndProc;<br />
wcl.lpszClassName = szName;<br />
wcl.lpszMenuName = NULL;<br />
wcl.style = 0;</p>
<p>RegisterClass (&amp;wcl);</p>
<p>hwnd = CreateWindow (szName, &quot;Lagekorrektur&quot;, WS_OVERLAPPEDWINDOW, 300, 100, 600, 600,<br />
NULL, NULL, hInstance, NULL);</p>
<p>ShowWindow (hwnd, nCmdShow);<br />
UpdateWindow (hwnd);</p>
<p>while (GetMessage (&amp;msg, NULL, 0, 0))<br />
{<br />
TranslateMessage (&amp;msg);<br />
DispatchMessage (&amp;msg);<br />
}</p>
<p>return msg.wParam;<br />
}</p>
<p>LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{</p>
<p>static HWND hwndButton1;<br />
static HWND hwndButton2;<br />
static HWND hwndButton3;<br />
static HWND hwndedit1;<br />
static HWND hwndedit2;<br />
static HWND hwndedit3;</p>
<p>switch (message)<br />
{</p>
<p>case WM_CREATE:</p>
<p>hwndButton1 = CreateWindow ( &quot;button&quot;, &quot;+&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,<br />
100, 200, 250, 40, hwnd, (HMENU)1,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndButton2 = CreateWindow ( &quot;button&quot;, &quot;-&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,<br />
100, 250, 250, 40, hwnd, (HMENU)2,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndButton3 = CreateWindow ( &quot;button&quot;, &quot;*&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,<br />
100, 300, 250, 40, hwnd, (HMENU)3,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndedit1 = CreateWindow ( &quot;edit&quot;, &quot; Zahl1&quot;, WS_CHILD | WS_VISIBLE,<br />
150, 100, 100, 30, hwnd, (HMENU)5,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndedit2 = CreateWindow ( &quot;edit&quot;, &quot; Zahl2&quot;, WS_CHILD | WS_VISIBLE,<br />
350, 100, 100, 30, hwnd, (HMENU)6,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndedit3 = CreateWindow ( &quot;edit&quot;, &quot;Ergebnis&quot;, WS_CHILD | WS_VISIBLE,<br />
230, 500, 150, 40, hwnd, (HMENU)7,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>return 0;</p>
<p>case WM_COMMAND:</p>
<p>return 0;</p>
<p>case WM_DESTROY:<br />
PostQuitMessage (0);<br />
return 0;<br />
}<br />
return DefWindowProc (hwnd, message, wParam, lParam);</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/161804/taschenrechner</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 07:46:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/161804.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Oct 2006 09:36:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Taschenrechner on Wed, 11 Oct 2006 09:36:33 GMT]]></title><description><![CDATA[<p>Hallo!<br />
Ich will mir in C einen grafischen Taschenrechner programmieren. Das Fenstergerüst mit Buttons und Editfeldern hab ich schon. Ich will zwei Zahlen in zwei Editfelder eingeben und wenn ich dann auf den entsprechenden Button drücke soll das Ergebnis in einem dritten Editfeld stehen.<br />
Ich weiss aber nicht wie ich eine Zahl aus dem Editfeld lesen kann. Die Tuts die ich mit google gefunden habe beschreiben nur wie man ein Zeichen aus dem Feld liest.<br />
Hat jemand eine Idee wie ich das hinkriegen könnte?</p>
<p>hier das Programm:</p>
<p>#include &lt;windows.h&gt;</p>
<p>LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);</p>
<p>int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPreInstance, LPSTR nCmdLine, int nCmdShow)<br />
{</p>
<p>HWND hwnd;<br />
WNDCLASS wcl;<br />
MSG msg;<br />
char szName[] = &quot;Fensterklasse&quot;;<br />
HBRUSH MyBrush = CreateSolidBrush ( RGB (50, 0, 150) );</p>
<p>wcl.cbClsExtra = 0;<br />
wcl.cbWndExtra = 0;<br />
wcl.hbrBackground = MyBrush;<br />
wcl.hCursor = 0;<br />
wcl.hIcon = LoadIcon (NULL, IDI_APPLICATION);<br />
wcl.hInstance = hInstance;<br />
wcl.lpfnWndProc = WndProc;<br />
wcl.lpszClassName = szName;<br />
wcl.lpszMenuName = NULL;<br />
wcl.style = 0;</p>
<p>RegisterClass (&amp;wcl);</p>
<p>hwnd = CreateWindow (szName, &quot;Lagekorrektur&quot;, WS_OVERLAPPEDWINDOW, 300, 100, 600, 600,<br />
NULL, NULL, hInstance, NULL);</p>
<p>ShowWindow (hwnd, nCmdShow);<br />
UpdateWindow (hwnd);</p>
<p>while (GetMessage (&amp;msg, NULL, 0, 0))<br />
{<br />
TranslateMessage (&amp;msg);<br />
DispatchMessage (&amp;msg);<br />
}</p>
<p>return msg.wParam;<br />
}</p>
<p>LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{</p>
<p>static HWND hwndButton1;<br />
static HWND hwndButton2;<br />
static HWND hwndButton3;<br />
static HWND hwndedit1;<br />
static HWND hwndedit2;<br />
static HWND hwndedit3;</p>
<p>switch (message)<br />
{</p>
<p>case WM_CREATE:</p>
<p>hwndButton1 = CreateWindow ( &quot;button&quot;, &quot;+&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,<br />
100, 200, 250, 40, hwnd, (HMENU)1,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndButton2 = CreateWindow ( &quot;button&quot;, &quot;-&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,<br />
100, 250, 250, 40, hwnd, (HMENU)2,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndButton3 = CreateWindow ( &quot;button&quot;, &quot;*&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,<br />
100, 300, 250, 40, hwnd, (HMENU)3,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndedit1 = CreateWindow ( &quot;edit&quot;, &quot; Zahl1&quot;, WS_CHILD | WS_VISIBLE,<br />
150, 100, 100, 30, hwnd, (HMENU)5,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndedit2 = CreateWindow ( &quot;edit&quot;, &quot; Zahl2&quot;, WS_CHILD | WS_VISIBLE,<br />
350, 100, 100, 30, hwnd, (HMENU)6,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>hwndedit3 = CreateWindow ( &quot;edit&quot;, &quot;Ergebnis&quot;, WS_CHILD | WS_VISIBLE,<br />
230, 500, 150, 40, hwnd, (HMENU)7,<br />
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);</p>
<p>return 0;</p>
<p>case WM_COMMAND:</p>
<p>return 0;</p>
<p>case WM_DESTROY:<br />
PostQuitMessage (0);<br />
return 0;<br />
}<br />
return DefWindowProc (hwnd, message, wParam, lParam);</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1152761</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1152761</guid><dc:creator><![CDATA[wydadi001]]></dc:creator><pubDate>Wed, 11 Oct 2006 09:36:33 GMT</pubDate></item><item><title><![CDATA[Reply to Taschenrechner on Wed, 11 Oct 2006 13:22:28 GMT]]></title><description><![CDATA[<p>Du musst den Text auslesen und dann in eine Zahl umwandeln, z.B.: mit atof, atoi, _atoi64, atol oder mit std::stringstream's. Alternativ kannst du auch GetDlgItemInt benutzen. Informationen zu den Funktionen bzw. Klassen findest du z.B. in der MSDN.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1152913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1152913</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 11 Oct 2006 13:22:28 GMT</pubDate></item><item><title><![CDATA[Reply to Taschenrechner on Wed, 11 Oct 2006 14:11:51 GMT]]></title><description><![CDATA[<p>hi!<br />
ich kann aber nur ziffern eingeben wenn ich das will das will ist nicht wirklich das problem. ich hab die Befehle hier noch dazu geschrieben :<br />
--------------------------------------------------------------------------<br />
case WM_COMMAND:<br />
switch(LOWORD(wParam))<br />
{<br />
case 1:<br />
SetWindowText(hwndedit1,&quot;&quot;);<br />
SendMessage(hwndedit1, EM_SETREADONLY, TRUE, 0);<br />
break;<br />
case 2:<br />
SendMessage(hwndedit1, EM_SETREADONLY, FALSE, 0);<br />
break;</p>
<p>}<br />
return 0;<br />
---------------------------------------------------------------------------<br />
ich will nur wissen wo verschwinden jetzt die ziffern die ich in meinem Editfeld schreibe und auf dem ersten button drucke? gibt´s ein bestimmte speicherplatz dafür oder das bestimmt man selber?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1152945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1152945</guid><dc:creator><![CDATA[wydadi001]]></dc:creator><pubDate>Wed, 11 Oct 2006 14:11:51 GMT</pubDate></item></channel></rss>