I want to open from c# an application (standalone flashplayer) and set it position to (0,0) on the screen. How can I do this? So far I've managed to open flashplayer:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace swflauncher
{
class Program
{
static void Main(string[] args)
{
Process flash = new Process();
flash.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
flash.StartInfo.FileName = "D:\\development\\flex4\\runtimes\\player\\10\\win\\FlashPlayer.exe";
flash.Start();
}
}
}
In Windows 10, 8, 7, and Vista, hold down the “Shift” key while right-clicking the program in the taskbar, then select “Move“. In Windows XP, right-click the item in the task-bar and select “Move“. In some instances, you may have to select “Restore“, then go back and select “Move“.
This can be done by holding the Shift key and right-clicking the program's taskbar icon. Select Move from the menu that appears, and begin pressing the arrow keys to force the window to move position.
After doing a little digging, try the following: Right click on the program's "icon" on the taskbar. Select Move. Use the keyboard arrows to move the window to the position you want.
thanks guys, it's working now! :)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
namespace swflauncher
{
class Program
{
static void Main(string[] args)
{
Process flash = new Process();
flash.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
flash.StartInfo.FileName = "D:\\development\\flex4\\runtimes\\player\\10\\win\\FlashPlayer.exe";
flash.Start();
Thread.Sleep(100);
IntPtr id = flash.MainWindowHandle;
Console.Write(id);
Program.MoveWindow(flash.MainWindowHandle, 0, 0, 500, 500, true);
}
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With