title: C# and AutoitX: Winlist handle
body: <p>I'm creating a windowarranger with C# and autoitX. I tried it with C# only but I couldn't get the correct handles. </p>
  
  <p>But I worked in autoit so I thought I just use the autoitX dll to get the handles.</p>
  
  <p>And I am nearly finished with my project, but the autoit winsetstate function to minimize the windows seems a little bit buggy with certain programs.</p>
  
  <p>So I thought I could use the handle which I get from an autoit function and minimize the window with the sendmessage win api function.</p>
  
  <pre><code>control.winlist[1, i]
  </code></pre>
  
  <p>This should give me the handle <code>control.winlist[0, i]=title</code> and <code>control.winlist[1, i] = handle</code>. ( funny that the arguments are reversed in autoitx)</p>
  
  <p>The first problem was that the return type of winlist is a string, and not a handle.</p>
  
  <p>So I did this</p>
  
  <pre><code>SendMessage(Marshal.StringToHGlobalUni( control.winlist[1, i]), 0x111, (IntPtr)419, IntPtr.Zero); 
  </code></pre>
  
  <p>First question where do I get those flags?</p>
  
  <p>I couldn't find any of them on msdn.</p>
  
  <p>Got those flags from this post => <a href="https://stackoverflow.com/questions/785054/minimizing-all-open-windows-in-c-sharp">Minimizing all open windows in C#</a></p>
  
  <p>Do you see any mistake? Because it didn't minimize at all. I'm not sure if I made a mistake with the flags or if the handle from autoit is wrong.</p>