0

I want to get all opened windows (WPF) and forms (WF) of my Mixed-application. There is a method called Application.Current.Windows ... but its only returning the WPF Windows.

Note: The Windows Forms are stored in an other project (DLL) in the solution.

3 Answers 3

2

You can access Windows Forms' open forms via the System.Windows.Forms.Application.OpenForms static property. The property is contained in the System.Windows.Forms.dll assembly, so you will need a reference to it.

(IIRC, this property only returns the forms that were created on the current thread; therefore, if you have two separate UI threads (one for Windows Forms, one for WPF), I believe you need to call the property on Windows Forms' UI thread.)

Sign up to request clarification or add additional context in comments.

Comments

0

Check this msdn Hope you find what your looking for. it also has example.

http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.applicationservices.windowsformsapplicationbase.openforms%28v=vs.110%29.aspx

1 Comment

This is rather VB.NET specific, and this question is tagged C#. Even if it can be made to work in a C# application, it's more work than strictly required: You will have to somehow get a reference to a WindowsFormsApplicationBase object before you can access its OpenForms property. But there is a similar static property that doesn't rely on WindowsFormsApplicationBase at all; see my answer.
0

For this you have to use

                foreach (Window win in System.Windows.Application.Current.Windows)
    {
       win..title;
    }  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.