tags:

views:

165

answers:

4

I am trying to find out if an EXE is a WPF app or a WinForms app. Any suggestions on how I can go about this?

I have heard that I could use the Reflector tool, if so how would this be done?

Thanks.

+1  A: 

Open it with reflector and see whether it references one of the PresentationFramework DLLs (then it's likely WPF) or System.Windows.Forms.dll. Note that applications might reference both - in that case, you can't really tell.

Maybe it's easier just from looking at the application. WPF applications are rendered smoother, even with standard controls.

OregonGhost
Yes if references both PresentationFramework and System.Windows.FormsThe reason I have asked this question is because my work have asked me to create a mockup app to demonstrate what we could do to our clients (no functionality) based on an app we already use (Which seems to be WPF). This app seems to have the Ribbon control and also a rollup menu control. Its very smooth.
JamesM
Just had another idea, which is not really an answer to the original question though. You could start the app and examine it with Windows UI Automation (UISpy supplied with the Windows SDK) and look for typical WPF features. But, anyway, now CraigD gave you a good solution that will likely work in most circumstances, unless the user made something to disguise the app (or it's a legacy app that is being ported from SWF to WPF).
OregonGhost
+1  A: 

Generally one dead give away is that WPF applications tend to have a different looking focus rectangle on focused items such as buttons or listboxes. The standard Windows focus rectangle is 1px wide and on WPF apps it seems to just look... different.

Also, WPF apps render most elements to memory bitmaps whenever they need to perform some kind of animation and this results in a "fuzzy", almost anitaliased look whenever the particular animation takes place and is displayed onscreen. This effect is noticed in things like, menu highlights, scrolling or general button text after you click.

Mike J
+1  A: 

Although generally an application can be classed as 'either' a WPF or WinForms application, interoperability is possible such that a WinForms app can 'host' WPF controls and vice-versa. Since your application sounds like it references both sets of assemblies, it could be using both. Just something to be aware of.

Anyway, I've just opened one of my WPF projects in Reflector and some obvious indications it's a WPF application are:

1) There is an App class that has a StartupUri which is a Xaml file (like this)

public class App : System.Windows.Application
{
    // Methods
    [DebuggerNonUserCode]
    public void InitializeComponent()
    {
        base.StartupUri = new Uri("Window1.xaml", UriKind.Relative);
    }

2) There is a XamlGeneratedNamespace in the EXE

3) In the Resources 'folder' there are .baml files (probably within <Application1>.g.resources).

4) The window classes (if you can find them easily in the Reflector tree) implement:

public class Window1 : System.Windows.Window
, System.Windows.Markup.IComponentConnector {

If you really want to trawl through Reflector in detail, WinForms windows will inherit from System.Windows.Forms.Form so you can easily spot if you have both WinForms and WPF in there.

CraigD
A: 

You can check the .exe with code, you do not need Reflector.

Simply find a type in the .exe assembly which inherits from the System.Windows.Application class which is from the PresentationFramework dll (you can do it with reflection).

Now, this isn't a 100% sure method, since theoretically someone could be creating a class which inherits from the wpf Application class, and then not start the app. The definite way is to check in Reflector if that class' Run() method is called.

And the programmatic way to check if the current application in which your code is running is a wpf app is like this:

public static bool IsWpfApplication
{
    get { return System.Windows.Application.Current != null; }
}
kek444