title: How to create additional controls in WinAPI? Only the first control works?
body: <p>I've recently started to study WinAPI. After going through about ten top search results for tutorials on it, I'm still confused where you add code for more than one control per window? For example, if I want to add a second button, what kind of code and where do you place the code for it?</p>
  
  <p>When I <code>#define IDC_BUTTON   WM_USER + 1</code>, add <code>HINSTANCE hIns;</code> and <code>HWND hButton;</code> to the Callback, and then call this:</p>
  
  <pre><code>case WM_CREATE:
      hIns=((LPCREATESTRUCT)lParam)-&gt;hInstance;
      hButton=CreateWindow("Button","Click Me",WS_CHILD|WS_VISIBLE,70,60,150,30,hwnd,(HMENU)IDC_BUTTON,hIns,0);
  break;
  </code></pre>
  
  <p>It works and the button appears in the window. But when I try to add a second one, nothing appears, even with changed names:</p>
  
  <p><code>#define IDC_BUTTON2   WM_USER + 2</code><br>
  +<br>
  <code>HINSTANCE hIns;</code><br>
  <code>HWND hButton2;</code>  </p>
  
  <pre><code>case WM_CREATE:
     hIns=((LPCREATESTRUCT)lParam)-&gt;hInstance;
     hButton=CreateWindow("Button","Click Me",WS_CHILD|WS_VISIBLE,70,60,150,30,hwnd,(HMENU)IDC_BUTTON,hIns,0);
     hButton2=CreateWindow("Second","Press here",WS_CHILD|WS_VISIBLE,170,160,250,130,hwnd,(HMENU)IDC_BUTTON2,hIns,0);
     break;
  </code></pre>
  
  <p>The first button appears OK, but the second does not (different coordinates also). What am I doing wrong here? Thanks!</p>
  
  <p>Edit:
  I replaced the <code>hIns2</code> with <code>hIns</code> in the code.</p>