[ Pobierz całość w formacie PDF ] .Disassembly.By selecting the Disassembly toolbar button or menu option, you cantoggle between displaying the C++ code mixed with assembly code or just C++code.Where the source code is unavailable, only assembly code is shown.Additional Debugging ToolsAlong with the integrated debugging tools are several nonintegrated but very usefultools.You can start these by clicking the Tools menu and selecting the specific tooloption from the menu.033 31240-9 APP E 4/27/00 1:11 PM Page 695Using the Debugger and Profiler 695These tools generally let you track operating-specific items such as Windows messaging,running processes, and registered OLE objects to enhance your available informationwhile debugging your application.Using Spy++Spy++ is undoubtedly one of the most useful of these tools.With Spy++, you can see thehierarchical relationships of parent to child windows, the position and flags settings forwindows, and base window classes.You can also watch messages as they are sent to awindow.When you first run Spy++, it shows all the windows on the current desktop, their sib-lings, and the base Windows class of each object (see Figure E.12).The view shown inFigure E.12 has been scrolled to shown the standard Microsoft Windows CD Player.Spy++ shows you all the buttons and combo boxes, which are windows in their own rightas child windows of the main CD Player window.FIGURE E.12.The Spy++ initial viewof the Windows desk-top showing the CDPlayer portion.EIf you click the Spy menu, you are shown the following options:Messages.You might find that the Messages view is probably one of the most use-ful options because you can use it to watch messages that are sent to any window(including your own application).You can also filter these messages so that youdon t receive an avalanche of Mouse Movement messages.To use messages, select this option to display the Message Options dialog boxshown in Figure E.13.You can then drag the finder tool over any window in the033 31240-9 APP E 4/27/00 1:11 PM Page 696696 Appendix Esystem, displaying the details of the window as it moves.Spy++ also highlights theselected window, so you can see frame and client windows.When you ve locatedthe window you want to view, just let go of the tool.At this point you can use theother tabs to set filtering options and output formatting options.When you re fin-ished, click OK to close the Message Options box.FIGURE E.13.Using the Spy++Message OptionsFinder to locatewindows.The output shown in Figure E.14 are the messages produced from using a normalSDI application s toolbar.As you can see, with no filtering you ll receive manymouse movements and cursor check messages, but you can also see the familiarWM_LBUTTONUP message with its position parameters.FIGURE E.14.Windows Messages fora toolbar logged bySpy++.Windows.The Windows view is the view shown in Figure E.12 of the layout andstructure of the Windows desktop.If you double-click any of these windows, you llbe shown a property sheet containing all the selected windows positioning infor-mation and flag settings.To update this information, you must click the Windowsmenu and choose Refresh.033 31240-9 APP E 4/27/00 1:11 PM Page 697Using the Debugger and Profiler 697Processes.You can view all the running programs with the Processes view.Thesecan be opened to show each thread and any windows attached to those threads.Threads.The Threads option shows the same details without the processes level ofhierarchy, so you can see every thread running on your machine and the windowsthat each thread owns.Spy++ is too sophisticated to cover in its entirety here, but as a tool for understandingthe structure of Windows hierarchies and messaging, it is unsurpassed.You can glean alot of valuable knowledge just by looking at commercial applications with Spy++.It isalso a wonderful tool for debugging messaging problems in your own application toensure that your windows are getting the correct messages and to see how these mes-sages are sequenced.Process ViewerYou can see all the processes in more detail than shown in Spy++ with the ProcessViewer (PView95.exe).You can start this application from your system s main WindowsStart menu from Programs under the Microsoft Visual Studio 6.0 Tools option (or similarprogram group).This application lists the processes running on your machine and letsyou sort them by clicking any of the column headers.You can then click a process todisplay all its threads.Figure E.15 shows Process Viewer running with the DeveloperStudio application (MSDEV.EXE) selected and all its many threads displayed.FIGURE E.15.The Process Viewershowing MSDEV.EXE Eand its threads.The OLE/COM Object ViewerThe OLE/COM Object Viewer tool shows you all the registered OLE/COM objects onyour system, including ActiveX controls, type libraries, embeddable objects, automationobjects, and many other categories.You can even create instances of various objects and view their interfaces in detail.TheOLE/COM Object Viewer is very useful if you are developing an OLE/COM applicationor looking for an elusive ActiveX control.033 31240-9 APP E 4/27/00 1:11 PM Page 698698 Appendix EThe MFC TracerUsing the MFC Tracer tool shown in Figure E.16, you can stop the normal tracing or addspecific Windows trace output to the normal program trace output.When you select thistool, you are shown a set of check boxes that you can check or uncheck to include thattracing option.FIGURE E.16.The MFC Tracer tooloptions.You can add Windows messages, database messages, OLE messages, and many otherlevels of trace output to help track down elusive problems.These messages are thengenerated by the MFC code for the various selected flags.You can even turn off the standard tracing generated by your application by uncheckingthe Enable Tracing option
[ Pobierz całość w formacie PDF ]
zanotowane.pldoc.pisz.plpdf.pisz.plhanula1950.keep.pl
|