title: what is different between wmi and API
body: <p>i work with c++ programming, I use an example for understanding main of my question.</p>
  
  <p>Suppose, we want get current username in windows operation system, we can use follow code :</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;Lmcons.h&gt;
  
  char username[UNLEN+1];
  DWORD username_len = UNLEN+1;
  GetUserName(username, &amp;username_len);
  </code></pre>
  
  <p>also, we can use wmi by follow the instruction explained on <a href="https://docs.microsoft.com/en-us/windows/desktop/wmisdk/wmi-start-page" rel="nofollow noreferrer">here</a> and use <a href="https://docs.microsoft.com/en-us/windows/desktop/CIMWin32Prov/win32-computersystem" rel="nofollow noreferrer">Win32_ComputerSystem.UserName</a> .</p>
  
  <p>so, I hope you have fully understood, <strong>what's different between wmi and using api or any other way?</strong></p>
  
  <p>tank you for your response. </p>