Windows and Windows Forms - c

I need a window to receive/handle messages from a driver. Will creating a Windows Form in visual studio be same as creating window? Will the windows form do the thing I am trying to do?
What is the difference between windows form and window? Or Even WPF, does it suit my purpose or are windows/windows forms and wfp totally different?

I need a window to receive/handle messages from a driver. Will creating a Windows Form in visual studio be same as creating window? Will the windows form do the thing I am trying to do?
Yes, basically it will be the same. I think this article answers your question: http://msdn.microsoft.com/en-us/library/8bxxy49h(v=vs.80).aspx
With Windows Forms you develop smart clients. Smart clients are
graphically rich applications that are easy to deploy and update, can
work when they are connected to or disconnected from the Internet, and
can access resources on the local computer in a more secure manner
than traditional Windows-based applications.
And about the difference between WPF and WinForms you can read in this CodeProject#s article: http://www.codeproject.com/Articles/25795/Creating-the-Same-Program-in-Windows-Forms-and-WPF

Related

XAML vs WPF vs Store App vs Phone App vs UWA

I know that XAML is used for designing UI in combination with Blend. I am confused with so many terms, like, how XAML comes into play for WPF, Store App, Phone App or UWA. Morever, what is the difference between WPF, Store App, Phone App and UWA. Does all that means that old Desktop Project will no longer be used and replace by either WPF or Store App or UWA?
When .NET was released in ~2000, you could use WinForms to make desktop applications for Windows. It provides access to 'native' controls (i.e. A Button made in WinForms actually is a Windows Button control from user32.dll) by wrapping the Windows API in managed code. These can run in any version of Windows which has the appropriate .NET framework version installed, including upto Windows 10.
In 2006, WPF was released which is an alternative to WinForms. WPF uses XAML, which is a language based on XML, to declare the user interface elements. In a simple WPF app, the .xaml file describes the GUI and the code-behind file describes the logic. DirectX is used to draw whatever is described in the .xaml into the window.
Like Winforms, programs made using WPF can run in any version of Windows which has the appropriate .NET framework version installed, including upto Windows 10. Note that using XAML is completely optional. Whatever user interface elements you describe using XAML can also be made using your .NET language C# or VisualBasic.NET. But using XAML is usually simpler. See To XAML or not to XAML (MSDN Blogs).
From XAML (Wikipedia) :
As XAML is simply based on XML, developers and designers are able to share and edit content freely amongst themselves without requiring compilation.
From ~2012 along with Windows 8, a new kind of app called metro/modern/windows-8/windows-store-apps can be made. These apps are similar to WPF in that they use XAML for describing the GUI. These apps can run only in Windows 8, 8.1 and Windows 10. Windows 8.1 added some improvements and features but remained mostly the same. The same technology was used to make apps for Windows Phone.
With the release of Windows 10, Microsoft made UWP (Universal Windows Platform) through which you can use the same code base to target differnt kinds of devices (desktop/mobile/xbox/IoT/holographic). These apps made for the UWP are similar to the earlier Windows 8/8.1 apps. Like before, XAML is used to describe the GUI.
Only for the Windows Store apps, there is no backward compatibility. The timeline goes Windows 8 -> Windows 8.1 -> Windows 10/UWP. An app made in UWP can only run in Windows 10 and an app made in Windows 8.1 can not run in Windows 8.
I would highly recommend referring to this discussion thread in stopbyte, it has far more details and explanation of the concepts behind WPF, UWP And WinRT.
As for WinForms, from my experience it's history now. Have been almost replaced by WPF (though it still has mainstream support as mention by #Jazimov).
I'v noticed that Microsoft has stopped improving Windows Forms and probably has stopped maintaining it as well.

Possible to have Silverlight OOB App "Listen" for Keyboard Shortcut?

I'm building a Silverlight Out Of Browswer Application with Elevated Permissions and need the ability to basically have the application listen for a keyboard shortcut such as doing something like Ctrl + F10 will cause a window to take focus of the screen... Personally I am against stealing focus but feel that this is alright seeing as the user invokes it themselves.
So more background... if any of you are familiar with applications like XFire or Steam.. I'd like to the ability to do a keyboard shortcut and have a window open above all the other applications like Steam can with the in-game windows.
If Silverlight can't do this can someone point me towards a better language where I can create this sort of application?
If Silverlight can do this can someone point me in the direction of how to accomplish this?
Silverlight 4 can't do this and Silverlight is not a "Language". Any application developement platform (JAVA, Delphi, VB6, .NET) that has full access to the windows API could do it.
Silverlight 5 includes support for PInvoke so if your willing to wait for the RC to go to RTM then you may be able to hook the system level WinAPIs needed to watch for a hotkey.

Loading a WPF form into a MFC application without /clr

I am trying to integrate WPF into a legacy MFC application. I am unable to include the /clr switch to mix managed and unmanaged due to the restrictions of other projects in the solution. I need the WPF window open up as a child window in the main MFC application. I have been investigating different ways for the past two weeks but have hit roadblock with every implementation try. If anyone has successfully integrated this type of implementation, I would appreciate some direction. I have been able to integrate with a Win32 app, but could not translate this to an MFC app. Thanks everyone.
I believe that WPF requires .NET, therefore what you need is to create a separate DLL or EXE for the WPF parts. hat new project could be the container for .NET code and your main MFC would launch this separate project.
You can write a WPF front end that launches C++ apps with the desired command like switches, similar to what Visual Studio 2010 is doing to compile your code and show the results in the output pane. In this way you can avoid having to hack message loop code to support both frameworks .
You may show your Dialog using a COM interface

Winforms control spacing in Windows 7

We have an in-house .net 2.0 winforms app currently developed on Visual Studio 2005 in Windows XP. Everyone in the office until now is running Windows XP, and there are no issues.
We recently ordered a new computer with Windows 7 for one of our managers we were hoping to use, and the app installs fine. The issue is the spacing around every label, textbox, and button - making some forms not fit.
Is there some setting that we can use to make Windows 7 display each control where it is placed in our XP development environment and like the rest of our XP clients show?
Ugh, what kind of idiot management team gives a new machine to a manager instead of a programmer?
Control Panel + Display, Advanced tab, change the DPI setting to repro the problem on your XP machine. Read the docs for the Form.AutoScaleMode to find out what's going on.

WPF application on Citrix

I'm trying to use a WPF application on our Citrix server, and made a really simple window with a button and a textbox. When running the application, noting but the application name on top of the window is shown. Is it not possible to use WPF on Citrix, or is our Citrix server too old?
It should be possible to use WPF on Citrix starting with PS 4.5 Feature pack 1.
Is your version older than this?

Resources