Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between WPF and Winform in terms of windows messages and OS

I wanted to know if there is any difference between the applications developed using WPF and Winform applications in terms of windows. Does both types of applications considered same in windows operating system and it is just the way they are developed ? OR There are some fundamental difference between them when it comes down on how each application window and its children are drawn on the screen.

I am particularly interested to know

  • if there exist the same concepts of windows messages window handles etc.
  • The ON_PAINT event is triggered the same way in both types of applications
  • In terms of UI Automation, if we are trying to run an UIA client application, do we get any difference in controls from each type of application.

I am not looking for the information about how we do development in WPF or WF, or there is XAML in WPF where we specify what UI elements we need and how we need them.

like image 596
ResVic Avatar asked Apr 29 '14 09:04

ResVic


1 Answers

The answer is yes. If you are running an application in windows and you spawn a new window, windows messages are involved. This is how the operating system notifies your application of event. This is common desktop behavior and is just how windows works.

WPF acts slightly differently in response to the render events due to the rendering method (the name of which i forget...). WPF makes use of directx to draw to a graphics surface that is bound to a windows client area. Winforms draws to a GDI+ surface provided by windows.

Retrieving the window handle and subscribing to additional (usb device changed, etc) window messages is different™ and requires a bit of fiddling.

UI automation works how you would expect but expect slightly different control names and much deeper graphs than you often get in winforms.

like image 125
Gusdor Avatar answered Oct 08 '22 04:10

Gusdor