<?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[fortlaufende sinuskurve]]></title><description><![CDATA[<p>hallo zusammen,</p>
<p>hab ein riesen problem:</p>
<p>ich muss in edv ein pendel programmieren, das hin und her schwingt und parallel dazu, die aktuelle auslenkung bzw abstand zur 'befestigungsdecke' an hand eines höhe/zeit diagramms aufzeigen.</p>
<p>das pendel hab ich so weit. es schwingt wunderschön mit hilfe eines timers hin und her. nur leider hab ich keine ahnung wie ich die kurve hinbekommen soll.</p>
<p>bin echt ein totales winapigreenhorn.</p>
<p>würd mich über hilfe freuen,<br />
thx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/90647/fortlaufende-sinuskurve</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 06:45:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/90647.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 31 Oct 2004 16:17:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fortlaufende sinuskurve on Sun, 31 Oct 2004 16:17:27 GMT]]></title><description><![CDATA[<p>hallo zusammen,</p>
<p>hab ein riesen problem:</p>
<p>ich muss in edv ein pendel programmieren, das hin und her schwingt und parallel dazu, die aktuelle auslenkung bzw abstand zur 'befestigungsdecke' an hand eines höhe/zeit diagramms aufzeigen.</p>
<p>das pendel hab ich so weit. es schwingt wunderschön mit hilfe eines timers hin und her. nur leider hab ich keine ahnung wie ich die kurve hinbekommen soll.</p>
<p>bin echt ein totales winapigreenhorn.</p>
<p>würd mich über hilfe freuen,<br />
thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/641728</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/641728</guid><dc:creator><![CDATA[pumkin]]></dc:creator><pubDate>Sun, 31 Oct 2004 16:17:27 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Sun, 31 Oct 2004 17:07:35 GMT]]></title><description><![CDATA[<p>Wenn du das Pendel schon hast, dann kannst du doch einfach davon die y-Position als Höhe verwenden, oder was genau ist dein Problem / dein Frage <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/641756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/641756</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sun, 31 Oct 2004 17:07:35 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 01 Nov 2004 07:40:38 GMT]]></title><description><![CDATA[<p>mathematisch ist mir das ganze klar.</p>
<p>ich weiß einfach nicht wie ich es handwerklich mit winapi hinbekommen soll eine fortlaufende sinuskurve zu erhalten. wie gesagt, ich kenn mich damit so gut wie nicht aus ... edv ist ein lästiges anhängsel meines studiums...</p>
<p>über vorschläge würde ich mich sehr freuen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/642008</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642008</guid><dc:creator><![CDATA[pumkin]]></dc:creator><pubDate>Mon, 01 Nov 2004 07:40:38 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 01 Nov 2004 08:02:43 GMT]]></title><description><![CDATA[<p>Geht es dir also eher um die Darstellung, also die Zeitliche Verschiebung in x-Richtung? Also quasi sowas wie ein Schreiber, der die Auslenkung über der Zeit aufzeichnet <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>
]]></description><link>https://www.c-plusplus.net/forum/post/642009</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642009</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 01 Nov 2004 08:02:43 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 01 Nov 2004 08:09:32 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>meinst du sowas hier??</p>
<p>der code ist aber MFC brauchst den einfach nur in API umschreiben <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>
<pre><code class="language-cpp">CWnd *wp; 
    CDC *pDC; 
    CRect Rect; 
    double y,von,bis; 
    int i,width,height; 
    von=-1.2; //scalierung 
    bis=+1.2; 

    wp = GetDlgItem(IDC_STATIC_DIAGRAMM); 
    pDC = wp-&gt;GetDC(); 
    wp-&gt;GetWindowRect(&amp;Rect); 
    width=abs(Rect.TopLeft().x-Rect.BottomRight().x); 
    height=abs(Rect.TopLeft().y-Rect.BottomRight().y); 

    for(i=0;i&lt;width;++i){ 
        double wert=sin(i*3.14/180);    
        if(bis&gt;=wert &amp;&amp; von&lt;=wert){ 
            y=height-(height*(wert-von)/(bis-von)); 
            pDC-&gt;SetPixel(i,(int)y,RGB(255,0,0)); 
	}  
    }
    wp-&gt;ReleaseDC(pDC);
</code></pre>
<p>wen du dich nicht mit MFC auskenst dan schreib nochmal da stelle ich es dir um <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>MfG TaccoGo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/642012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642012</guid><dc:creator><![CDATA[TaccoGo]]></dc:creator><pubDate>Mon, 01 Nov 2004 08:09:32 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 01 Nov 2004 15:40:47 GMT]]></title><description><![CDATA[<p>flenders hat recht: ich suche ein schreiber, der mir eine kurve aufzeichnet und immer wenn eine bestimmte zeit erreicht ist soll die bereits gezeichnete kurve wieder gelöscht werden und am ursprungspunkt der kurve weitergemacht werden.</p>
<p>danke taccogo, leider hab ich von mfc keine ahnung. wäre also nett wenn du es mir umschreiben könntest... das non plus ultra wäre natürlich wenn du mir es unter berücksichtigung meiner obigen wünsche und an beispiels eines timers machen könntest.</p>
<p>besten dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/642340</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642340</guid><dc:creator><![CDATA[pumkin]]></dc:creator><pubDate>Mon, 01 Nov 2004 15:40:47 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 01 Nov 2004 16:35:17 GMT]]></title><description><![CDATA[<p>Also soll dein Schreiber quasi bei x=0 starten und dann von links nach rechts bis z.B. x=100 laufen und wenn er dort ist, das Bild wieder löschen, und wieder bei x=0 anfangen. Oder soll er kontinuierlich durchlaufen - was etwas aufwändiger wäre.</p>
<p>Zur Variante 1 würde ich so vorgehen, dass du ein Backbuffer (CreateCompatibleDC, CreateCompatibleBitmap, SelectObject) in Größe des Schreibers anlegst.<br />
In deinem Timer (hast du ja wohl für das Pendel schon) zählst du jetzt x von 0 bis zur Breite hoch (bei jedem WM_TIMER um eins hochsetzen). Dann setzt du an der Stelle x / y-Pendel mit SetPixel einen Punkt (besser wahrscheinlich mit einer Linie -&gt; evtl. letzten Punkt merken. Dann verannlasst du per InvalidateRect eine WM_PAINT-Message, in der du dann mittels BitBlt den Backbuffer in dein Fenster zeichnest (so wie du es wohl auch beim Pendel schon machst)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/642388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642388</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 01 Nov 2004 16:35:17 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 01 Nov 2004 16:59:49 GMT]]></title><description><![CDATA[<p>genau: muss dann halt bei x=0 mit der amblitude weitermachen die sie am ende hatte ... du hast mich aber glaub schon richtig verstanden.</p>
<p>danke für deine vorschläge. aber wie gesagt: ich habe von winapi keine ahnung. ich hab von unserem prof beispielprogramme einfach kopiert und soweit ich verstanden habe einfach umgeschrieben, dass es ein pendel wird:</p>
<p>BOOL pendeltimer_setzen(HWND hwnd)<br />
{</p>
<p>SetTimer (hwnd, PENDELTIMER, 10, NULL);<br />
return 1;<br />
}</p>
<p>BOOL pendeltimer_loeschen(HWND hwnd)<br />
{<br />
KillTimer (hwnd, PENDELTIMER);<br />
return 1;<br />
}</p>
<p>BOOL pendel (HWND hwnd, double zeit)<br />
{</p>
<p>int hoehe, breite;<br />
int ScreenColor;<br />
double phi_max=0.52359,x_komp,y_komp;</p>
<p>HDC hdc ;<br />
PAINTSTRUCT ps ;<br />
RECT Rect;</p>
<p>InvalidateRect (hwnd, NULL, TRUE) ;<br />
hdc = BeginPaint (hwnd, &amp;ps) ;</p>
<p>SetBkMode(hdc, TRANSPARENT);</p>
<p>GetClientRect (hwnd, &amp;Rect);</p>
<p>hoehe = Rect.bottom;<br />
breite = Rect.right;</p>
<p>ScreenColor = RGB(0, 0, 255);<br />
SelectBrush(hdc, CreateSolidBrush(ScreenColor));</p>
<p>x_komp=(200*sin(phi_max*cos(sqrt(9.81/0.051)*zeit))); y_komp=(200*cos(phi_max*cos(sqrt(9.81/0.051)*zeit)));</p>
<p>Ellipse(hdc, breite/4 - x_komp - 10, hoehe/4 + y_komp - 10, breite/4 -x_komp + 10, hoehe/4 +y_komp + 10);</p>
<p>MoveToEx (hdc, breite/4, hoehe/4, NULL) ; LineTo (hdc, breite/4 - x_komp, hoehe/4 + y_komp) ;<br />
EndPaint (hwnd, &amp;ps) ;</p>
<p>UpdateWindow(hwnd);<br />
return 1;</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/642408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642408</guid><dc:creator><![CDATA[pumkin]]></dc:creator><pubDate>Mon, 01 Nov 2004 16:59:49 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 01 Nov 2004 17:10:27 GMT]]></title><description><![CDATA[<p>pendel wird dann in WM_PAINT aufgerufen?! Was wird bei WM_TIMER gemacht?<br />
Wenn du fertigen Code willst, wäre es geschickt dein bisherigen Rahmen zu haben, sodass es dann auch nachher richtig funktioniert und man sich Arbeit spart <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/642416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642416</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 01 Nov 2004 17:10:27 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Tue, 02 Nov 2004 14:15:56 GMT]]></title><description><![CDATA[<p>hab grad meinen quellcode nicht zur hand da nicht zu hause an meinem rechner bin ...</p>
<p>das ganze funktioniert glaub so:</p>
<p>ich starte mein programm timer, dann gehts in WM_Timer von dort aus wird das pendelprogramm mit einem jeweils neuen wert (zeit + delta t) aufgerufen. und das passiert immer wieder bis ich in das programm timer gehe und der timer gelöscht wird.</p>
<p>ich hoffe ich habs richtig erklärt ....</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/642906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/642906</guid><dc:creator><![CDATA[pumkin]]></dc:creator><pubDate>Tue, 02 Nov 2004 14:15:56 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Fri, 05 Nov 2004 16:24:51 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1644">@flenders</a></p>
<p>würde mich immer noch sehr freuen, wenn du mir helfen könntest.<br />
das ganze bisherige programm habe ich jetzt auch zur verfügung.</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/645584</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/645584</guid><dc:creator><![CDATA[pumkin]]></dc:creator><pubDate>Fri, 05 Nov 2004 16:24:51 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Fri, 05 Nov 2004 17:03:42 GMT]]></title><description><![CDATA[<p>Wenn du den Code irgendwie online stellen kannst, kann ich mir das mal anschauen - hab allerdings wahrscheinlich frühestens Sonntag-Abend wieder Zeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/645623</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/645623</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Fri, 05 Nov 2004 17:03:42 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Sat, 06 Nov 2004 07:58:27 GMT]]></title><description><![CDATA[<p>wie gesagt,... ich komm echt nicht mehr weiter ... hab schon alles ausprobiert, gesucht und gelesen.</p>
<p>hier der code (zwar goddes viel aber was solls):</p>
<pre><code>/*@@ Wedit generated application. Written Sat Oct 30 22:12:40 2004
 @@header: c:\programme\lcc\projects\pendel_1\pendel_1res.h
 @@resources: c:\programme\lcc\projects\pendel_1\pendel_1.rc
 Do not edit outside the indicated areas */
/*&lt;----------------------------------------------------------------------&gt;*/
/*&lt;----------------------------------------------------------------------&gt;*/
#include &lt;windows.h&gt;
#include &lt;windowsx.h&gt;
#include &lt;commctrl.h&gt;
#include &lt;string.h&gt;
#include &quot;pendel_1res.h&quot;
#include &lt;math.h&gt;									//wird zur trig. berechnung benoetigt

//BOOL pendelfaden (HWND hwnd, double zeit);
BOOL pendeltimer_setzen(HWND hwnd);
BOOL pendeltimer_loeschen(HWND hwnd);
BOOL pendel (HWND hwnd, double zeit);

/*&lt;----------------------------------------------------------------------&gt;*/
HINSTANCE hInst;		// Instance handle
HWND hwndMain;		//Main window handle

LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
/* --- The following code comes from C:\Programme\lcc\lib\wizard\statbar.tpl. */

// Global Variables for the status bar control.

HWND  hWndStatusbar;

/*------------------------------------------------------------------------
 Procedure:     UpdateStatusBar ID:1
 Purpose:       Updates the statusbar control with the appropiate
                text
 Input:         lpszStatusString: Charactar string that will be shown
                partNumber: index of the status bar part number.
                displayFlags: Decoration flags
 Output:        none
 Errors:        none

------------------------------------------------------------------------*/
void UpdateStatusBar(LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)
{
    SendMessage(hWndStatusbar,
                SB_SETTEXT,
                partNumber | displayFlags,
                (LPARAM)lpszStatusString);
}

/*------------------------------------------------------------------------
 Procedure:     MsgMenuSelect ID:1
 Purpose:       Shows in the status bar a descriptive explaation of
                the purpose of each menu item.The message
                WM_MENUSELECT is sent when the user starts browsing
                the menu for each menu item where the mouse passes.
 Input:         Standard windows.
 Output:        The string from the resources string table is shown
 Errors:        If the string is not found nothing will be shown.
------------------------------------------------------------------------*/
LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
    static char szBuffer[256];
    UINT   nStringID = 0;
    UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) &amp; 0xffff;
    UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
    HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);

    szBuffer[0] = 0;                            // First reset the buffer
    if (fuFlags == 0xffff &amp;&amp; hMenu == NULL)     // Menu has been closed
        nStringID = 0;

    else if (fuFlags &amp; MFT_SEPARATOR)           // Ignore separators
        nStringID = 0;

    else if (fuFlags &amp; MF_POPUP)                // Popup menu
    {
        if (fuFlags &amp; MF_SYSMENU)               // System menu
            nStringID = IDS_SYSMENU;
        else
            // Get string ID for popup menu from idPopup array.
            nStringID = 0;
    }  // for MF_POPUP
    else                                        // Must be a command item
        nStringID = uCmd;                       // String ID == Command ID

    // Load the string if we have an ID
    if (0 != nStringID)
        LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
    // Finally... send the string to the status bar
    UpdateStatusBar(szBuffer, 0, 0);
    return 0;
}

/*------------------------------------------------------------------------
 Procedure:     InitializeStatusBar ID:1
 Purpose:       Initialize the status bar
 Input:         hwndParent: the parent window
                nrOfParts: The status bar can contain more than one
                part. What is difficult, is to figure out how this
                should be drawn. So, for the time being only one is
                being used...
 Output:        The status bar is created
 Errors:
------------------------------------------------------------------------*/
void InitializeStatusBar(HWND hwndParent,int nrOfParts)
{
    const int cSpaceInBetween = 8;
    int   ptArray[40];   // Array defining the number of parts/sections
    RECT  rect;
    HDC   hDC;

   /* * Fill in the ptArray...  */

    hDC = GetDC(hwndParent);
    GetClientRect(hwndParent, &amp;rect);

    ptArray[nrOfParts-1] = rect.right;
    //---TODO--- Add code to calculate the size of each part of the status
    // bar here.

    ReleaseDC(hwndParent, hDC);
    SendMessage(hWndStatusbar,
                SB_SETPARTS,
                nrOfParts,
                (LPARAM)(LPINT)ptArray);

    UpdateStatusBar(&quot;Ready&quot;, 0, 0);
    //---TODO--- Add code to update all fields of the status bar here.
    // As an example, look at the calls commented out below.

//    UpdateStatusBar(&quot;Cursor Pos:&quot;, 1, SBT_POPOUT);
//    UpdateStatusBar(&quot;Time:&quot;, 3, SBT_POPOUT);
}

/*------------------------------------------------------------------------
 Procedure:     CreateSBar ID:1
 Purpose:       Calls CreateStatusWindow to create the status bar
 Input:         hwndParent: the parent window
                initial text: the initial contents of the status bar
 Output:
 Errors:
------------------------------------------------------------------------*/
static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
{
    hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
                                       initialText,
                                       hwndParent,
                                       IDM_STATUSBAR);
    if(hWndStatusbar)
    {
        InitializeStatusBar(hwndParent,nrOfParts);
        return TRUE;
    }

    return FALSE;
}

/*&lt;----------------------------------------------------------------------&gt;*/
/*@@0-&gt;@@*/
static BOOL InitApplication(void)
{
	WNDCLASS wc;

	memset(&amp;wc,0,sizeof(WNDCLASS));
	wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;
	wc.lpfnWndProc = (WNDPROC)MainWndProc;
	wc.hInstance = hInst;
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszClassName = &quot;pendel_1WndClass&quot;;
	wc.lpszMenuName = MAKEINTRESOURCE(IDMAINMENU);
	wc.hCursor = LoadCursor(NULL,IDC_ARROW);
	wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
	if (!RegisterClass(&amp;wc))
		return 0;
/*@@0&lt;-@@*/
	// ---TODO--- Call module specific initialization routines here

	return 1;
}

/*&lt;----------------------------------------------------------------------&gt;*/
/*@@1-&gt;@@*/
HWND Creatependel_1WndClassWnd(void)
{
	return CreateWindow(&quot;pendel_1WndClass&quot;,&quot;pendel_1&quot;,
		WS_MINIMIZEBOX|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZEBOX|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_THICKFRAME,
		CW_USEDEFAULT,0,CW_USEDEFAULT,0,
		NULL,
		NULL,
		hInst,
		NULL);
}
/*@@1&lt;-@@*/
/*&lt;----------------------------------------------------------------------&gt;*/
/* --- The following code comes from C:\Programme\lcc\lib\wizard\defOnCmd.tpl. */
void MainWndProc_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	switch(id) {
		// ---TODO--- Add new menu commands here
		/*@@NEWCOMMANDS@@*/
		case IDM_EXIT:
		PostMessage(hwnd,WM_CLOSE,0,0);
		break;

		case IDM_PENDELTIMER_SETZEN:						//springt in pendeltimer setzen
			pendeltimer_setzen(hwnd);
		break;

		case IDM_PENDELTIMER_LOESCHEN:						//springt in pendeltimer loeschen
			pendeltimer_loeschen(hwnd);
		break;
	}
}

/*&lt;----------------------------------------------------------------------&gt;*/
/*@@2-&gt;@@*/
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{

	static double delta_t=0.001;							//zeitschritte
	static double zeit=0.0;									//vergangene zeit

	switch (msg) {
/*@@3-&gt;@@*/
	case WM_SIZE:
		SendMessage(hWndStatusbar,msg,wParam,lParam);
		InitializeStatusBar(hWndStatusbar,1);
		break;
	case WM_MENUSELECT:
		return MsgMenuSelect(hwnd,msg,wParam,lParam);
	case WM_COMMAND:
		HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
		case WM_TIMER:
		switch (wParam)
		{
			case PENDELTIMER:								//pendeltimer meldet sich
				//pendelfaden (hwnd, zeit=zeit + delta_t);	//springt in pendelfaden mit veraenderter zeit
				pendel (hwnd, zeit=zeit + delta_t);
			break;
        }
	default:
		return DefWindowProc(hwnd,msg,wParam,lParam);
	}
/*@@3&lt;-@@*/
	return 0;
}
/*@@2&lt;-@@*/

/*&lt;----------------------------------------------------------------------&gt;*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
	MSG msg;
	HANDLE hAccelTable;

	hInst = hInstance;
	if (!InitApplication())
		return 0;
	hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
	if ((hwndMain = Creatependel_1WndClassWnd()) == (HWND)0)
		return 0;
	CreateSBar(hwndMain,&quot;Ready&quot;,1);
	ShowWindow(hwndMain,SW_SHOW);
	while (GetMessage(&amp;msg,NULL,0,0)) {
		if (!TranslateAccelerator(msg.hwnd,hAccelTable,&amp;msg)) {
			TranslateMessage(&amp;msg);
			DispatchMessage(&amp;msg);
		}
	}
	return msg.wParam;
}

BOOL pendeltimer_setzen(HWND hwnd)
{

	SetTimer (hwnd, PENDELTIMER, 10, NULL);  					// timer setzt alle 10ms ein
	return 1;
}

BOOL pendeltimer_loeschen(HWND hwnd)
{
	KillTimer (hwnd, PENDELTIMER);
	return 1;
}

BOOL pendel (HWND hwnd, double zeit)
{

    int hoehe, breite;
	int ScreenColor;
	double phi_max=0.52359,x_komp,y_komp;						// phi_max = maximaler auslenkwinkel
																// verschiebung des pendelendes zu aufhaengepunkt

	HDC hdc ;
	PAINTSTRUCT  ps ;
	RECT Rect;

	InvalidateRect (hwnd, NULL, TRUE) ;
	hdc = BeginPaint (hwnd, &amp;ps) ;

	SetBkMode(hdc, TRANSPARENT); // Hintergrund setzen ... muss undurchsichtig werden

	GetClientRect (hwnd, &amp;Rect);

	hoehe  = Rect.bottom;
	breite = Rect.right;

    ScreenColor = RGB(0, 0, 255);
    SelectBrush(hdc, CreateSolidBrush(ScreenColor));

	x_komp=(200*sin(phi_max*cos(sqrt(9.81/0.051)*zeit)));		//200 = radius vom pendel
	y_komp=(200*cos(phi_max*cos(sqrt(9.81/0.051)*zeit)));		//sqrt(9.81/0.51) = g/pendellänge real = konst. der diff. glg

    Ellipse(hdc,  breite/4 - x_komp - 10, hoehe/4 + y_komp - 10, breite/4 - x_komp + 10, hoehe/4 +y_komp + 10);   // zeichnet kugel
	                            // x-links, y-oben, x-rechts, y-unten

	MoveToEx (hdc, breite/4,      hoehe/4, NULL) ;  			// setzt pendelaufhaengung
    LineTo   (hdc, breite/4 - x_komp, 	  hoehe/4 + y_komp) ;  	// Zeichnet die Linie zu errechneten Koordinaten

	EndPaint (hwnd, &amp;ps) ;

	UpdateWindow(hwnd);
	return 1;

}
</code></pre>
<p>dankeschön</p>
]]></description><link>https://www.c-plusplus.net/forum/post/645907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/645907</guid><dc:creator><![CDATA[pumkin]]></dc:creator><pubDate>Sat, 06 Nov 2004 07:58:27 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Mon, 08 Nov 2004 22:26:07 GMT]]></title><description><![CDATA[<p>Sieht aus, als ob das immer noch nicht alles ist - den Code für pendel_1res.h hab ich z.B. nicht gefunden.</p>
<p>Aber den Code sieht eh schon nicht ganz richtig aus - z.B. darfst du Begin-/EndPaint nur in WM_PAINT aufrufen (wo eigentlich auch alle Zeichenoperationen für das Fenster durchgeführt werden sollten). Deswegen denke ich solltest du dich erstmal ganz allgemein etwas belesen und dir ein paar Tutorials anschauen (später dann auch zu BackBuffering). Dir jetzt irgendeinen Code hinzuklatschen halte ich absolut nicht für sinnvoll, und habe derzeit auch nicht die Zeit dazu.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/647819</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/647819</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 08 Nov 2004 22:26:07 GMT</pubDate></item><item><title><![CDATA[Reply to fortlaufende sinuskurve on Tue, 09 Nov 2004 00:37:26 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6713">@TaccoGo</a><br />
hätte ich gewusst das dir der Code gefällt hätte ich vorher ein Patent drauf angemeldet <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/647859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/647859</guid><dc:creator><![CDATA[Windalf]]></dc:creator><pubDate>Tue, 09 Nov 2004 00:37:26 GMT</pubDate></item></channel></rss>