title: How do I arrange or sort the desktop icons in c#?
body: <p>You know when you right-click the desktop and there's a "Sort by" option that allows you to sort the icons by "Name", "Size", "Item Type", or "Date Modified"? Well, I want to find a way to sort the desktop's icons with a push of a button.</p>
  
  <p>I saw a similar question being asked here on stackoverflow but it's old and the code didn't work for me. The link to the question is: <a href="https://stackoverflow.com/questions/24965672/arranging-desktop-icons-with-c-sharp">Arranging desktop icons with C#</a> . I'm trying to achieve this in Windows 10.</p>
  
  <p>There was a comment on there that said that the LVM_* and LVA_* values are stored in the  commctrl.h file which comes with the SDK. I couldn't find that file for some reason.</p>
  
  <p>Here's what i'm using:</p>
  
  <pre><code>  //sort desktop
       public const int LVM_ARRANGE = 4118;
       public const int LVM_ALIGNLEFT = 1;
  
  
       [DllImport("user32.dll", CharSet = CharSet.Auto)]
       public static extern IntPtr GetDesktopWindow(); 
  
  
      [DllImport("user32.dll")]
       public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
  
       //end of sort desktop 
  
  private void organizeBtn_Click(object sender, EventArgs e)
     {
         var DesktopHandle = GetDesktopWindow();
         MessageBox.Show(GetDesktopWindow().ToString());
  
         SendMessage(GetDesktopWindow(), LVM_ARRANGE, LVM_ALIGNLEFT, 0);
  
     }
  </code></pre>
  
  <p>I've been digging for info or some sort of direction about this topic, especially regarding windows 10, but I can't find much.  Please help?</p>