title: How to initialize LPWSTR from a const string?
body: <p>I am trying to initialize MENUITEMINFO for a call to InsertMenuItem. When trying to assign a const string to dwTypeData, I get an error. The code below is from MSDN samples.</p>
  
  <p>I get an error for both types of assignment</p>
  
  <pre><code>mii.dwTypeData = "&amp;Sample text";
  mii.dwTypeData = L"&amp;Sample text";
  </code></pre>
  
  <p>I am using Visual Studio 2019. </p>
  
  <pre><code>  MENUITEMINFO mii = { sizeof(mii) };
    mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_STATE;
    mii.wID = idCmdFirst + IDM_DISPLAY;
    mii.fType = MFT_STRING;
    mii.dwTypeData = L"&amp;Sample Text";
    mii.fState = MFS_ENABLED;
    if (!InsertMenuItem(hMenu, indexMenu, TRUE, &amp;mii))
    {
      return HRESULT_FROM_WIN32(GetLastError());
    }
  </code></pre>
  
  <p>The error is 
  Error (active)  E0144   a value of type "const wchar_t *" cannot be used to initialize an entity of type "wchar_t *"</p>
  
  <p>According Microsoft documentation, the second one should work.
  <a href="https://docs.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings</a></p>
  
  <p>Edit: This is not solved by <a href="https://stackoverflow.com/questions/52137990/i-cannot-initializate-wchar">I cannot initializate WCHAR</a> because I cannot change the type as suggested in that answer.</p>