Programming MicrosoftВ® OutlookВ® and Microsoft Exchange 2003, Third Edition (Pro-Developer)
If in your testing you find that your code is not working completely, you might need to kick your code into the Visual Basic debugger to fix the problems. Because smart tags are ActiveX DLLs, debugging them in Visual Basic is easy. You simply set a breakpoint in your code and then run the code in the Visual Basic IDE. Select the option to wait for the component to be created. Then start a smart tag host application such as Word, be sure that your smart tag is enabled in Word, and type a term that will trip your break point in your recognizer. You can then use the standard debugging tools in Visual Basic to fix your code. Figure 9-6 shows a smart tag DLL in the debugger.
Note | When debugging a smart tag, you might find that terms that meet your criteria do not appear underlined in Word. Because Word runs the smart tag recognizer on a background thread, if your recognizer takes too long, as might be the case in stepping through a debugger, Word will invalidate the call to the recognizer and continue processing. If you then try to call CommitSmartTag , you will get an error because your recognizer has been invalidated and the purple underline will not appear. The only way to work around this issue is to debug using a document in which the smart tags are already tagged and trigger your code via a recheck of the smart tags in the document from the AutoCorrect menu command. |