1

I'm creating a windowarranger with C# and autoitX. I tried it with C# only but I couldn't get the correct handles.

But I worked in autoit so I thought I just use the autoitX dll to get the handles.

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.

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.

control.winlist[1, i]

This should give me the handle control.winlist[0, i]=title and control.winlist[1, i] = handle. ( funny that the arguments are reversed in autoitx)

The first problem was that the return type of winlist is a string, and not a handle.

So I did this

SendMessage(Marshal.StringToHGlobalUni( control.winlist[1, i]), 0x111, (IntPtr)419, IntPtr.Zero); 

First question where do I get those flags?

I couldn't find any of them on msdn.

Got those flags from this post => Minimizing all open windows in C#

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.

user4157124
  • 2,809
  • 13
  • 27
  • 42
Maik Klein
  • 15,548
  • 27
  • 101
  • 197
  • 2
    You don't appear to be doing anything that AutoIT on its own couldn't handle. Why go through the pain of COM interop with .NET if it isn't necessary? As an alternative you may want to consider looking into other open source projects that achieve roughly the same thing to see how it is done. One such is the [Dual Monitor Taskbar](http://sourceforge.net/projects/dualmonitortb/) project. – M.Babcock Jan 11 '12 at 21:27

0 Answers0