Introduction To GUIs and Windows Programming
Introduction To GUIs and Windows Programming
Course Information
? ? ?
? ?
Section 01: MWF, 8:30-9:30 A.M. Section 02: MWF, 1:10-2:10 P.M. SL-302
CS-360 link for syllabus, notes, programs, assignments, etc. CS360-01@listserv.binghamton.edu CS360-02@listserv.binghamton.edu
Class Listservs:
? ?
TA Information: TBA
Course Prerequisites
CS-240, Data Structures ? Knowledge of C or C++
?
Required:
? Deitel,
Recommended:
? Kate
Gregory, Special Edition Visual C++ 6 .NET, Que, 2002, ISBN 0-7887-2466-9 ? Bradley & Millspaugh, Programming in C# .NET, McGraw-Hill, 2004, ISBN 0-07-121564-6
?
Software
?
Evaluation
Programming Assignments Term Examinations (2) ? Final Project
? ?
asp.net/webmatrix
Policies
?
Assignments
? Individual ? Due
on due date, but can be turned in to CS-360 drop drawer outside CS Department any time that day or night ? 5% off for every day late
? Weekends
? No
assignments accepted more than one week late work found to be copied will be grounds for an F in the course
Originality
? Any
User Interfaces
? Connection
Line (Visual)
? GUI--Graphical
types commands ==> must remember ? Results Scroll by ? Text-based ? Interactive but hard to use ? No direct interaction between user and screen
can overlap panes can be brought to forefront ? Desktop metaphor (like papers on a desk)
? Underlying
? Well,
not exactly!
program draws text and graphics. interacts with program using pointer device to select objects inside . ? Some window components:
? User
? border,
title bar, client area, menu bar, tool bars, scroll bars, max/min/close buttons, etc.
1970s First GUI Cursor tracked position of mouse WYSIWYG Windows with precise text Displayed more than just text First interactive painting program Technology acquired by Apple
?
? ?
of Silicon Valley
1981: IBM PC, DOS 1983: Apple Lisa (failure) 1984: Apple Macintosh--standard for GUIs 1985: Microsoft released Windows 1.0 ? Difficult to program ? Prone to crashing ? Needed hardware not yet available 1987: Windows 2.0 1988: Windows/386 (Virtual 86 mode on 386==>multiple DOS sessions in windows)
1995: Windows 95
?
cooperative multitasking
?
Ran on 4 Meg, long file names, plug and play, new controls, new desktop/window style ? Hybrid 16/32 bit OS, depended on DOS, lacked security of NT
? ?
1998: Windows 98
?
TrueType fonts, multimedia, protected mode only; Networking flat memory space, 16 MB, thread-based pre-emptive multitasking, separate from DOS, multi-platform, networking, secure)
1993: Windows NT
? 32-bit
?
95 ? 98 ? ME ?XP Home: for home use NT ? 2000 ? XP Pro ? 2003 Server: for businesses 64-bit capability; Fancier user interface; latest multimedia (DVD); upgraded web capabilities; improved File/directory services, improved help (remote); improved performance & security; Microsoft .NET Framework SDK built into 2003 Server.
Windows Forms for standalone Windows applications New paradigm for Windows distributed applications
ASP.NET -- web applications and services ADO.NET -- data base integration
Independent of language
Applications developed in any .NET compatible language Visual Basic, Visual C++, C#, J#, many more Programmers use language in which they are most competent
? ?
Enhanced security and reliability Integration of various programming languages and tools, databases, knowledge bases and networking tools into a single infrastructure Design and development of reusable software components
? ?
New way of designing & creating applications that share work between components (local and distributed over the internet) New security and reliability features
Course Content
?
Using Microsoft Developer Studio (Visual Studio .NET) ? Win32 API Programming and MFC Programming using Visual C++ ? The .NET Framework: Programming Windows Forms, Web Applications, Web Services, and Data Base Applications using C#
? ?
at MIT, late 1980s graphics programming interface ? Independent of machine architecture/OS (but most used under UNIX)
? Networked
Multitasking
Every program acts like a popup ? Programs run simultaneously ? Each program occupies its own window
?
? User
user interface
Display within a window Menus to initiate program functions ? Make use of child window controls:
? ?
Programs have same look and feel Same built-in logic to: ? draw text/graphics ? display menus ? receive user input ? controls, dialog boxes, use of mouse
Dictated by processor architecture Hard to program Easier to program Code swapped into and out of memory Windows OS does this automatically
must give up control so others can run ? Programs coexist with other programs
?
Under both systems, code is moved or swapped into and out of memory as needed
Static Linking
?
Code incorporated into executable at link time Code is put into separate modules (DLLs)
?
Dynamic Linking
? ?
These are loaded at run time as needed Only that is put into executable Smaller programs
? ?
DLL loaded when needed Relocation info used to get DLL function code as needed
Smaller programs (code is not in program) DLL can be used by many programs with no memory penalty
?
Disadvantages:
?
DLL must be present at run time ==> no standalone programs ? DLL Hell when new versions come out
?
Windows API
Application Program Interface ? The interface between an application and Windows ? A library of functions Windows programs can call ? Several versions
?
? Win32 ? (32
Windows programs dont access hardware devices directly Make calls to generic functions within the Windows Graphics Device Interface (GDI) The GDI translates these into HW commands
Program
GDI
Hardware
Use C to access raw API functions directly No C++ class library wrappers to hide API
?
Hard way to go, but most basic Faster executables Provides understanding of how Windows and application program interact Establishes a firm foundation for MFC and .NET programming
? ?
Microsoft Foundation Class Library (MFC) Microsoft .NET Framework Class Library (FCL) Borlands Object Window Library (OWL) Characteristics:
? ?
Provide a logical framework for building Windows applications ? Object Orientation means reusable code
MFC Library
? ? ? ? ? ?
Microsofts C++ Interface to Win32 API O-O Approach to Windows Programming Some 200 classes API functions encapsulated in the MFC Classes derived from MFC do grunt work Just add data/functions to customize app
?
What is it?
? ?
C/C++ programs using Win32 API ? C++ programs using MFC ? Multilanguage program development using .NET Framework Class Library & the CLR
?
A platform to run code on Multiple language compilers ? Common Language Runtime (CLR)
?
Text/Resource Editors C, C++, C#, Visual Basic, J#, etc. Language Compilers ? Resource Compilers ? Linker ? Debugger ? Wizards ? On-line Help
?
A class library of code that can be used from any language (FCL) ? Must be installed to run .NET applications
?
You can get it and Visual Studio free from the Watson School Microsoft Academic Alliance
?
Its huge!
Details later
.NET Framework
? ?
Platform for developing distributed applications for the Internet Design Goals:
? ?
Provide high degree of language interoperability Provide a managed runtime environment ? Provide simple software deployment & versioning ? Provide high-level code security through code access security & strong type checking ? Provide consistent object-oriented programming model ? Facilitate application communication by using industry standards such as SOAP & XML ? Simplify Web development with ASP .NET ? Facilitate Data Base access with ADO .NET ? Provide high performance and easy scalability
Organized into namespaces (like packages in Java) Handle things like: Data, IO (simple & file), Windows Forms, Web Forms, Windows Controls, User Interfaces, Drawing, Threading, Exceptions, Networking, Web Services, Data Bases (ADO), XML, ASP, Security, Collections, lots of others
? ? ?
Common Type System (CTS) Common Language Specification (CLS) Common Language Runtime (CLR)
.NET Architecture
Platform independence
? ? ? ?
.NET Framework can be installed on different platforms Execute .NET programs without any modifications to code E.g., Mono: A .NET Development System Project for LINUX Microsoft SSCLI (Rotor) free academic version of .NET .NET programs not tied to a particular language Programs may consist of several .NET-compliant languages Old and new components can be integrated
Language independence
? ? ?
Execution-management features
?
Event-Driven Programming
? ? ? ? ? ?
? ?
Standard programming--program solicits input (polling loop) Approach follows a structured sequence of events Example--averaging grades:
? ? ?
Designed to avoid limitations of sequential, procedure-driven methodologies OS processes user actions (events) as they happen: non-sequential Program doesnt solicit input OS detects an event has happened (e.g.., theres input) and sends a message to the program Program then acts on the message Messages can occur in any order
Event-Driven Programming:
? ?
Used by Windows User does something and program responds ? User can act at any time ? User controls program
?
OS really is in control (coordinates message flow to different applications) ? Good for apps with lots of user intervention