<<

CS-360 Course Information GUI & Windows Programming ? Office: EB-N6 ? Phone: 777-4365 Dr. Richard . Eckert ? Office Hours: ? T 10:00-11:30 A.M. Computer Science Department ? W 2:30-3:30 .M. SUNY Binghamton ? Email: reckert @binghamton.edu ? http://www.cs.binghamton.edu/~reckert / Fall, 2005 ? CS-360 link for syllabus, notes, programs, assignments, etc. Section 01: MWF, 8:30-9:30 A.M. ? Class Listservs: Section 02: MWF, 1:10-2:10 P.M. ? [email protected] SL-302 ? [email protected] ? TA Information: TBA

Course Prerequisites Text Book Information

? Required: ? Deitel, et.al., “# for Experienced ”, ? CS-240, Data Structures PH/Pearson, 2003, ISBN 0-13-046133-4 ? Knowledge of C or C++ ? 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 ? Many Books on Reserve ? See Reserve List on Course Syllabus

Software Evaluation ? Visual Studio .NET (2003) ? Available at University public computer facilities ? Get your own copy ? Programming Assignments 45% ? From Microsoft Academic Alliance ? Term Examinations (2) 40% • All registered BU students • Will be made accessible after “Add/Drop” deadline ? Final Project 15% ? Also comes with Bradley & Millspaugh book ? Microsoft ASP.NET Web Matrix ? Available at University public computer facilities ? Free from Microsoft ? asp.net/webmatrix ? Microsoft Visual Web Developer Express (Beta) ? Free from Microsoft

1 Policies Course Schedule (weekly) ? Assignments ? Individual 1. Intro to GUIs & Windows Programming ? Due on due date, but can be turned in to CS-360 2. Using Visual Studio,Win32 API Programming drop drawer outside CS Department any time 3. MFC Programming: App/ & Doc/View that day or night Approaches ? 5% off for every day late 4. Visual Studio .NET & C#, , Events, Essential Structures ? Weekends and holidays not included 5. Graphics, Animation, Timers, DateTime ? No assignments accepted more than one week 6. Mouse, Images, Bitmaps late 7. Text, Fonts, Keyboard, Printing ? Originality 8. Pages & Transformations, Menus ? Any work found to be copied will be grounds for an F in the course

Course Schedule (continued) Introduction To GUIs and 9. Controls: Buttons, Labels, TextBoxes, , Windows Programming Listboxes 10. Dialog Boxes, Common Dialog Boxes, File/Stream I/O 11. Clipboard, Multimedia 12. Network Programming, TCP/IP Sockets 13. Data Bases and ADO.NET, Web Matrix 14. XML, Web Forms, Web Controls, ASP.NET 15. ASP.NET Web Services 16. The

User Interfaces Command Line Interfaces ?User types commands ==> must ?Connection between the computer and remember the user ?Results Scroll by ?Two types: ?Text-based ?Command Line ? ?GUI--Graphical (Visual) “Interactive” but hard to use ?No direct interaction between user and screen

2 Visual (Graphical) Interfaces

? Show Graphical Objects on screen Graphical Interfaces, Continued ? e.g., images, icons, buttons, scroll bars ? Use graphics to organize user ? User interacts using pointing device ? Environment allows many tasks to be ? Intuitive performed simultaneously ? Objects can be dragged, buttons pushed, etc.... ? Different tasks share screen space ? Better way of using screen space ? ? Panes can overlap Visually rich way of conveying information ? Underlying panes can be brought to forefront ? WYSIWYG display of documents ? Desktop metaphor (like papers on a desk)

? Well, not exactly!

Main Feature of GUIs History of GUIs

?The Window ? 1968: DARPA-funded Stanford Research Institute (Doug Engelbart ) ?Rectangular area of screen onto a program draws text and graphics. ? First windows (screen sliced up into overlapping panes) ?User interacts with program using ? Only textual information pointer device to select objects inside. ? Underlying windows could be popped to the top ?Some window components: ? Selection done with light pen ? border, title bar, client area, menu bar, tool bars, scroll bars, max/min/close buttons, ? Invented the mouse etc.

Xerox PARC--Alto Computer Recent History (PCs)

? 1970s ? 1977: First “Personal Microcomputers: ? Radio Shack TRS-80, Commodore Pet, Apple II ? First GUI ? 1981: IBM PC, DOS ? tracked position of mouse ? 1983: Apple Lisa (failure) ? WYSIWYG ? 1984: Apple --standard for GUIs ? Windows with precise text ? 1985: Microsoft released Windows 1.0 ? Displayed more than just text ? Difficult to program ? First interactive painting program ? Prone to crashing ? “acquired” by Apple ? Needed hardware not yet available ? Wozniak & Jobs … Gates ? 1987: Windows 2.0 ? Book: “Fire in the Valley” ? 1988: Windows/386 (Virtual 86 on ? Movie: “Pirates of Silicon Valley” 386==>multiple DOS sessions in windows)

3 Recent History (Microsoft) Recent History (Microsoft) ? 1995: ? 1990: Windows 3.0 ? Ran on 4 Meg, long file names, plug and play, new ? 80x86 protected mode, up to 16 Meg memory, controls, new desktop/window style cooperative multitasking ? Hybrid 16/32 bit OS, depended on DOS, lacked security of NT ? 1992: Windows 3.1, Windows for ? 1998: Workgroups 3.11 ? Integrated Web functionality ? TrueType fonts, multimedia, protected mode ? 2000-present: , ME, XP, 2003 Server only; Networking ? Upgrades of 95-98-NT ? 95 ? 98 ? ME ?XP Home: for home use ? 1993: Windows NT ? NT ? 2000 ? XP Pro ? 2003 Server: for businesses ? 32-bit flat memory space, 16 MB, -based ? XP, 2003 Server: pre-emptive multitasking, separate from DOS, ? 64-bit capability; Fancier user ; latest multimedia (DVD); upgraded web capabilities; improved File/directory services, multi-platform, networking, secure) improved help (remote); improved performance & security; Microsoft .NET Framework SDK built into 2003 Server.

The Microsoft .NET Initiative (2000) Microsoft .NET Framework (2000) ? Only system that addresses new requirements ? st Requirements for 21 Century Software ? Windows Forms for standalone Windows applications Development: ? New paradigm for Windows distributed applications ? Internet, WWW, and Intranet - awareness • ASP.NET -- web applications and services • ADO.NET -- data base integration ? Universal representation of: ? Independent of language ? software models (UML) • Applications developed in any .NET compatible language ? and data (XML) – , Visual C++, C#, J#, many more ? Enhanced security and reliability • Programmers use language in which they are most competent ? Integration of various programming languages and ? Architecture can exist on multiple platforms tools, , knowledge bases and networking tools ? New program development into a single infrastructure • Provides increased productivity • Vision for using the Internet in ? Design and development of reusable software ? New way of designing & creating applications that share work components between components (local and distributed over the internet)

? New security and reliability features

Other GUI-Windowing Systems Course Content

? IBM OS/2: Presentation Manager ? Visual Studio .NET ? : ? Using Microsoft Developer Studio (Visual Studio .NET) ? AWT ? Win32 API Programming and MFC Programming ? using Visual C++ ? Platform independent ? The .NET Framework: Programming Windows Forms, ? JDK is free Web Applications, Web Services, and Data Base ? The X Window System Applications using C# ? Developed at MIT, late 1980s ? Introduction to X-Windows Programming ? Networked graphics programming interface ? Example programs and notes online at: ? http://www.cs.binghamton.edu/~reckert/ ? Independent of machine architecture/OS (but ? “CS-360” link most used under )

4 Windowing Systems Features Multitasking ?Consistent ? Display within a window ? Menus to initiate program functions ? Every program acts like a popup ? use of child window “controls”: ? Programs run “simultaneously” ? Programs have same look and feel ? Each program occupies its own window ? Same built-in logic to: ? User interacts with program in its window ? draw text/graphics ? display menus ? User can switch between programs ? receive user input ?controls, dialog boxes, use of mouse

Windows Multitasking Features Windows Memory Management ? Older versions: 16-bit, segmented memory ? Dictated by processor architecture ? Cooperative (Windows 3.xx) ? Hard to program ? Programs must give up control so others can run ? Newer versions: 32-bit, flat memory model ? Programs coexist with other programs ? Easier to program ? Preemptive (Windows NT, 95, 98, XP, 2000) ? As old programs terminate, new ones ? Thread-based: System timer allocates time slices to running program threads ? Code swapped into and out of memory ? Windows OS does this automatically ? Under both systems, code is moved or swapped into and out of memory as needed ? Programs can share code located in other files (Dynamic Linking)

Static vs. Dynamic Linking

? Static Linking ? Code incorporated into executable at link time ? Dynamic Linking ? Code is put into separate modules (DLLs) ? These are loaded at run time as needed ? Linker generates relocation information ? Only that is put into executable ? Smaller programs ? DLL loaded when needed ? Relocation info used to get DLL function code as needed

5 Pros/Cons of Dynamic Linking

? Smaller programs (code is not in program) ? DLL can be used by many programs with no memory penalty ? Only loaded once! ? Disadvantages: ? DLL must be present at run time ==> no standalone programs ? “DLL Hell” when new versions come out ? Most of the Windows OS is implemented in DLLs

Device Independent Graphics Windows API ? Application Program Interface ? Windows programs don’t access hardware devices directly ? The interface between an application and ? Make calls to generic functions within the Windows Windows ‘Graphics Device Interface’ (GDI) ? A of functions Windows programs ? The GDI translates these into HW commands can call ? Several versions Program GDI Hardware ? Win32 APImost important ?(32 bit apps for Windows NT/95/98/XP/2000/2003)

Classical Win32 API Windows Class-based Windows Programming programming ? “Microsoft Foundation Class” Library (MFC) ? Use C to access raw API functions directly ? Microsoft .NET “Framework Class Library” ? No C++ class library wrappers to hide API (FCL) ? But C++ can be used ? ’s “Object Window Library” (OWL) ? Hard way to go, but most ? Faster executables ? Characteristics: ? Encapsulate the API functions into classes ? Provides understanding of how Windows and application program interact ? Provide a logical framework for building Windows applications ? Establishes a firm foundation for MFC and .NET programming ? Object Orientation means reusable code

6 MFC Library

? Microsoft’s 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 ? Or derive your own classes from MFC classes ? Provides a uniform

Microsoft Visual Studio Microsoft .NET Framework ? Developer Studio IDE ? 3 Windows application development systems ? What is it? ? C/C++ programs using Win32 API ? A platform to run code on ? C++ programs using MFC ? Multiple language ? Multilanguage program development using .NET ? (CLR) & the CLR ? Compiler, execution management, much more ? A class library of code that can be used from any ? Some Developer Studio IDE Components language (FCL) ? Text/Resource Editors ? Must be installed to run .NET applications ? C, C++, C#, Visual Basic, J#, etc. Language Compilers ? You can get it and Visual Studio free from the ? Resource Compilers Watson School Microsoft Academic Alliance ? Linker ? It’s huge! ? ? Wizards ? On-line Help ? Details later

.NET Framework Components of .NET Framework ? Platform for developing distributed applications for the Internet ? Language compilers ? Design Goals: ? The .NET Framework Class Library (FCL) ? Provide high degree of language interoperability ? Organized into “” (like packages in Java) ? Provide a managed runtime environment ? things like: Data, IO (simple & file), Windows ? Provide simple software deployment & versioning Forms, Web Forms, Windows Controls, User ? Provide high-level code security through code access Interfaces, Drawing, Threading, Exceptions, security & strong checking Networking, Web Services, Data Bases (ADO), XML, ? Provide consistent object-oriented programming model ASP, Security, Collections, … lots of others ? Facilitate application communication by using industry ? (CTS) standards such as SOAP & XML ? Common Language Specification (CLS) ? Simplify with ASP .NET ? Common Language Runtime (CLR) ? Facilitate Data Base access with ADO .NET ? Provide high performance and easy scalability

7 .NET Architecture Compilation in the .NET Framework

.NET Framework and the Common Language Runtime Sequential Programming ? Why two compilations? ? Platform independence versus ? .NET Framework can be installed on different platforms Event-driven Programming ? Execute .NET programs without any modifications to code ? E.g., “”: A .NET Development System Project for ? Microsoft SSCLI (“Rotor”) free academic version of .NET ? Language independence ? .NET programs not tied to a particular language ? Programs may consist of several .NET-compliant languages ? Old and new components can be integrated ? Other advantages of CLR ? Execution-management features ? Manages memory, security and other features • Relieves of many responsibilities • More concentration on program logic

Sequential Programming (Console Event-Driven Programming Applications)

? Standard programming--program solicits input ? Designed to avoid limitations of sequential, (polling loop) procedure-driven methodologies ? Approach follows a structured sequence of events ? OS processes user actions (events) as they happen: ? Example--averaging grades: non-sequential ? Program doesn’t solicit input ? Input name ? Input first grade ? OS detects an event has happened (e.g.., there’s input) and sends a message to the program ? Input second grade ? ? Input third grade, etc. Program then acts on the message ? ? Calculate average Messages can occur in any order ? Output average

8 Sequential vs. Event-Driven Programming

? Standard Sequential programming: ? Program does something & user responds ? Program controls user ? the tail wags the dog ? Event-Driven Programming: ? Used by Windows ? User does something and program responds ? User can act at any time ? User controls program ? the dog wags the tail ? OS really is in control (coordinates message flow to different applications) ? Good for apps with lots of user intervention

9