   [.net] Sending messages to other applications
  Hey,I'd like to send messages like maximize, minimize etc. to other applications or retrieve information like position etc. from them. Is there a way of achieving this?THX in advance   
  I'm not sure if this helps but in Visual Basic there was a SendKeys("") function.This meant you could access the menus etc.ace   ;  I think you'll have to use interop and import the SendMessage function from user32.dll.  Here's source code to import the function (in C#):using System.Runtime.InteropServices;...[DllImport("user32.dll")]public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);You'll have to look up documentation on the messages to find out what number corresponds to what message.  This page seems to have a good list of common ones.   ;  THX for these quick replies.One more question: Is there a way of retrieving a list of currently opened applications?;using System.Diagnostics;...Process[] apps = Process.GetProcesses();Use the MainWindowHandle property of Process to get the process's main window handle, if any.   ;  Here's some code to same you some time://Win32 constantsprivate const int SW_SHOWMINIMIZED = 0x02;private const int WM_SYSCOMMAND = 0x0112;private const int SC_CLOSE = 0xF060;//Imported functions[DllImport("user32.dll")]private static extern IntPtr GetForegroundWindow();[DllImport("user32.dll", CharSet=CharSet.Auto)]public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);[DllImport("user32.dll")]private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);[DllImport("user32.dll")]private static extern IntPtr GetAncestor(IntPtr hWnd, int gaFlags);[DllImport("user32.dll")]private static extern IntPtr GetWindow(IntPtr hWnd, int gwFlags);//Custom functions to affect foreground windowprivate IntPtr GetTopWindow(IntPtr hWnd){IntPtr ReturnHwnd = hWnd;IntPtr RootHwnd = GetAncestor( hWnd, GA_ROOT );if (RootHwnd != IntPtr.Zero){ReturnHwnd = GetWindow(RootHwnd, GW_OWNER);}if (ReturnHwnd == IntPtr.Zero){ReturnHwnd = RootHwnd;}return (ReturnHwnd);}public void MinimizeForegroundWindow(){ShowWindow( GetTopWindow( GetForegroundWindow() ) , SW_SHOWMINIMIZED );}public void CloseForegroundWindow(Hashtable Properties){SendMessage(  GetTopWindow( GetForegroundWindow() ), WM_SYSCOMMAND, SC_CLOSE, 0 );}Using the GetTopWindow function I made up is important.  Without it, programs like Visual Studio minimize right above the task bar.  Also, Explorer windows seem to only close their innards and then lock.  I'm not sure why exactly this works the way it does, but it certainly does.  Hope this helps.   