title: Why LRESULT CALLBACK is used in this function?
body: <p>Recently, I've started to learn DX11 and I was trying to create message loops in WinAPI. I saw a LRESULT CALLBACK function from the tutorial that I haven't seen before. It is called in Window Procedure function. Here is the WndProc function and the MessageHandler function(the function that I'm talking about).</p>
  
  <p>WndProc:</p>
  
  <pre><code>LRESULT CALLBACK WndProc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam)
  {
  switch(umessage)
  {
      // Check if the window is being destroyed.
      case WM_DESTROY:
      {
          PostQuitMessage(0);
          return 0;
      }
  
      // Check if the window is being closed.
      case WM_CLOSE:
      {
          PostQuitMessage(0);     
          return 0;
      }
  
      // All other messages pass to the message handler in the system class.
      default:
      {
          return ApplicationHandle-&gt;MessageHandler(hwnd, umessage, wparam, lparam);
      }
  }
  }
  </code></pre>
  
  <p>MessageHandler:</p>
  
  <pre><code>LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
  {
  switch(umsg)
  {
      // Check if a key has been pressed on the keyboard.
      case WM_KEYDOWN:
      {
          // If a key is pressed send it to the input object so it can record that state.
          m_Input-&gt;KeyDown((unsigned int)wparam);
          return 0;
      }
  
      // Check if a key has been released on the keyboard.
      case WM_KEYUP:
      {
          // If a key is released then send it to the input object so it can unset the state for that key.
          m_Input-&gt;KeyUp((unsigned int)wparam);
          return 0;
      }
  
      // Any other messages send to the default message handler as our application won't make use of them.
      default:
      {
          return DefWindowProc(hwnd, umsg, wparam, lparam);
      }
  }
  }
  </code></pre>
  
  <p>What I don't understand is, why we added the "LRESULT CALLBACK" part to the MessageHandler function? I know, we must add it to WndProc function, but I don't get the point of creating a new function and adding it a calling convention. What if we don't add any calling convention to the MessageHandler function? What if we didn't create the MessageHandler funciton and write the KEY_DOWN listeners to WndProc's switch-case statement?</p>
  
  <p>These codes are in one class and ApplicationHandler pointer points to "this".</p>