using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
public class WinApi
{
[DllImport("user32.dll")]
public static extern int FindWindow(string ClassName, string WindowName);
[DllImport("user32.dll")]
public static extern uint GetWindowThreadProcessId(int hWnd, out int PID);
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string name = "iGoogle - Mozilla Firefox";
int handle = WinApi.FindWindow(null, name);
int PID = 0;
WinApi.GetWindowThreadProcessId(handle, out PID);
System.Diagnostics.Process proc = System.Diagnostics.Process.GetProcessById(PID);
SetForegroundWindow(proc.MainWindowHandle);
}
}
}
takie cos mi dziala ale tylko wtedy jak jest wlaczone na zakladce goole jak przelacze na inna to juz nie
zna ktos na to sposob ??
pzdr Andrzej