<?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[CALLBACK Problem]]></title><description><![CDATA[<p>Beim Einrichten einer AudioEngine habe ich eine Callback-Klasse erzeugt, die merkwürdigerweise beim Stop der Dll eine Meldung des just in time debuggers erzeugt.</p>
<p>Die Klasse sieht so aus:</p>
<pre><code>class XTimer
{
public:
	XTimer()
		{
		};

	~XTimer()
		{
		};

	CreateMyTime();
	CreateMyTime(UINT MyDelay, int typ, LPTIMECALLBACK input);

	UINT Delay;						// Verzögerung
	DWORD Resolution;				// Auflösung in Millisekunden
	LPTIMECALLBACK Funktion;		// Pointer auf die aufzurufende Funktion
	DWORD		   UserDaten;       // Daten die an die aufrufende Funktion
									// zurückgegeben werden
	UINT		   Timertyp; 		// TIME_ONESHOT, TIME_PERIODIC

	int testwert;

	/////////////////////// Methoden ////////////////////////////////
	void MMTimerHandler(UINT nIdEvent);

		CALLBACK Zeitfunktion(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

};

void CALLBACK XTimerFunction(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

void CALLBACK AudioTimer(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

void CALLBACK OggTimer(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

void CALLBACK TestAudioTimer(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

#endif
</code></pre>
<p>und die dazugehörige Funktion</p>
<pre><code>XTimer::CreateMyTime(UINT MyDelay, int typ, LPTIMECALLBACK input)
{

switch(typ)
		{
		case 0:
		Timertyp = TIME_PERIODIC;
		break;

		case 1:
		Timertyp = TIME_ONESHOT;
		break;
		}
	Delay = MyDelay;
	testwert = 66;
	Funktion = input;	

	TIMECAPS tc;
	timeGetDevCaps(&amp;tc, sizeof(TIMECAPS));
	Resolution = min(max(tc.wPeriodMin,0), tc.wPeriodMax);
	timeBeginPeriod(Resolution);
	MMRESULT idEvent;

	idEvent = timeSetEvent(	 Delay,
						 Resolution,
						 Funktion,   //TimerFunction,   // hier eine Funktion
						 (DWORD) this,
						 Timertyp);

}
</code></pre>
<p>Die Audio-Klasse funktioniert, das Problem tritt dann auf, wenn ich das Programm verlasse. Ich nehme an, dass der Thread, der durch den Callback erzeugt wird, nicht ordentlich aufgeräumt wird - aber das ist bloß eine dunkle Vermutung.</p>
<p>Die Meldung des &quot;just in time debuggers&quot; ist : &quot;ungültige pid&quot;. Sie tritt nicht auf, wenn ich den Timer nicht erzeuge. Da es sich um eine dll handelt, habe ich keinen Anhaltspunkt, wo ich ansetzen kann. So wäre ich, falls niemand eine Antwort weiß, dankbar auch für den Hinweis, welches Tool man zur Lösung eines solchen Problem nutzen kann, um den Fehler im Code zu lokalisieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/183896/callback-problem</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 19:10:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/183896.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 10 Jun 2007 10:36:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CALLBACK Problem on Sun, 10 Jun 2007 10:40:10 GMT]]></title><description><![CDATA[<p>Beim Einrichten einer AudioEngine habe ich eine Callback-Klasse erzeugt, die merkwürdigerweise beim Stop der Dll eine Meldung des just in time debuggers erzeugt.</p>
<p>Die Klasse sieht so aus:</p>
<pre><code>class XTimer
{
public:
	XTimer()
		{
		};

	~XTimer()
		{
		};

	CreateMyTime();
	CreateMyTime(UINT MyDelay, int typ, LPTIMECALLBACK input);

	UINT Delay;						// Verzögerung
	DWORD Resolution;				// Auflösung in Millisekunden
	LPTIMECALLBACK Funktion;		// Pointer auf die aufzurufende Funktion
	DWORD		   UserDaten;       // Daten die an die aufrufende Funktion
									// zurückgegeben werden
	UINT		   Timertyp; 		// TIME_ONESHOT, TIME_PERIODIC

	int testwert;

	/////////////////////// Methoden ////////////////////////////////
	void MMTimerHandler(UINT nIdEvent);

		CALLBACK Zeitfunktion(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

};

void CALLBACK XTimerFunction(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

void CALLBACK AudioTimer(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

void CALLBACK OggTimer(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

void CALLBACK TestAudioTimer(
		  UINT wTimerID,      
		  UINT msg,     
		  DWORD dwUser,  
		  DWORD dw1,     
		  DWORD dw2      
						);

#endif
</code></pre>
<p>und die dazugehörige Funktion</p>
<pre><code>XTimer::CreateMyTime(UINT MyDelay, int typ, LPTIMECALLBACK input)
{

switch(typ)
		{
		case 0:
		Timertyp = TIME_PERIODIC;
		break;

		case 1:
		Timertyp = TIME_ONESHOT;
		break;
		}
	Delay = MyDelay;
	testwert = 66;
	Funktion = input;	

	TIMECAPS tc;
	timeGetDevCaps(&amp;tc, sizeof(TIMECAPS));
	Resolution = min(max(tc.wPeriodMin,0), tc.wPeriodMax);
	timeBeginPeriod(Resolution);
	MMRESULT idEvent;

	idEvent = timeSetEvent(	 Delay,
						 Resolution,
						 Funktion,   //TimerFunction,   // hier eine Funktion
						 (DWORD) this,
						 Timertyp);

}
</code></pre>
<p>Die Audio-Klasse funktioniert, das Problem tritt dann auf, wenn ich das Programm verlasse. Ich nehme an, dass der Thread, der durch den Callback erzeugt wird, nicht ordentlich aufgeräumt wird - aber das ist bloß eine dunkle Vermutung.</p>
<p>Die Meldung des &quot;just in time debuggers&quot; ist : &quot;ungültige pid&quot;. Sie tritt nicht auf, wenn ich den Timer nicht erzeuge. Da es sich um eine dll handelt, habe ich keinen Anhaltspunkt, wo ich ansetzen kann. So wäre ich, falls niemand eine Antwort weiß, dankbar auch für den Hinweis, welches Tool man zur Lösung eines solchen Problem nutzen kann, um den Fehler im Code zu lokalisieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1302344</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1302344</guid><dc:creator><![CDATA[Percy2000]]></dc:creator><pubDate>Sun, 10 Jun 2007 10:40:10 GMT</pubDate></item><item><title><![CDATA[Reply to CALLBACK Problem on Sun, 10 Jun 2007 12:54:01 GMT]]></title><description><![CDATA[<p>Übergib in fuEvent zusätzlich TIME_KILL_SYNCHRONOUS, und räum den Timer mit timeKillEvent weg bevor das Programm terminiert oder die DLL entladen wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1302427</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1302427</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sun, 10 Jun 2007 12:54:01 GMT</pubDate></item><item><title><![CDATA[Reply to CALLBACK Problem on Sun, 10 Jun 2007 14:17:13 GMT]]></title><description><![CDATA[<p>Vielen Dank nochmals, das war die Lösung. <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/1302505</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1302505</guid><dc:creator><![CDATA[Percy2000]]></dc:creator><pubDate>Sun, 10 Jun 2007 14:17:13 GMT</pubDate></item><item><title><![CDATA[Reply to CALLBACK Problem on Mon, 11 Jun 2007 08:34:57 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-403.html" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-4.html" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1302923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1302923</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 11 Jun 2007 08:34:57 GMT</pubDate></item></channel></rss>