EDIT: Just realized this should belong to C# section, sorry mods 
Everything seems to work fine with notepad, but for wow it doesnt...
I'm using this:
Code:
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("User32.Dll", EntryPoint = "PostMessageA")]
static extern bool PostMessage(IntPtr hWnd, uint msg, uint wParam, int lParam);
[DllImport("user32.dll")]
static extern byte VkKeyScan(char ch);
IntPtr hWnd;
private void GetWowWindowHandle()
{
Process[] procs = Process.GetProcessesByName("Wow");
foreach (Process proc in procs)
{
if (proc.MainWindowTitle == "World of Warcraft")
{
hWnd = FindWindowEx(proc.MainWindowHandle, IntPtr.Zero, null, null);
}
}
}
The window handle just gives "0"...
It's pretty odd because,
Code:
Process[] procs = Process.GetProcessesByName("WoW");
foreach (Process proc in procs)
{
button3.Text = proc.MainWindowTitle.ToString();
}
returns World of Warcraft...
Anyone that can point me out what i'm doing wrong?