title: MessageBox - HWND parameter
body: <p>I am working on an MFC application and I am adding some error checking with the use of <code>MessageBox</code> which has documentation found <a href="https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox" rel="nofollow noreferrer">here</a>.</p>
  <pre><code>int MessageBox(
    [in, optional] HWND    hWnd,
    [in, optional] LPCTSTR lpText,
    [in, optional] LPCTSTR lpCaption,
    [in]           UINT    uType
  );
  </code></pre>
  <p><code>Note: The utype parameter is a list of styles separated with |</code></p>
  <p>Above is <code>MessageBox</code>'s implementation. My question is about the HWND parameter. When writing my call to <code>MessageBox</code>, Visual Studio 2017 Professional did not ask for the HWND parameter. At first, I thought it was because it is optional, but the other two optional <code>LPCTSTR</code> parameters were not as optional as they seemed, and required me to put at least <code>&quot;&quot;</code> to satisfy them.</p>
  <p>Currently, my call to <code>MessageBox</code> only uses the last three parameters. My call is:</p>
  <p><code>int BoxReturnVal = MessageBox(&quot;foo1&quot;, &quot;foo2&quot;, MB_OK | MB_ICON);</code>.</p>
  <p>My question is why is the <code>HWND</code> parameter not asked for while writing the call to the function and do I need to worry about it all?</p>
  <p>Thank you in advance ! :D</p>