1 / 20

Cours e Information • Office : EB - N6 • Phone : 777 -4365

CS-360/580H GU I & Window s Programming Dr . Richar d R . Eckert Compute r Scienc e Department SUN Y Binghamton Fall , 2009 C S -360: MWF, 1:10- 2:1 0 P.M. , S L -210 C S -580H: TR, 8:30- 9:5 5 A.M. , S W -325. Cours e Information • Office : EB - N6 • Phone : 777 -4365

cadee
Download Presentation

Cours e Information • Office : EB - N6 • Phone : 777 -4365

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS-360/580H GUI&WindowsProgramming Dr.RichardR.Eckert ComputerScienceDepartment SUNYBinghamton Fall,2009 CS-360:MWF,1:10-2:10P.M.,SL-210 CS-580H:TR,8:30-9:55A.M.,SW-325 CourseInformation •Office:EB-N6 •Phone:777-4365 •OfficeHours:W,R1:30-2:30P.M. •Email:reckert@binghamton.edu •http://www.cs.binghamton.edu/~reckert/ –CS-360linkforsyllabus,notes,programs,assignments,etc. •ClassListserv: –CS360-L@listserv.binghamton.edu •CS-360TA:ElifDede •CS-580HTA:YiboSun

  2. CoursePrerequisites •CS-240,DataStructures •SomeknowledgeofCorC++ TextBookInformation •Required: –Deitel,et.al.,“VisualC#2005:HowtoProgram”, 2ndEdition,PH/Pearson,2005,ISBN0-13-152523-9 •Recommended: –KateGregory,“SpecialEditionVisualC++.NET”,Que,2002,ISBN0-7887-2466-9 •ManyBooksonReserve –SeeReserveListinCourseSyllabus

  3. Software •MicrosoftVisualStudio2005or2008Professional Edition –2008availableatmostUniversitypubliccomputerfacilities –Getyourowncopyofeither •FromMicrosoftAcademicAlliance –AvailablenowtoallregisteredBUstudents –https://msdn04.e-academy.com/elms/Security/PasswordReminder.aspx?campus=binghamton_watson •Smaller.NET2005or2008“ExpressEditions”freefromMicrosoft: –VisualC++2005/08,VisualC#2005/08,SQLServer 2005/08VisualWebDeveloper2005/08ExpressEditions –http://msdn.microsoft.com/vstudio/express/ Evaluation •ProgrammingAssignments40% •TermExaminations(2)40% •Quizzes(360)/Paper(580H)10% •FinalProject10%

  4. Policies •Assignments –Individual –Dueonduedate,butcanbeturnedintoCS- 360/CS-580Hdropdrawerinfilingcabinets outsideCSDepartmentanytimethatdayornight –5%offforeverydaylate •Weekendsandholidaysnotincluded –Noassignmentsacceptedmorethanoneweeklate •Originality –Anynon-originalwork(workfoundtobecopied)willbegroundsforanFinthecourse –Individualassignments •StudentsdoNOTworkinteams CourseSchedule(weekly) 1.IntrotoGUIs&WindowsProgramming,UsingVisualStudio 2.Win32APIProgramming 3.MFCProgramming:App/Window&Doc/ViewApproaches 4.VisualStudio.NET&C#,Classes,Windows Forms,Events,EssentialStructures 5.Graphics,Animation,Timers,DateTime 6.Mouse,Images,Bitmaps 7.Text,Fonts,Keyboard,Printing 8.Pages&Transformations,Menus

  5. CourseSchedule(continued) 9.Controls:Buttons,Labels,TextBoxes,Scrollbars,Listboxes,etc. 10.DialogBoxes,CommonDialogBoxes,File/StreamI/O 11.Clipboard,Multimedia 12.NetworkProgramming,TCP/IPSockets 13.DataBasesandADO.NET,LINQ 14.XML,WebForms,WebControls,ASP.NET;WPF&WCF 15.ASP.NETWebServices 16.OtherWindowingSystems:XWindows,JavaAWT/Swing IntroductionToGUIsand WindowsProgramming

  6. UserInterface •Connectionbetweenthecomputerandtheuser •Twotypes: –CommandLine –GUI:Graphical(Visual) CommandLineInterfaces •Usertypescommands,mustremembervalidcommands •ResultsScrollby •Text-based •“Interactive”buthardtouse •Onlykindofinterfaceavailableuntil1970s

  7. Visual(Graphical)Interfaces •ShowGraphicalObjectsonscreen –e.g.,images,icons,buttons,scrollbars •Userinteractsusingpointingdevice •Intuitive –Objectscanbedragged,buttonspushed,etc.... •Betterwayofusingscreenspace –Panescanoverlap –Underlyingpanescanbebroughttoforefront –Desktopmetaphor(likepapersonadesk) GraphicalInterfaces,Continued •Usegraphicstoorganizeuserworkspace –Visuallyrichwayofconveyinginformation •Environmentallowsmanytaskstobeperformedsimultaneously •Differenttaskssharescreenspace

  8. MainFeatureofGUIs •TheWindow –Rectangularareaofscreenontowhicha programdrawstextandgraphics –Userinteractswithprogramthatcreated thewindowusingapointerdeviceto selectobjectsinside –Somewindowcomponents: •border,titlebar,clientarea,menubar,toolbars,scrollbars,max/min/closebuttons,etc. HistoryofGUIs •DARPASRI(late60s) •XeroxPARCAlto(early70s) •Microcomputers(late70stopresent) –PC(DOScommandline) –AppleLisa,Macintosh •FirstrealmicrocomputerGUI –MicrosoftWindows •Manyversions •We’llemphasizeGUIProgrammingforMicrosoft Windowsinthiscourse

  9. OtherGUI-WindowingSystems •SunMicrosystems:Java –AWT –Swing –Platformindependent –JDKisfree •TheXWindowSystem –DevelopedatMIT,late1980s –Networkedgraphicsprogramminginterface –Independentofmachinearchitecture/OS(butmostlyusedunderUNIX/LINUX) WindowingSystemsFeatures •Consistentuserinterface –Informationdisplayedwithinawindow –Menustoinitiateprogramfunctions –Makeuseofchildwindow“controls” –Pointandclickuserinteractionwithwindow •Allprogramshavesamelookandfeel •Samebuilt-inlogicto: –drawtext/graphics –displaymenus –receiveuserinput �controls,dialogboxes,useofmouse

  10. Multitasking •Manyprogramsrun“simultaneously” •Eachprogramcreates/controlsitsown window •Userinteractswithprogramviaitswindow •Usercanswitchbetweenprogramsby switchingbetweenwindows WindowsMultitasking Features •Cooperative(Windows3.xx) –Programsmustgiveupcontrolsootherscanrun –Programscoexistwithotherprograms •Preemptive(WindowsNT,95,98,XP,2000, 2003,Vista) –Thread-based:Systemtimerallocatestimeslicestorunningprogramthreads •Underbothsystems,codeismovedorswappedintoandoutofmemoryasneeded

  11. WindowsMemoryManagement •Olderversions:16-bit,segmentedmemory –Dictatedbyprocessorarchitecture –Hardtoprogram •64kilobytememorysegmentlimitation •Newerversions:32/64-bit,flatmemorymodel –Easiertoprogram –Eachprocesssees4Gigabytesofvirtualmemory •Asoldprogramsterminate,newonesstart –Codeswappedintoandoutofmemory –WindowsOSdoesthisautomatically •Programscansharecodelocatedinotherfiles (DynamicLinking) Staticvs.DynamicLinking •StaticLinking –Codeincorporatedintoexecutableatlink time •DynamicLinking –Codeisputintoseparatemodules(DLLs) –Theseareloadedatruntimeasneeded

  12. Pros/ConsofDynamicLinking •Smallerprograms(codeisnotinprogram) •DLLcanbeusedbymanyprogramswithnomemorypenalty –Onlyloadedonce! •Disadvantages: –DLLmustbepresentatruntime==>nostandaloneprograms –“DLLHell”whennewDLLversionscomeout •MostoftheWindowsOSisimplementedas DLLs DeviceIndependentGraphics •Windowsprogramsdon’taccesshardware devicesdirectly •Makecallstogenericfunctionswithinthe Windows‘GraphicsDeviceInterface’ (GDI,GDI+,orWPF) •TheGDI/GDI+/WPFtranslatestheseinto HWcommands ProgramGDIHardware

  13. WindowsAPI �ApplicationProgramInterface �Theprogrammer’sinterfacebetweenanapplicationandtheWindowsOS �AlibraryoffunctionsWindows programscancall �Severalversions �Win32APImostfundamental �(32bitappsforWindows NT/95/98/XP/2000/2003/Vista) ClassicalWin32APIWindows Programming •UseCtoaccessrawAPIfunctionsdirectly •NoC++classlibrarywrapperstohideAPI –ButC++compilercanbeused •Hardwaytogo,butmostbasic •Fasterexecutables •ProvidesunderstandingofhowWindowsOS andapplicationprograminteract •EstablishesafirmfoundationforMFCand .NETprogramming

  14. Class-basedWindowsProgramming •“MicrosoftFoundationClass”Library (MFC) •Microsoft.NET“FrameworkClassLibrary”(FCL) •Borland’s“ObjectWindowLibrary”(OWL) •Characteristics: –EncapsulatetheAPIfunctionsintoclasses –Providealogicalframeworkforbuilding Windowsapplications –ObjectOrientationmeansreusablecode MFCLibrary •Microsoft’sfirstC++InterfacetoWin32API •Mostbasicobjectorientedapproachto Windowsprogramming •Some200classes •APIfunctionsencapsulatedintheMFC •ClassesderivedfromMFCdogruntwork •Justadddata/functionstocustomize –OrderiveyourownclassesfromMFCclasses •Providesauniformapplicationframework •Fastexecutables

  15. Microsoft.NETFramework –AsoftwaresystemthataddressesnewSWrequirements •1.WindowsForms:standaloneWindowsapplications •2.WindowsdistributedapplicationsovertheInternet –ASP.NET –ADO.NET –Multi-tierapplications •LanguageIndependent(programscanbewritteninmultiple languages) •PlatformIndependentArchitecture •Newprogramdevelopmentprocess –Objectoriented –Providesincreasedproductivity –NewvisionforusingtheInternetinsoftwaredevelopment •Newsecurityandreliabilityfeatures

  16. Componentsof.NETFramework •Languagecompilers •The.NETFrameworkClassLibrary(FCL) –Organizedinto“namespaces” •likepackagesinJava –Handlethingslike:I/O(simple&file),WindowsForms,WebForms,WindowsControls,UserInterfaces,Drawing,Threading,Exceptions,Networking,WebServices,DataBases(ADO),XML,ASP,Security,Collections,…lotsofothers •CommonTypeSystem(CTS) •CommonLanguageSpecification(CLS) •CommonLanguageRuntime(CLR) .NETArchitecture

  17. Compilationinthe.NET Framework CommonLanguageRuntime SequentialProgramming versus Event-drivenProgramming

  18. SequentialProgramming(Console Applications) �Standardprogramming--programsolicitsinput (pollingloop) �Approachfollowsastructuredsequenceofevents �Example--averaginggrades: �Inputname �Inputfirstgrade �Inputsecondgrade �Inputthirdgrade,etc. �Calculateaverage �Outputaverage Event-DrivenProgramming •Designedtoavoidlimitationsofsequential,procedure-drivenmethodologies •OSprocessesuseractions(events)astheyhappen:non-sequential •Programdoesn’tsolicitinput •OSdetectsaneventhashappened(e.g..,there’sinput)andsendsamessagetotheprogram •Programthenactsonthemessage •Messagescanoccurinanyorder

  19. Sequentialvs.Event-DrivenProgramming •StandardSequentialprogramming: –Programdoessomething&userresponds –Programcontrolsuser •thetailwagsthedog •Event-DrivenProgramming: –Userdoessomethingandprogramresponds –Usercanactatanytime –Usercontrolsprogram •thedogwagsthetail –OSreallyisincontrol(coordinatesmessageflowtodifferentapplications) –Goodforappswithlotsofuserintervention

More Related