Copyright: © Copyright 1997 NuMega Technologies, Inc.


Missing Topic or Incorrect Help ID

This page intentionally left blank.

If you have reached this topic, please report the incorrect or missing jump as an error in the help system.


How to Check a Program with SmartCheck
To check a program directly from SmartCheck

Before starting

•	To take advantage of the full set of SmartCheck event tracking and analysis capabilities, your program must be compiled with the following Visual Basic compilation options enabled: Compile to Native Code; No Optimization; Create Symbolic Debug Info.

•	When using SmartCheck to check a project group, be aware that you must set compilation options separately for each project in the group.

•	If your program launches other ActiveX executables (EXEs), and you need SmartCheck to check those executables in conjunction with checking your program, see Checking Multiple ActiveX Executables.

To check your program

1	On the Windows Start menu, click SmartCheck.

2	On the SmartCheck File menu, click Open.

3	Select the .EXE file that you want to check, and click OK.

4	On the Program menu, click Settings to review SmartCheck settings for your program. For setting definitions, see:

Error Detection Settings

Reporting Settings

Source Files, Directories and Run Options (Program Info Settings)

Files to Check

Error Suppression Settings

After you finish reviewing Settings, click OK to accept any changes.

5	On the Program menu, click Start.

6	Use your program as you normally would. As you perform tasks, SmartCheck records program errors and events in an event log, and dynamically displays this information in the Program Results window.

If the Report Errors Immediately option is enabled, SmartCheck displays a Program Error Detected window each time a runtime error occurs in your program. This window provides detailed information about the detected error, and options for controlling further occurrences of that error.

7	When you have finished checking your program, click Halt on the Program Error Detected window or on the Program menu.

8	Review the list of errors and events that SmartCheck detected in the Program Results window.

   Related Topics


Checking a Program from the Command Prompt
To check a program from the command prompt

Use the following command syntax to check a program with SmartCheck from the command prompt. Brackets [ ] indicate that a command is optional. Command-line options are case insensitive.

sc	[compliance.scx]
	[results.sce]
	[program.exe [argument1 argument2]]
	[/Bresults.sce program.exe [argument1 argument2]]
	[/Wdirectory-path] [program.exe]
	[/L] [program.exe]
	[/M] [program.exe]
	[/S] [program.exe]
Options and Examples

To	Use This Command
Check a program for errors.	sc program.exe
Open a program results file.	sc results.sce
Open a compliance report	sc compliance.bcp
Run a program with command-line arguments.  For example:  C:\sc test.exe -s -v	sc program.exe arg1 arg2
Run SmartCheck in batch mode.   Note that when you run in batch mode, any command-line arguments previously set for that program will be overwritten (even if you do not specify command-line options in batch mode).  For example:  C:\sc /Btest.sce test.exe	sc /Bresults.sce program.exe
Specifies the working directory. The directory path must immediately follow the /W argument; do not separate with spaces.  For example:  C:\sc /Wc:\programs\testdir	sc /Wdirectory-path
Disable splash screen.	sc /L
Start SmartCheck minimized.	sc /M
Disable immediate error reporting.	sc /S

   Related Topics


Sending Program Results to Another User
 To send program results to another user

You can choose to send a copy of your current or saved program results to another person on your team. When you choose this option, SmartCheck displays your current MAPI-supported mail program and begins a new message with an included program results file.

To send program results using mail

1	On the File menu, click Send. Your mail program appears and starts a new message. By default, SmartCheck names the results file program-name.SCE.

2	Type or select the name of the person(s) you want to receive a copy of the included program results.

Note that this file contains the full record of the errors and events SmartCheck detected in your program. The current display of program results in the Program Results window does not affect the contents of the file.

3	Type any other information you want to add.

4	Send the mail message using the appropriate method for your mail program.


Stopping an SmartCheck Run
 To stop a program

•	On the Program menu, click End.

•	Exit from the program you are running.

•	From the Program Error Detected window, click End.


Missing Topic or Incorrect Help ID

This page intentionally left blank.

If you have reached this topic, please report the incorrect or missing jump as an error in the help system.


Setting Error Detection Options  (directly from SmartCheck application)
To Select Error Detection Settings

1	On the Program menu, click Settings.

2	Click the Error Detection tab.

3	Under Types of Errors to Check For, click the checkbox to the left of any error category, or category sub-setting, to select or clear it.

4	Click (highlight) the name of an error category to review any sub-settings associated with it. The sub-settings appear to the right, under Additional Settings. Click the checkboxes to the left of these sub-settings to select or clear them.

5	Click Advanced to review advanced error detection settings. Click OK to save any changes you make.

6	In the main Settings dialog, click OK again, to save any changes made to the main settings.

Tips

•	To have SmartCheck use the current settings as the new defaults for new programs, select Save these settings as the initial values for new programs.

If you never use this setting to save a custom configuration, SmartCheck uses its original, default error detection scheme for every new program.

•	Choosing additional error detection categories affects performance. You should consider this factor when customizing error detection for your program.

•	When you make any changes to the default SmartCheck settings, SmartCheck enables the Default Settings command on the Error Detection tab. You can click Default Settings at any time to re-instate the default SmartCheck configuration for the program.

•	To view a definition of any item in the Settings dialog, click [image] then click on the item you want to learn more about.

   Related Topics


Saving Error Detection Settings
To Save Error Detection and Reporting Settings

1	On the Program menu, click Settings.

2	After selecting settings on the Error Detection and Reporting tabs, select Save these settings as the initial values for new programs.

Any new program you check will use these settings as the new default.

3	Click OK to save your changes.

Tips

•	If you are displaying the original, default SmartCheck configuration, and have not yet made any changes to it, this option will not appear.

•	If you never use this option to save a custom configuration, SmartCheck uses its original, default error detection scheme for every new program.

•	To restore the default error detection configuration for the current program, click Default Settings.

   Related Topics


Collecting and Reporting Program Events
To Select Reporting Settings

Use settings on the Reporting tab to identify which program events SmartCheck should collect and report, and to indicate whether or not SmartCheck should analyze handled runtime errors.

1	On the Program menu, click Settings.

2	Click the Reporting tab.

3	Click checkboxes to select or clear any Reporting settings.

Tips

•	Note that data collection and analysis activities do affect run-time performance and the size of the program event log. Many users find that the default SmartCheck configuration offers the optimum level of data collection and error and event analysis.

•	To view a definition of any specific item in the list, click [image] then click on the item you want to learn more about.

•	The Perform analysis of handled Visual Basic runtime errors setting on the Reporting tab is a sub-option of Report handled Visual Basic runtime errors, and therefore only available when that setting is selected.

   Related Topics


Specifying a Working Directory and Program Run Options
To Specify a Working Directory and Command-line Options

You can specify a working directory for your program and pass command-line arguments to control how your program is run. You may want to set a working directory if you do not want to debug your program in the same directory as your program executable.

1	Open or select your project in Visual Basic.

2	On the Program menu, click Settings.

3	Click the Program Info tab.

4	Click one of the following for steps:

   Specify the working directory

   Specify program command-line options

   Related Topics


Specifying the Source Files Search Path
To Specify the Source File Search Path

The SmartCheck Program Error Detected and Program Results windows each include a Source pane, in which you can view the source code associated with the errors and events reported by SmartCheck. By default, SmartCheck expects source code to reside in the same directory as the program executable. If necessary, you can identify additional directories in which SmartCheck should search for source code.

1	Open or select your project in Visual Basic.

2	On the Program menu, click Settings.

3	Click the Program Info tab.

4	At Source File Search Path, type the directory path(s) SmartCheck should use to locate your source files. Separate paths with semicolons.

You can click the Browse button associated with this entry to search your system and select directories to add to the path. The path for each directory you select is appended to the current sequence of search paths.

5	Click OK to save your changes.

Tip

•	If you are prompted for and provide the location of source files when running a program or examining program results, SmartCheck adds the appropriate path to the program's search path.

   Related Topics


Working with Error Suppression Libraries

Complete these steps to suppress error checking in parts of your project using the SmartCheck suppression libraries:

1	Open your program.

2	On the Program menu, click Settings.

3	Click the Error Suppression tab.

4	Click one of the following for steps:

   Select or clear a suppression library

   Add an API function

   Remove a suppression item

Tips

•	SmartCheck creates a separate suppression library for each program you open. This library is located in the same directory as your program executable, and has the extension .SUP. SmartCheck also provides suppression libraries for common development environments, OCXs and DLLs, including Visual Basic, MFC, Visual C++, Delphi VCL, and OWL.

•	You cannot add or remove suppression items from the suppression libraries supplied with SmartCheck.

•	Each time you suppress an error from the Program Error Detected or Program Results window and choose to save suppression information, SmartCheck adds this information to your  program's suppression library. To learn more about how to suppress an error while checking a program, click here [image].

   Related Topics


Suppressing Errors - Options
Suppressing Errors

You can choose to suppress subsequent instances of an error while running your program from either the Program Error Detected window or the Program Results window.

There are two main reasons you might want to suppress an error:

•	The error was generated by code belonging to another member of the development team or by a third party DLL or OCX.

•	Your code properly handles the error. For example, SmartCheck detects an API failure, but your code handles this failure.

When you suppress an error, you can limit the scope of the suppression to specific source files or modules. You can also choose to save suppression information for future runs of the program.

Note that you cannot suppress an error from a previously saved program results (.SCE) file. You must be running your program to suppress errors from the Program Results window.

For steps, see:

   Suppress an error from the Program Error Detected window

   Suppress an error from the Program Results window

   Share suppression libraries with a team

   Related Topics


Checking Specific Source Files and Modules

SmartCheck lets you narrow the error detection focus by selecting the specific program  modules and source files you want to check. You may want to check for errors only in code you have recently written yourself and not in other project modules. Or, you may want to check for errors in a new DLL or OCX you have coded, but not in existing modules.

SmartCheck automatically checks all DLLs and OCXs used by your program, regardless of how you link to these modules. By default, the Modules list box displays only the DLLs and OCXs loaded at run-time. You can choose to add dynamically linked modules if you want to exclude these modules or their related source files from error checking.

To add or exclude specific files from error checking

1	Open the program that you want to check.

2	On the Program menu, click Settings.

3	Click the Files to Check tab.

Click one of the following for steps:

   Check specific source files

   Check specific modules (EXEs, DLLs, and OCXs)

   Add or remove a program module

   Related Topics


Displaying the Program Error Detected Window
Reviewing Detected Errors Immediately
(the Program Error Detected Window)

You can have SmartCheck display a Program Error Detected window each time it encounters an error during program execution.

To control display the Program Error Detected window

1	On the Program menu, click Settings.

2	Click the Error Detection tab.

3	Select Report Errors Immediately to enable the display of the window or clear the check box to suppress it.

4	As your program executes, SmartCheck will display the Program Error Detected window each time it encounters an error.

Tips

•	Regardless of whether or not the Program Error Detected window is enabled, SmartCheck records error information in the event log for later viewing.

•	For an illustration of the Program Error Detected window, click here [image].

   Related Topics


Displaying an Error Description for a Detected Error

1	Begin checking your program.

2	When SmartCheck detects an error and displays the Program Error Detected window, choose Explain.

3	Review the error description, sample code, and suggested repair for the selected error. You can click on the buttons at the top of the error description to jump to a specific section.

   Related Topics


Disabling Immediate Error Reporting

There may be times when you want to check your program without receiving error notification. For instance, you might turn off error notification for a program that causes many errors that you do not need to examine in detail. You can do this by choosing not to receive immediate reports of program errors.

If you choose this setting, the Program Error Detected window does not appear each time SmartCheck detects an error in your program. SmartCheck still records errors and events in a program event log and displays this data in the Program Results window.

To disable immediate error reporting

1	On the Program menu, click Settings.

2	Click the Error Detection tab.

3	Clear the Report Errors Immediately check box.

4	Click OK to save your changes.

   Related Topics


Opening or Displaying Program Results

As SmartCheck checks your program, it records information about detected errors and events in a program event log. The Program Results window displays the contents of this event log in the manner you choose. You can view your Program Results while or after you use a program, or you can open a Program Results file you saved from a previous error checking session.

To display program results for a new program

1	Run the program.

2	The Program Results window appears. As you run your program, SmartCheck updates the Results window with detected errors.

3	When you have finished running your program, you can review your program results, choose the errors and events you want to view, and save or print the program event log.

To open a previously saved program results file

1	On the File menu, click Open.

2	Change to the directory where you previously saved a program results file.

3	In the Files of Type drop-down list, select Results Files (.SCE). By default, a SmartCheck results file has a .SCE extension.

4	Select the program results file you want to view.

5	Click OK.

   Related Topics


Displaying an Event Summary

The SmartCheck Event Summary window is available while running a program or after exiting it. This window displays a snapshot of program activity, and includes the:

•	Number of occurrences of each event type

•	Total number of events

•	Amount of memory allocated by your program

If you display the Event Summary window during your error checking session, SmartCheck automatically updates the count of program events in the window as they are detected.  The amount of memory allocated is shown when you stop checking your program.

To display an event summary

1	Check a program for errors or open an existing program results file.

2	On the View menu, click Event Summary.

SmartCheck displays an event summary for the current or last run of the program. If you continue to check your program for errors, the event summary updates the number of detected events.

To close an event summary

   Close the event summary window or the related Program Results window.

   Related Topics


Changing Your View of Errors and Events

You can choose which program events (in addition to errors) you want to view in the Program Results window. This makes it easy to check a program's flow and to isolate specific program functions as separate groups of events. By default, SmartCheck shows Visual Basic events, program errors and leaks.

You can only view the events you chose to collect and report before running SmartCheck on your program.

Note that your selections in this dialog affect only your view of error and event information; your selections do not change the contents of the program’s event log.

To control the display of program events

1	On the View menu, click Specific Events.

2	Select the events that you want to view in the Program Results window.

For more information, see:

   To change the display of program events

   To save settings for all new programs

Tip

•	You can change your view of errors and events using commands on either the SmartCheck View menu or the toolbar.

   Related Topics


Showing Arguments for API and OLE interface Calls
Showing Arguments for Visual Basic built-in functions, API and OLE Interface Calls

You can choose whether to show detailed argument data for Visual Basic built-in functions, as well as for API and OLE Interface calls, in the Program Results Window.

Note  To display data about API and OLE Interface calls, you must disable Suppress system API and OLE calls before running SmartCheck on your program. To access this setting, select Settings from the Program menu, then click Advanced on the Error Detection tab.

To display program arguments

   On the View menu, click Arguments.

   Related Topics


Showing Sequence Numbers

You can display sequence numbers next to program events in the Program Results window. Sequence numbers are useful in tracing the program events that led to program errors.

To display sequence numbers

   On the View menu, click Sequence Numbers.

   Related Topics


Displaying Thread Indents

You can indent the program threads of multithreaded programs in order to examine the relationship between threads or to isolate a single thread in the display. SmartCheck assigns each thread a unique Thread ID, which you can use to track program errors and leaks in that thread.

To indent threads

   On the View menu, click Increase Thread Indent. SmartCheck indents all program threads. You can click Increase Thread Indent again to further indent program threads.

To reduce thread indents

   On the View menu, click Decrease Thread Indent. SmartCheck decreases all indented program threads. You can click Increase Thread Indent again to further decrease thread indents.

   Related Topics


Expanding and Collapsing Events

You can expand an event in the Results window to view nested events. For example, you can choose to expand an API call to view the events that occurred between the call and return.

To expand a nested event

   Click the plus sign (+) or double-click the event description.

To expand a hierarchy of nested events

1	Select the program event.

2	On the View menu, click Expand Item. The selected event and any subordinate nested events expand.

To expand all nested events

   On the View menu, click Expand All. All nested events expand.

To collapse an expanded event

   Click the minus sign ( - ) or double-click the event description.

You can also collapse a hierarchy of events or all events: On the View menu, click Collapse Item or Collapse All.

Tip

•	You can also Expand and Collapse nested events by selecting an event in the Program Results window, then pressing the right-mouse button and clicking the appropriate option.

   Related Topics


Saving Program Results

You can save your program results, including all detected errors and events, for later viewing and analysis.

By default, SmartCheck assigns your program results the same name as your program, with a .SCE extension.

To save program results

1	Select or open the program results that you want to save.

2	On the File menu, click Save As.

3	Accept the default file name and directory or enter a file name and directory location.

4	Click Save.

To save program results when you exit a program

1	On the File menu, click Exit.

2	Click Yes when prompted to save your program results.

3	Accept the default file name and directory or enter a file name and directory location.

4	Click Save.

   Related Topics


Printing Program Results

You can print your program’s error and event results for later viewing. SmartCheck prints only the errors and events currently displayed in the Program Results window. You can choose to print more or less program results by filtering the display of program events.

To print displayed program results

1	Display the Results window that contains the program results that you want to print.

2	On the File menu, click Print.

3	Review your current print settings, then click OK.

   Related Topics


Checking API Compliance

SmartCheck ComplianceView technology checks your program's compliance with Microsoft's three 32-bit APIs (Win32s, Win32 for Windows 95, and Win32 for Windows NT) and creates a comprehensive compliance report based on the results. SmartCheck provides two compliance checking options:

•	Check program compliance: Checks all functions that an .EXE refers to—whether or not it calls them.

•	Check event compliance: Checks only those functions that were actually called in the program execution.

To check program compliance

1	Open the program you want to check.

2	On the Program menu, click Check Program Compliance.

SmartCheck checks program compliance and displays the results in the Compliance window.

To check event compliance

Note  Because SmartCheck uses the program’s event log to check event compliance, you must check your program using Maximum error detection before checking event compliance.

1	Select Maximum error detection.

2	Check the program with SmartCheck.

3	Use all program features you want included in the compliance report, and then exit from the program.

4	On the Program menu, click Check Event Compliance.

SmartCheck checks compliance on the collected errors and events and displays the results in the Compliance window.

To save a compliance report

1	Display the Program or Event Compliance window for your program.

2	One the File menu, click Save As.

3	Enter a file name and select a directory. You can accept the default .SCX extension for your program or supply your own.

4	Click Save.

   Related Topics


Setting SmartCheck Window Preferences

You can customize the appearance of SmartCheck windows by selecting the font used to display program data. For example, you may want to increase the size of the error data you view most frequently, or decrease font sizes to display more information in a window.

To change the fonts used in SmartCheck windows

1	On the Visual Basic Tools menu, click Options.

2	Click the Format tab.

3	Click a SmartCheck window. For a description of each window, click here [image].

4	Click Change Font to change the text size or style of the selected window. You can view a sample of your current selections in the Sample box.

5	Choose OK to save your changes.

   Related Topics


SmartCheck Preference Items

Error window	Controls the display of text in all SmartCheck windows.
Call stack	Controls the display of stack information in the Program Error Detected window and the Results window.
Compliance  report	Controls the display of text in the SmartCheck Compliance window.
Program results	Controls the display of the error and event list in the Results window.
Error Source	Controls the display of source code in the Program Error Detected window.


Selecting Toolbars and Tooltips

You can choose to display the SmartCheck toolbar in Visual Basic, which provides shortcuts for frequently used commands. You can also choose whether to display tooltips, which identify toolbar controls when you move the mouse pointer over that control.

To control the display of toolbars

1	On the Tools menu, click Customize.

2	Click the Toolbars tab.

3	In the Toolbars list box, select or clear SmartCheck. The SmartCheck toolbar displays or hides as you make your changes.

The SmartCheck toolbar features shortcuts that let you choose the Integrated Debugging option, review SmartCheck error detection settings, and control the display of events in the Program Results window.

4	Click Close to save your changes and exit the dialog.

To control the display of tooltips

1	On the Tools menu, click Customize.

2	Click the Toolbars tab.

3	Select or clear Tooltips.

4	Click Close to save your changes and exit the dialog.

   Related Topics


SmartCheck Toolbars

You can use the SmartCheck toolbars as follows:

Toolbar	Function
Event view	Change the display of events to:  Show all events Show errors and leaks only Show errors and specific events
Standard	Manage programs and files: Open programs Copy text from a window Print program results
Program Execution	Set error detection options  and run programs: Set the error detection scheme Report detected errors immediately Run SmartCheck on your program Halt a SmartCheck run