<?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[Find nen Fehler net]]></title><description><![CDATA[<p>Hi</p>
<p>ich hab folgernden code(keine angst, isnet der ganze):</p>
<pre><code class="language-cpp">//Hauptfenster

	WNDCLASSEX window;
	MSG message;

	window.cbSize = sizeof(WNDCLASSEX);
	window.lpszClassName = &quot;VirtualDrumWindow&quot;;
	window.lpfnWndProc = WndProc;
	window.style = CS_HREDRAW | CS_VREDRAW;

	window.hCursor = LoadCursor(NULL, IDC_ARROW);
	window.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	window.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	window.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

	window.lpszMenuName = NULL;
	window.cbClsExtra = 0;
	window.cbWndExtra = 0;

	window.hInstance = hInstance;

	if(!RegisterClassEx(&amp;window)){

		MessageBox(NULL, &quot;Error: !RegisterClassEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);

		return 0;
	}

	hWnd = CreateWindowEx(0,
						  &quot;VirtualDrum&quot;,
						  &quot;MB VirtualDrumset&quot;,
						  WS_VISIBLE | WS_SYSMENU,
						  0, 0,
						  300, 300,
						  NULL,
						  NULL,
						  hInstance,
						  NULL);

	if(hWnd == NULL){
		MessageBox(NULL, &quot;Error: !CreateWindowEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);
		return 0;
	}
</code></pre>
<p>bloß hWnd is immer null. kann mir ma einer sagen wieso?</p>
<p>Eldarion</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/161234/find-nen-fehler-net</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 10:34:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/161234.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Oct 2006 16:49:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find nen Fehler net on Wed, 04 Oct 2006 16:49:28 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>ich hab folgernden code(keine angst, isnet der ganze):</p>
<pre><code class="language-cpp">//Hauptfenster

	WNDCLASSEX window;
	MSG message;

	window.cbSize = sizeof(WNDCLASSEX);
	window.lpszClassName = &quot;VirtualDrumWindow&quot;;
	window.lpfnWndProc = WndProc;
	window.style = CS_HREDRAW | CS_VREDRAW;

	window.hCursor = LoadCursor(NULL, IDC_ARROW);
	window.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	window.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	window.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

	window.lpszMenuName = NULL;
	window.cbClsExtra = 0;
	window.cbWndExtra = 0;

	window.hInstance = hInstance;

	if(!RegisterClassEx(&amp;window)){

		MessageBox(NULL, &quot;Error: !RegisterClassEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);

		return 0;
	}

	hWnd = CreateWindowEx(0,
						  &quot;VirtualDrum&quot;,
						  &quot;MB VirtualDrumset&quot;,
						  WS_VISIBLE | WS_SYSMENU,
						  0, 0,
						  300, 300,
						  NULL,
						  NULL,
						  hInstance,
						  NULL);

	if(hWnd == NULL){
		MessageBox(NULL, &quot;Error: !CreateWindowEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);
		return 0;
	}
</code></pre>
<p>bloß hWnd is immer null. kann mir ma einer sagen wieso?</p>
<p>Eldarion</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1149390</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1149390</guid><dc:creator><![CDATA[Eldarion]]></dc:creator><pubDate>Wed, 04 Oct 2006 16:49:28 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Wed, 04 Oct 2006 17:01:04 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">hWnd = CreateWindowEx(0,
                          &quot;VirtualDrum&quot;,
                          &quot;MB VirtualDrumset&quot;,
                          WS_VISIBLE | WS_SYSMENU,
                          0, 0,
                          300, 300,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);
</code></pre>
<p>Was soll das sein ? Hab ich noch nie gesehen , und Google sagt mir auch nix ueber VirtualDrum.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1149396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1149396</guid><dc:creator><![CDATA[PhoeNix_FasT]]></dc:creator><pubDate>Wed, 04 Oct 2006 17:01:04 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Wed, 04 Oct 2006 17:08:56 GMT]]></title><description><![CDATA[<p>es kann an der Funktion WndProc liegen die du uns nicht zeigst</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1149398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1149398</guid><dc:creator><![CDATA[hinweis]]></dc:creator><pubDate>Wed, 04 Oct 2006 17:08:56 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Wed, 04 Oct 2006 17:22:19 GMT]]></title><description><![CDATA[<p>@hinweis: wusste net das die so wichtig ist <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>
<p>@phonix: das is ja wohl der titel meines fenster, wo is das das problem dabei?</p>
<p>naja, hier ma der ganze code. ich fürchte ich hab noch net so ganz verstanden wie ich dasd mti nem childwindow machen, weil vorher ging alles ;=)</p>
<p>So, hier dann ma der ganze code(eingie funktionen sind in andenr skripten definiernt, aber die funzten voher auch):</p>
<pre><code>#include &lt;windows.h&gt;

#include &lt;stdio.h&gt;
#include &lt;dsound.h&gt;
#include &lt;dinput.h&gt;

#include &quot;Input.h&quot;
#include &quot;Sound.h&quot;

#define WM_DRUMSET WM_USER + 1

enum{
   DE_BASS,
   DE_SNARE,
   DE_TOM1,
   DE_TOM2,
   DE_TOM3,
   DE_RIDE,
   DE_CRASH,
   DE_HIHAT_F,
   DE_HIHAT_H
};

enum{
	MAPVK_VK_TO_VSC,
	MAPVK_VSC_TO_VK,
	MAPVK_VK_TO_CHAR,
	MAPVK_VSC_TO_VK_EX,
	MAPVK_VK_TO_VSC_EX
};

#define SCAN(x) MapVirtualKey(x, MAPVK_VK_TO_VSC)
#define VK(x) MapVirtualKey(x, MAPVK_VSC_TO_VK)

LPDIRECTSOUNDBUFFER8 Bass, Snare, Tom1, Tom2, Tom3, Ride, Crash, HiHat_c, HiHat_o, HiHat_f;
HWND hWnd;
HWND hWndO;
char KeyNames[9];
bool HiHat = false;

HRESULT LoadSettings(LPSTR lpConfig){

    return DRUM_OK;
}

DWORD InputThread(LPVOID lpParameter)
{

    int i;

    KeyNames[DE_BASS] = SCAN('B');
    KeyNames[DE_SNARE] = SCAN('S');
    KeyNames[DE_TOM1] = SCAN('E');
    KeyNames[DE_TOM2] = SCAN('R');
    KeyNames[DE_TOM3] = SCAN('T');
    KeyNames[DE_RIDE] = SCAN('I');
    KeyNames[DE_CRASH] = SCAN('U');
    KeyNames[DE_HIHAT_F] = SCAN('A');
    KeyNames[DE_HIHAT_H] = SCAN('Y');

    BYTE bKeyState[256];
    bool KeyStateOld[9];

    ZeroMemory((LPVOID)&amp;bKeyState,
               sizeof(bKeyState));
    while(true)
    {
      ZeroMemory((LPVOID)&amp;bKeyState, sizeof(bKeyState));
      ReadData(bKeyState);

   			if(bKeyState[KeyNames[DE_BASS&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_BASS])
            {
                SendMessage(hWnd, WM_DRUMSET,  DE_BASS, 1);
                KeyStateOld[DE_BASS] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_BASS&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_BASS]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_BASS, 0);

                  KeyStateOld[DE_BASS] = false;
            }      

			if(bKeyState[KeyNames[DE_SNARE&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_SNARE])
            {
               SendMessage(hWnd, WM_DRUMSET,  DE_SNARE, 1);
               KeyStateOld[DE_SNARE] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_SNARE&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_SNARE]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_SNARE, 0);

                  KeyStateOld[DE_SNARE] = false;
            } 

			if(bKeyState[KeyNames[DE_TOM1&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_TOM1])
            {
               SendMessage(hWnd, WM_DRUMSET,  DE_TOM1, 1);
               KeyStateOld[DE_TOM1] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_TOM1&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_TOM1]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_TOM1, 0);

                  KeyStateOld[DE_TOM1] = false;
            } 			

			if(bKeyState[KeyNames[DE_TOM2&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_TOM2])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_TOM2, 1);
               KeyStateOld[DE_TOM2] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_TOM2&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_TOM2]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_TOM2, 0);

                  KeyStateOld[DE_TOM2] = false;
            } 

			if(bKeyState[KeyNames[DE_TOM3&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_TOM3])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_TOM3, 1);
               KeyStateOld[DE_TOM3] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_TOM3&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_TOM3]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_TOM3, 0);

                  KeyStateOld[DE_TOM3] = false;
            } 

			if(bKeyState[KeyNames[DE_RIDE&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_RIDE])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_RIDE, 1);
               KeyStateOld[DE_RIDE] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_RIDE&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_RIDE]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_RIDE, 0);

                  KeyStateOld[DE_RIDE] = false;
            } 

			if(bKeyState[KeyNames[DE_CRASH&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_CRASH])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_CRASH, 1);
               KeyStateOld[DE_CRASH] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_CRASH&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_CRASH]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_CRASH, 0);

                  KeyStateOld[DE_CRASH] = false;
            } 

			if(bKeyState[KeyNames[DE_HIHAT_F&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_HIHAT_F])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_F, 1);
               KeyStateOld[DE_HIHAT_F] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_HIHAT_F&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_HIHAT_F]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_F, 0);

                  KeyStateOld[DE_HIHAT_F] = false;
            } 

			if(bKeyState[KeyNames[DE_HIHAT_H&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_HIHAT_H])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_H, 1);
               KeyStateOld[DE_HIHAT_H] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_HIHAT_H&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_HIHAT_H]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_H, 0);

                  KeyStateOld[DE_HIHAT_H] = false;
            } 

   }
   return 0;
}

LRESULT CALLBACK WndProcO(HWND hWndO,
						 UINT option_message,
						 WPARAM wParam,
						 LPARAM lParam){
   static HWND heditBass;                                
   switch(option_message)
   {

        case WM_CREATE:{
                      heditBass = CreateWindow(  &quot;edit&quot;,
                                  &quot;B&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  20, 20, 50, 50,
                                  hWndO,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);
                                  return 0;
                      }
                      break;
        case WM_SIZE:{
                      MoveWindow(heditBass, LOWORD(lParam) / 2 - 80, HIWORD(lParam) - 30, 
                                                           160, 22, TRUE);
                      return 0;
                      }
                      break;

   }
}

LRESULT CALLBACK WndProc(HWND hWnd,
						 UINT msg,
						 WPARAM wParam,
						 LPARAM lParam){

   static HWND hButtonO;

	switch(msg){

         case WM_CREATE:{
                      hButtonO = CreateWindow(  &quot;button&quot;,
                                  &quot;Optionen&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  20, 20, 50, 50,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);
                                  return 0;
                      }
                      break;
        case WM_SIZE:{
                      MoveWindow(hButtonO, LOWORD(lParam) / 2 - 80, HIWORD(lParam) - 30, 
                                                           160, 22, TRUE);
                      return 0;
                      }
                      break;

		case WM_DESTROY:{

			PostQuitMessage(0);
			return 0;

		} break;

		case WM_DRUMSET:{

        	switch(wParam){

                case DE_BASS:{

                    if((bool)lParam){ 

                        Bass-&gt;SetCurrentPosition(0);
                	    Bass-&gt;Play(0, 0, 0);
                    }

                } break;
                              case DE_SNARE:{ 
                 if((bool)lParam) 
                 {      
                 Snare-&gt;SetCurrentPosition(0); 
                 Snare-&gt;Play(0, 0, 0); 
                 }  
                 } break; 
            	case DE_HIHAT_F:{

                	if((bool)lParam){

                 		HiHat_o-&gt;Stop();

                 		HiHat_f-&gt;SetCurrentPosition(0);
                 		HiHat_f-&gt;Play(0, 0, 0);

                      	HiHat = true;
                	}
                	else HiHat = false;
                } break;
                case DE_HIHAT_H:{

                	if((bool)lParam){

                        if(HiHat){

                    		HiHat_c-&gt;SetCurrentPosition(0);
                			HiHat_c-&gt;Play(0, 0, 0);
                		}
                		else{

                    		HiHat_o-&gt;SetCurrentPosition(0);
                    		HiHat_o-&gt;Play(0, 0, 0);
                		}
                	}
            	} break;
            }

            return 0;
        }
	}

	return DefWindowProc(hWnd,
						 msg,
						 wParam,
						 lParam);
} 

int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine,
				   int nShowCmd){

	HRESULT hr;
//Hauptfenster

	WNDCLASSEX window;
	MSG message;

	window.cbSize = sizeof(WNDCLASSEX);
	window.lpszClassName = &quot;VirtualDrumWindow&quot;;
	window.lpfnWndProc = WndProc;
	window.style = CS_HREDRAW | CS_VREDRAW;

	window.hCursor = LoadCursor(NULL, IDC_ARROW);
	window.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	window.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	window.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

	window.lpszMenuName = NULL;
	window.cbClsExtra = 0;
	window.cbWndExtra = 0;

	window.hInstance = hInstance;

	if(!RegisterClassEx(&amp;window)){

		MessageBox(NULL, &quot;Error: !RegisterClassEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);

		return 0;
	}

	hWnd = CreateWindowEx(0,
						  &quot;VirtualDrum&quot;,
						  &quot;MB VirtualDrumset&quot;,
						  WS_VISIBLE | WS_SYSMENU,
						  0, 0,
						  300, 300,
						  NULL,
						  NULL,
						  hInstance,
						  NULL);

	if(hWnd == NULL){
		MessageBox(NULL, &quot;Error: !CreateWindowEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);
		return 0;
	}
		DWORD dwThreadId;
		bool done = false;
//Optionsfenster

	WNDCLASSEX option;
	MSG option_message;

	option.cbSize = sizeof(WNDCLASSEX);
	option.lpszClassName = &quot;VirtualDrumWindow Optionen&quot;;
	option.lpfnWndProc = WndProc;
	option.style = CS_HREDRAW | CS_VREDRAW;

	option.hCursor = LoadCursor(NULL, IDC_ARROW);
	option.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	option.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	option.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);

	option.lpszMenuName = NULL;
	option.cbClsExtra = 0;
	option.cbWndExtra = 0;

	option.hInstance = hInstance;

	hr = InitInput(hWnd,
				   hInstance);

	if(FAILED(hr)) return 0;

	hr = InitSound(hWnd);

	if(FAILED(hr)){

		CleanupInput();
		return 0;
	}

	hr = LoadWaveToBuffer(&quot;Sounds/Bassdrum.wav&quot;, &amp;Bass);
	hr = LoadWaveToBuffer(&quot;Sounds/Snare normal.wav&quot;, &amp;Snare);
	hr = LoadWaveToBuffer(&quot;Sounds/12er Tom.wav&quot;, &amp;Tom1);
	hr = LoadWaveToBuffer(&quot;Sounds/14er Tom.wav&quot;, &amp;Tom2);
	hr = LoadWaveToBuffer(&quot;Sounds/Tom 3.wav&quot;, &amp;Tom3);
	hr = LoadWaveToBuffer(&quot;Sounds/19er aaxplosion Crash.wav&quot;, &amp;Crash);
	hr = LoadWaveToBuffer(&quot;Sounds/19er Zultan Rockbeat Ride.wav&quot;, &amp;Ride);
	hr = LoadWaveToBuffer(&quot;Sounds/Hihat Stick geschlossen.wav&quot;, &amp;HiHat_c);
	hr = LoadWaveToBuffer(&quot;Sounds/Hihat offen.wav&quot;, &amp;HiHat_o);
    hr = LoadWaveToBuffer(&quot;Sounds/Hihat getretten hart.wav&quot;, &amp;HiHat_f);

    CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&amp;InputThread, 0, 0, &amp;dwThreadId); 

	while(!done){

		if(PeekMessage(&amp;message,
					   NULL, 0, 0,
					   PM_REMOVE)){

			TranslateMessage(&amp;message);
			DispatchMessage(&amp;message);

			if(message.message == WM_QUIT) done = true;
		}
	}

	CleanupSound();
	CleanupInput();

	return 0;
}
</code></pre>
<p>Mmn hab ich das noch net so ganz gecheckt wie ich das mit dem zweiten fenster mache.</p>
<p>MfG<br />
Eldarion</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1149406</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1149406</guid><dc:creator><![CDATA[Eldarion]]></dc:creator><pubDate>Wed, 04 Oct 2006 17:22:19 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Wed, 04 Oct 2006 18:12:45 GMT]]></title><description><![CDATA[<p>Du hast beim ClassName in der WNDCLASSEX VirtualDrumWindow geschrieben und bei CreateWindow VirtualDrum.<br />
Dein zweiter Parameter bei CreateWindow ist nämlich nicht dein Fenstertitel, das ist dein dritter, sondern die zu verwendende Klasse.</p>
<p>Have fun!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1149426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1149426</guid><dc:creator><![CDATA[fehlersucher]]></dc:creator><pubDate>Wed, 04 Oct 2006 18:12:45 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Wed, 04 Oct 2006 19:59:22 GMT]]></title><description><![CDATA[<p>hey leuts, ihr seit die größten <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="🙂"
    /> , wieder was gelernt <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/1149511</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1149511</guid><dc:creator><![CDATA[Eldarion]]></dc:creator><pubDate>Wed, 04 Oct 2006 19:59:22 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Thu, 05 Oct 2006 11:38:52 GMT]]></title><description><![CDATA[<p>sry das ich euhc nohcma was fragen muss, ich erzeuge mämlich jetz mit dem button mein 2tes fenster, bloß dann stürzt mein prog immer ab und windows wil nen fehlerbericht senden <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>
<p>Hier nochma der code, ich hab die callbacks jetz nach unten, weil die ja auf die klassen zugreifen müssen.</p>
<pre><code>#include &lt;windows.h&gt;

#include &lt;stdio.h&gt;
#include &lt;dsound.h&gt;
#include &lt;dinput.h&gt;

#include &quot;Input.h&quot;
#include &quot;Sound.h&quot;

#define WM_DRUMSET WM_USER + 1

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WndProcO(HWND, UINT, WPARAM, LPARAM);

enum{
   DE_BASS,
   DE_SNARE,
   DE_TOM1,
   DE_TOM2,
   DE_TOM3,
   DE_RIDE,
   DE_CRASH,
   DE_HIHAT_F,
   DE_HIHAT_H
};

enum{
	MAPVK_VK_TO_VSC,
	MAPVK_VSC_TO_VK,
	MAPVK_VK_TO_CHAR,
	MAPVK_VSC_TO_VK_EX,
	MAPVK_VK_TO_VSC_EX
};

#define SCAN(x) MapVirtualKey(x, MAPVK_VK_TO_VSC)
#define VK(x) MapVirtualKey(x, MAPVK_VSC_TO_VK)

LPDIRECTSOUNDBUFFER8 Bass, Snare, Tom1, Tom2, Tom3, Ride, Crash, HiHat_c, HiHat_o, HiHat_f;
HWND hWnd;
HWND hWndO;
char KeyNames[9];
bool HiHat = false;

HRESULT LoadSettings(LPSTR lpConfig){

    return DRUM_OK;
}

DWORD InputThread(LPVOID lpParameter)
{

    int i;

    KeyNames[DE_BASS] = SCAN('B');
    KeyNames[DE_SNARE] = SCAN('S');
    KeyNames[DE_TOM1] = SCAN('E');
    KeyNames[DE_TOM2] = SCAN('R');
    KeyNames[DE_TOM3] = SCAN('T');
    KeyNames[DE_RIDE] = SCAN('I');
    KeyNames[DE_CRASH] = SCAN('U');
    KeyNames[DE_HIHAT_F] = SCAN('A');
    KeyNames[DE_HIHAT_H] = SCAN('Y');

    BYTE bKeyState[256];
    bool KeyStateOld[9];

    ZeroMemory((LPVOID)&amp;bKeyState,
               sizeof(bKeyState));
    while(true)
    {
      ZeroMemory((LPVOID)&amp;bKeyState, sizeof(bKeyState));
      ReadData(bKeyState);

   			if(bKeyState[KeyNames[DE_BASS&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_BASS])
            {
                SendMessage(hWnd, WM_DRUMSET,  DE_BASS, 1);
                KeyStateOld[DE_BASS] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_BASS&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_BASS]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_BASS, 0);

                  KeyStateOld[DE_BASS] = false;
            }      

			if(bKeyState[KeyNames[DE_SNARE&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_SNARE])
            {
               SendMessage(hWnd, WM_DRUMSET,  DE_SNARE, 1);
               KeyStateOld[DE_SNARE] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_SNARE&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_SNARE]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_SNARE, 0);

                  KeyStateOld[DE_SNARE] = false;
            } 

			if(bKeyState[KeyNames[DE_TOM1&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_TOM1])
            {
               SendMessage(hWnd, WM_DRUMSET,  DE_TOM1, 1);
               KeyStateOld[DE_TOM1] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_TOM1&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_TOM1]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_TOM1, 0);

                  KeyStateOld[DE_TOM1] = false;
            } 			

			if(bKeyState[KeyNames[DE_TOM2&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_TOM2])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_TOM2, 1);
               KeyStateOld[DE_TOM2] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_TOM2&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_TOM2]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_TOM2, 0);

                  KeyStateOld[DE_TOM2] = false;
            } 

			if(bKeyState[KeyNames[DE_TOM3&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_TOM3])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_TOM3, 1);
               KeyStateOld[DE_TOM3] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_TOM3&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_TOM3]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_TOM3, 0);

                  KeyStateOld[DE_TOM3] = false;
            } 

			if(bKeyState[KeyNames[DE_RIDE&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_RIDE])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_RIDE, 1);
               KeyStateOld[DE_RIDE] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_RIDE&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_RIDE]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_RIDE, 0);

                  KeyStateOld[DE_RIDE] = false;
            } 

			if(bKeyState[KeyNames[DE_CRASH&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_CRASH])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_CRASH, 1);
               KeyStateOld[DE_CRASH] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_CRASH&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_CRASH]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_CRASH, 0);

                  KeyStateOld[DE_CRASH] = false;
            } 

			if(bKeyState[KeyNames[DE_HIHAT_F&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_HIHAT_F])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_F, 1);
               KeyStateOld[DE_HIHAT_F] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_HIHAT_F&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_HIHAT_F]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_F, 0);

                  KeyStateOld[DE_HIHAT_F] = false;
            } 

			if(bKeyState[KeyNames[DE_HIHAT_H&rsqb;&rsqb; &amp;&amp; !KeyStateOld[DE_HIHAT_H])
			{
               SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_H, 1);
               KeyStateOld[DE_HIHAT_H] = TRUE;
			}
			else if(!bKeyState[KeyNames[DE_HIHAT_H&rsqb;&rsqb; &amp;&amp; KeyStateOld[DE_HIHAT_H]){

                  SendMessage(hWnd, WM_DRUMSET,  DE_HIHAT_H, 0);

                  KeyStateOld[DE_HIHAT_H] = false;
            } 

   }
   return 0;
}

int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine,
				   int nShowCmd){

	HRESULT hr;
//Hauptfenster

	WNDCLASSEX window;
	MSG message;

	window.cbSize = sizeof(WNDCLASSEX);
	window.lpszClassName = &quot;VirtualDrumWindow&quot;;
	window.lpfnWndProc = WndProc;
	window.style = CS_HREDRAW | CS_VREDRAW;

	window.hCursor = LoadCursor(NULL, IDC_ARROW);
	window.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	window.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	window.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

	window.lpszMenuName = NULL;
	window.cbClsExtra = 0;
	window.cbWndExtra = 0;

	window.hInstance = hInstance;

	if(!RegisterClassEx(&amp;window)){

		MessageBox(NULL, &quot;Error: !RegisterClassEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);

		return 0;
	}

	hWnd = CreateWindowEx(0,
						  &quot;VirtualDrumWindow&quot;,
						  &quot;MB VirtualDrumset&quot;,
						  WS_VISIBLE | WS_SYSMENU,
						  0, 0,
						  300, 300,
						  NULL,
						  NULL,
						  hInstance,
						  NULL);

	if(hWnd == NULL){
		MessageBox(NULL, &quot;Error: !CreateWindowEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);
		return 0;
	}
		DWORD dwThreadId;
		bool done = false;
//Optionsfenster

	WNDCLASSEX option;
	MSG option_message;

	option.cbSize = sizeof(WNDCLASSEX);
	option.lpszClassName = &quot;VirtualDrumWindow Optionen&quot;;
	option.lpfnWndProc = WndProcO;
	option.style = CS_HREDRAW | CS_VREDRAW;

	option.hCursor = LoadCursor(NULL, IDC_ARROW);
	option.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	option.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	option.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);

	option.lpszMenuName = NULL;
	option.cbClsExtra = 0;
	option.cbWndExtra = 0;

	option.hInstance = hInstance;

	hr = InitInput(hWnd,
				   hInstance);

	if(FAILED(hr)) return 0;

	hr = InitSound(hWnd);

	if(FAILED(hr)){

		CleanupInput();
		return 0;
	}

	hr = LoadWaveToBuffer(&quot;Sounds/Bassdrum.wav&quot;, &amp;Bass);
	hr = LoadWaveToBuffer(&quot;Sounds/Snare normal.wav&quot;, &amp;Snare);
	hr = LoadWaveToBuffer(&quot;Sounds/12er Tom.wav&quot;, &amp;Tom1);
	hr = LoadWaveToBuffer(&quot;Sounds/14er Tom.wav&quot;, &amp;Tom2);
	hr = LoadWaveToBuffer(&quot;Sounds/Tom 3.wav&quot;, &amp;Tom3);
	hr = LoadWaveToBuffer(&quot;Sounds/19er aaxplosion Crash.wav&quot;, &amp;Crash);
	hr = LoadWaveToBuffer(&quot;Sounds/19er Zultan Rockbeat Ride.wav&quot;, &amp;Ride);
	hr = LoadWaveToBuffer(&quot;Sounds/Hihat Stick geschlossen.wav&quot;, &amp;HiHat_c);
	hr = LoadWaveToBuffer(&quot;Sounds/Hihat offen.wav&quot;, &amp;HiHat_o);
    hr = LoadWaveToBuffer(&quot;Sounds/Hihat getretten hart.wav&quot;, &amp;HiHat_f);

    CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&amp;InputThread, 0, 0, &amp;dwThreadId); 

	while(!done){

		if(PeekMessage(&amp;message,
					   NULL, 0, 0,
					   PM_REMOVE)){

			TranslateMessage(&amp;message);
			DispatchMessage(&amp;message);

			if(message.message == WM_QUIT) done = true;
		}
	}

	CleanupSound();
	CleanupInput();

	return 0;
}

LRESULT CALLBACK WndProc(HWND hWnd,
						 UINT msg,
						 WPARAM wParam,
						 LPARAM lParam){

   static HWND hButton;

	switch(msg){

         case WM_CREATE:{
                      hButton = CreateWindowEx(0,  &quot;button&quot;,
                                  &quot;Optionen&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  20, 20, 50, 50,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);
                                  return 0;
                                  	if(hWndO == NULL){
		MessageBox(NULL, &quot;Error: !CreateWindowEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);
		return 0;
	}
                      }
                      break;
         case WM_COMMAND:
              if(lParam == (LPARAM)hButton){
                hWndO = CreateWindowEx(0,
						  &quot;VirtualDrumWindow Optionen&quot;,
						  &quot;MB VirtualDrumset&quot;,
						  WS_VISIBLE | WS_SYSMENU,
						  0, 0,
						  300, 300,
						  NULL,
						  NULL,
						  ((LPCREATESTRUCT) lParam)-&gt;hInstance,
						  NULL);
                       }

	if(hWnd == NULL){
		MessageBox(NULL, &quot;Error: !CreateWindowEx&quot;, &quot;Error&quot;, MB_OK | MB_ICONERROR);
		return 0;
	}

        case WM_SIZE:{
                      MoveWindow(hButton, LOWORD(lParam) / 2 - 80, HIWORD(lParam) - 30, 
                                                           160, 22, TRUE);
                      return 0;
                      }
                      break;

		case WM_DESTROY:{

			PostQuitMessage(0);
			return 0;

		} break;

		case WM_DRUMSET:{

        	switch(wParam){

                case DE_BASS:{

                    if((bool)lParam){ 

                        Bass-&gt;SetCurrentPosition(0);
                	    Bass-&gt;Play(0, 0, 0);
                    }

                } break;
                              case DE_SNARE:{ 
                 if((bool)lParam) 
                 {      
                 Snare-&gt;SetCurrentPosition(0); 
                 Snare-&gt;Play(0, 0, 0); 
                 }  
                 } break; 
            	case DE_HIHAT_F:{

                	if((bool)lParam){

                 		HiHat_o-&gt;Stop();

                 		HiHat_f-&gt;SetCurrentPosition(0);
                 		HiHat_f-&gt;Play(0, 0, 0);

                      	HiHat = true;
                	}
                	else HiHat = false;
                } break;
                case DE_HIHAT_H:{

                	if((bool)lParam){

                        if(HiHat){

                    		HiHat_c-&gt;SetCurrentPosition(0);
                			HiHat_c-&gt;Play(0, 0, 0);
                		}
                		else{

                    		HiHat_o-&gt;SetCurrentPosition(0);
                    		HiHat_o-&gt;Play(0, 0, 0);
                		}
                	}
            	} break;
            }

            return 0;
        }
	}

	return DefWindowProc(hWnd,
						 msg,
						 wParam,
						 lParam);
} 

LRESULT CALLBACK WndProcO(HWND hWndO,
						 UINT option_message,
						 WPARAM wParam,
						 LPARAM lParam){
   static HWND heditBass;                                
   switch(option_message)
   {

        case WM_CREATE:{
                      heditBass = CreateWindow(  &quot;edit&quot;,
                                  &quot;B&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  20, 20, 50, 50,
                                  hWndO,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);
                                  return 0;
                      }
                      break;
        case WM_SIZE:{
                      MoveWindow(heditBass, LOWORD(lParam) / 2 - 80, HIWORD(lParam) - 30, 
                                                           160, 22, TRUE);
                      return 0;
                      }
                      break;
 		case WM_DESTROY:{

			PostQuitMessage(0);
			return 0;

		} break;

   }
   	return DefWindowProc(hWndO,
						 option_message,
						 wParam,
						 lParam);
}
</code></pre>
<p>Könntet ihr mir nochma den fehler sagen?</p>
<p>Eldarion</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1149840</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1149840</guid><dc:creator><![CDATA[Eldarion]]></dc:creator><pubDate>Thu, 05 Oct 2006 11:38:52 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Fri, 06 Oct 2006 07:49:51 GMT]]></title><description><![CDATA[<p>sry für den doppelpost, aber aufnen edit reagiert keiner. ich bin mir mittlerweile fast sicher, das das problem hierdrin liegt:</p>
<pre><code class="language-cpp">hWndO = CreateWindowEx(0,
                          &quot;VirtualDrumWindow Optionen&quot;,
                          &quot;MB VirtualDrumset&quot;,
                          WS_VISIBLE | WS_SYSMENU,
                          0, 0,
                          300, 300,
                          NULL,
                          NULL,
                          ((LPCREATESTRUCT) lParam)-&gt;hInstance,
                          NULL);
</code></pre>
<p>und zwar genau hier:</p>
<pre><code class="language-cpp">((LPCREATESTRUCT) lParam)-&gt;hInstance,
</code></pre>
<p>was muss da hin=? <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>
<p>Mfg<br />
Eldarino</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150337</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150337</guid><dc:creator><![CDATA[Eldarion]]></dc:creator><pubDate>Fri, 06 Oct 2006 07:49:51 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Fri, 06 Oct 2006 10:38:30 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">GetModuleHandle(NULL);
</code></pre>
<p>da das CREATESTRUCT im lParam NUR unter WM_CREATE verfügbar ist. Siehe auch in der MSDN zu WM_CREATE und WM_COMMAND.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150469</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150469</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Fri, 06 Oct 2006 10:38:30 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Fri, 06 Oct 2006 11:06:08 GMT]]></title><description><![CDATA[<p>danke <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/1150504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150504</guid><dc:creator><![CDATA[Eldarion]]></dc:creator><pubDate>Fri, 06 Oct 2006 11:06:08 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Fri, 06 Oct 2006 11:16:45 GMT]]></title><description><![CDATA[<p>Eldarion schrieb:</p>
<blockquote>
<p>danke <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>
</blockquote>
<p>Jo kein Problem <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/1150512</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150512</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Fri, 06 Oct 2006 11:16:45 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Fri, 06 Oct 2006 11:22:12 GMT]]></title><description><![CDATA[<p>Eldarion schrieb:</p>
<blockquote>
<p>Find nen Fehler net</p>
</blockquote>
<p>wieso ich? <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/1150519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150519</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Fri, 06 Oct 2006 11:22:12 GMT</pubDate></item><item><title><![CDATA[Reply to Find nen Fehler net on Fri, 06 Oct 2006 13:26:05 GMT]]></title><description><![CDATA[<p>weil ich dich ja nich sehe <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/1150608</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150608</guid><dc:creator><![CDATA[Eldarion]]></dc:creator><pubDate>Fri, 06 Oct 2006 13:26:05 GMT</pubDate></item></channel></rss>