I have two projects (TestVisual and RecordPlayBack). TestVisual has two windows (MainWindow and TestWindow). I can get the TestWindow instance by using below code,
var windows = System.Windows.Application.Current.Windows;
IntPtr twHandle = new System.Windows.Interop.WindowInteropHelper(windows[2]).Handle;
Now, i run the RecordPlayBack.exe from TestVisual.wpf application. So, the Application.Current holds RecordPlayBack application where the TestWindow is not available. In this case, how to get the TestWindow instance of TestVisual application?
i have tried this below code,
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
IntPtr twHandle =(IntPtr) User32.FindWindow("test", null);
Please suggest me any ideas.
Note: RecordPlayBack project is added as referrence to TestVisual project.
Thanks,