1 / 15

Microsof t Visua l Studio • Self - containe d environmen t fo r Windows progra m development:

Microsof t Visua l Studio: A n Integrate d Windows Progra m Development Environment. Microsof t Visua l Studio • Self - containe d environmen t fo r Windows progra m development: – Creating/editing – Compiling/linkin g (building) – Testing/debugging

torin
Download Presentation

Microsof t Visua l Studio • Self - containe d environmen t fo r Windows progra m development:

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. MicrosoftVisualStudio:AnIntegratedWindowsProgramDevelopmentEnvironmentMicrosoftVisualStudio:AnIntegratedWindowsProgramDevelopmentEnvironment MicrosoftVisualStudio •Self-containedenvironmentforWindowsprogramdevelopment: –Creating/editing –Compiling/linking(building) –Testing/debugging •IDEthataccompaniesVisualC++,Visual Basic,VisualC#,andotherMicrosoftWindowsprogramminglanguages •SeeChapter2&AppendixCoftheDeiteltext •AlsoAppendixCoftheGregorytext

  2. SomeVisualStudioComponents •TheEditors: C,C++,C#,VBsourceprogramtexteditors •cut/paste,colorcues,indentation •generatesourcetextfiles ResourceEditors •Resources:Windowsstaticdata •Determinelookandfeelofanapplication -icons,bitmaps,cursors,menus,dialogboxes,etc. •graphical •generateresourcescript(.rc)files •integratedwithtexteditor •createdvisually .NETLanguageCompilers •UnmanagedCodeC/C++Compiler -translatessourceprogramstomachinelanguage -generatesobject(.obj)filesforlinker •ManagedCode.NETLanguageCompilers -Manyofthem�multi-languageinteroperability -TranslatesourceprogramstoMSIL -Generatea“PortableExecutable”thatmustbetranslatedtotargetmachinelanguagebytheCLR •ResourceCompiler -Reads.rcfile -Generatesbinaryresource(.res)fileforlinker

  3. TheLinker •Readscompiler.objand.resfiles •AccessesC/C++/Windowslibraries •Generatesexecutable(.exeor.dll)

  4. ProgramBuildandRuninthe .NETFramework CommonLanguageRuntime TheDebugger •Powerfulsourcecodedebugger •IntegratedwithallpartsofVisualStudio •Features -breakpoints -tracingthrough/overfunctions -variablewatchwindows •SeeAppendixCofDeiteltextbook

  5. TheWizards •AppWizard -WindowscodegeneratorforWindowsapps -automaticallycreatesworkingprogramtemplates&skeletoncode •ClassWizard -facilitateseasyextensionofAppWizard-generatedclasses -creationofnewclasses -usedtotailorAppWizard-generatedMFC& .NETskeletons -AccessibleinthePropertiesWindowin.NET Help •EssentialwhendevelopingWindowsapps •Hoveroverkeywordsineditwindowandaone-linehelpmessageappears •‘Help’MenuItem -‘DynamicHelp’-contextsensitive •Clickontextineditwindowandcorrespondingtopicappearsinhelpwindow •Clickontopicinhelpwindowtogethelp -‘Contents’:Selectatopic -‘Search’:Enteratopic -‘Index’:Enter/chooseatopic

  6. MSDNLibrary(onWeb) •Goto:http://msdn.microsoft.com -SearchMSDNfordesiredtopic -Someexamples: •WindowsAPIreference •MFCreference •Windowsformsclasslibrary UsingVisualStudio •Topreparemanykindsofapplications -Win32ConsoleApplications(DOSprograms) -Win32APIAppsinCorVC++ -MFCAppsinVC++ -DLLs -.NETWindowsFormsAppsinManagedC#,VB,VC++,andotherlanguages -ASP.NETWebAppsandServices -ADO.NETDataBaseApps -Others

  7. VisualStudioLayout •MenuBar •SeveralToolBars •ViewWindows(totheside) -SolutionExplorer -ClassView -ResourceView -PropertiesWindow •WorkingArea(mainwindow) -TextEditortoenter/modifysourcecode -ResourceEditors -Tabbetweendifferentworkareas •OutputWindow&StatusBar(bottom). -SystemMessages(errors) •Windowscanbemovedaround,dockedandundocked

  8. Toolbars •ContainIcons--instantroutestomainmenufunctions •Maynotbevisible •Ifnot,rightclickonanyvisibletoolbar •Bringsupfollowingpopupwindow •Canactivateatoolbarbyclickingonitscheckbox KeyboardShortcuts •AllMenu/Toolbarselectionsareavailable fromthekeyboardusingkeycombinations •Canbefaster •MoreinformationinOnlineHelp -‘Index’|‘KeyboardShortcuts’|‘Predefined’

  9. SolutionsandProjects •Solution -Asingleapplication -Cancontainoneormoreprojects •InManagedapplications,projectscanbeindifferentlanguages -Overallsolutioninformationstoredina.SLNfile -Openthiswhenyouwanttoworkonasolution •Project -Basiccomponentofanapplication -Collectionoffiles: •Source,headers,resources,settings,configurationinformation,manymore ImportantVisualStudioGeneratedFiles •.slnSolution •.vcprojProject •.c,.cpp,.csC/C++/C#WindowsAppsourcecode •.hC/C++header •.rcResourcescript •.resCompiledresource •.icoIcon •.bmpBitmapimage •.exeExecutableprogram •.dllDynamicLinkLibrary •.aspxASP.NETWebFormsourcecode •.asmxASP.NETWebServicesourcecode

  10. TemporaryVisualStudioGenerated Files •Manyareverybigandcan(should)beremoved! •.objCompilermachinecodetranslation •.ilkIncrementallinkfile •.pchPrecompiledheader(huge!) •.pdbPrecompileddebugginginfo •.idbIncrementaldebuginfo •.ncbintellisensedatabase(huge!) •.apsSupportsviewingresources •Others •Canbedeleted ProgramConfigurations •Debug -appendsdebugginginformation -producesmoreandlargerfiles •Release -nodebugginginformation -optimizedforsize,performance,&efficiency

  11. SettingtheConfiguration •Click‘Build’onMainMenu •Choose‘ConfigurationManager’ •Choosedesiredconfiguration(‘Debug’or ‘Release’)inConfigurationManager’s ‘ActiveSolutionConfigurationBox’ •Defaultis‘Debug’ CreatingaWin32APIWindows ApplicationwithVisualStudio •Startup -Click‘Start’onTaskBar-‘AllPrograms’ -‘MicrosoftVisualStudio2008’|‘Microsoft VisualStudio2008’ •CreatinganewWin32APIsolution -‘File’|‘New’|‘Project’fromMenuBar -In‘NewProject’box,select‘VisualC++’‘Win32’from‘ProjectTypes:’&clickon‘Win32Project’in‘Templates’ -Setthe‘Location’toaconvenientdirectory& nametheproject(e.g.win32app1) -‘OK’

  12. •Click‘ApplicationSettings’inresulting ‘Win32ApplicationWizard’Box -Select‘WindowsApplication’from ‘ApplicationType’radiobuttons -Select‘EmptyProject’from‘Additional Options’checkboxes -Click‘Finish’ •Insertingsourcefilesintoproject: -OpenanewC++file&typeorcopy/pastethecodeintotheprogram: •‘File’|‘New’|‘File’frommenu •Choose‘VisualC++’from‘Categories’,C++file(.cpp) from‘InstalledTemplates’,&click‘Open’ •TypeorpastesourcecodeintotheresultingEditwindow •Savethefileintheproject’ssubdirectoryasaC++sourcefile,givingitanappropriatename(e.g.,win32app1) -Addthesourcefiletotheproject: •Choose‘Project’|‘AddExistingItem’frommenu •Clickonthefileyousaved(e.g.win32app1.cpp) •Confirmthatitwasaddedtotheprojectbyexpanding ‘SourceFiles’intheSolutionExplorerWindow -IfSolutionExplorerisnotvisible,select‘View-SolutionExplorer’ fromthemenu

  13. •AlternativeWayofAddingaSourceFiletoaProject: -Youcanalsocopyanexistingsourcecodefileintotheproject’ssubdirectory -Thenasbefore: •Choose‘Project’|‘AddExistingItem’fromthemenu •Selectthe.cppfile&click‘Open’ -ShouldappearinSolutionExplorerwindow -Openitbydoubleclickingonit •BuildingtheSolution: -‘Build’|‘BuildSolution’frommenu -Projectwillbecompiled/linked -Messages/errorswillappearinOutput Window •RunningtheProgram: -‘Debug’|‘Start’frommenu •Shortcutkey:F5 -Or‘Debug’|‘StartWithoutDebugging’frommenu •Shortcutkey:Ctrl-F5

  14. CompilingfromCommandLine •CommandLineCompilers: -C++:CL.EXE -C#:CSC.EXE -VisualBasic:VBC.EXE •AllarerunfromaDOSsession,butdirectorypathsmustbesetcorrectly •EasiesttostartaVisualStudio2008 CommandPrompt(pathsalreadyset) -FromTaskBar: •Start|AllPrograms|MicrosoftVisualStudio2008|VisualStudioTools|VisualStudio2008CommandPrompt CommandLineCompiling,continued •TocompileourfirstVisualC++,Win32API application(win32a1.cpp)fromthecommandline: -clkernel32.libuser32.libgdi32.libwin32a1.cc -Notethatanyrequiredlibraries(DLLs)mustbespecified •Therearemanycompileroptions: -SeeOnlineHelp: -‘Index’|‘cl.execompiler’|‘buildingprograms’ -ForC#:‘Index’|‘csc.exe’ •Wewon’tbeusingcommandlinecompilersmuchinthiscourse,butthey’rethereifyouneedthem

  15. •Cleanup: -Copysolution,project,source,header,resourcefilestodisk -Copy.exefilefromproject'sDebugdirectory -Best:Deletealltemporaryfiles&copyentire solution(projectdirectory)tofloppyorCD -Deleteprojectdirectoryfromharddrive •ExitingDeveloperStudio: -‘File’|‘Exit’frommenu

More Related