CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC –...

13
CS360/CS580H GUI & Windows Programming

Transcript of CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC –...

Page 1: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

CS360/CS580H

GUI & Windows Programming

Page 2: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

Outline

• Win32/Windows API & SDK• Visual Studio• MFC – Microsoft Foundation Classes• C# & .NET – concepts• Windows Forms• WPF - Windows Presentation Foundation

(DirectX+XAML based) RTL included (post-Vista)

• WPF controls are OK in a WinForms app & vice-versa– This is a 2nd API (based on .NET 2.0)

Page 3: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

Win32 = Windows API

• Basic windows functions• Messages from use/system – (mouse-click, close, etc.)

• Usable with C/C++• Programmer must do almost everything• Used with the Windows SDK

Page 4: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

WinAPI Programs

• WinMain– Primary entry point from OS– 3 parts

• Procedure definition• Init• Message processing loop

• WinProc– Performs actions to process messages

Page 5: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

Windows Messages

• Mechanism for system/user event triggering• Requires a "callback" mechanism– O/S calls your functions– Reverse of a "system call"

• Message processing loop in program– Tests for message types– Calls your handler functions

• Program is idle until an event

Page 6: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

Windows Forms

• GUI part of .NET Framework• Does not offer a paradigm comparable to

Model–View–Controller of C++ with MFC• Event driven

Page 7: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

MFC

• A class library• Contains portions of the Win32API• Classes contain pre-written code to do things like:– Create/Open/close a window– Open a dialog box– Independent of user settings

Page 8: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

MFC programs

• InitInstance– Primary entry point

• _tWinMain• WndProc

Page 9: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

WPF (Windows Presentation Foundation) (V4.5 – Aug 2012 – may be the last version)

• 1st release in 2005• Implements SOAP & non-MS web svc's tech's.• DirectX vs. older GDI interface• XAML (based on XML)• Standalone apps• Embedded objects on a website• RTL included in all Windows post-XP• Unifies

– Rendering, typography, vector graphics, animation, fixed, adaptive & pre-rendered docs, events, bindings

• Poor response-time, not for low-power devices

Page 10: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

What is .NET

• From MS, “.NET is the Microsoft Web services strategy” for connecting programs, people, devices, etc.

• 4 components:– Common Language Specification (CLS)– Framework Class Library (FCL) – Common Language Runtime (CLR)– .NET Tools

Page 11: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

Common Language Specification

• Common Language Specification– Provides a consistent means for inter-language

communication– Allows sub-components to be in different languages, e.g.;

C#, VB.Net, J#, F#, Managed C++

Page 12: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

.NET (3.0) stack

.NET Apps .NET Tools

CLR, Base Class Libraries, ASP.NET, ASO.NET, WinForms

WPF CardSpace(InfoCard)Canceled!

WF(Workflow)

Windows

Page 13: CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.

Deploying .NET Framework Apps

• Distinguish between the app and the Framework• http://msdn.microsoft.com/en-us/library/6hbb4k3e(

v=vs.110).aspx• http://support.microsoft.com/kb/818016