How To Debug a Visual Basic DLL from Visual InterDev (200998)



The information in this article applies to:

  • Microsoft Visual InterDev 6.0
  • Microsoft Visual Basic Learning Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

This article was previously published under Q200998

SUMMARY

This article demonstrates how to debug a Visual Basic ActiveX dynamic-link library (DLL) using Visual InterDev 6.0 or later.

MORE INFORMATION

The Component Object Model (COM) DLL needs to be registered on the computer that is creating the object (through Server.CreateObject).

Step-by-Step Example

  1. Start Visual Basic on the computer where Visual InterDev will be used for debugging, and create a new ActiveX DLL.
  2. Change the name of the project to MyVBComponent.
  3. Change the name of the Class module to CMyClass.
  4. Add the following code to the DLL:
    Public Function DebugTest (vntNum1 as Variant, vntNum2 as Variant) as Variant
           DebugTest = vntNum1 + vntNum2
       End Function
    					
  5. From the File menu, click Make MyVBComponent.dll.
  6. Set a breakpoint on the "DebugTest = vntNum1 + vntNum2" line in the DLL.
  7. From the Run menu, click Start (or press the F5 key) to run the program.
  8. Start Visual InterDev, and add a new Active Server Pages (ASP) page to the project.
  9. Add the following code to the new ASP page:
       <%
          Dim objMyComponent, vntNum1, vntNum2, vntResult
          vntNum1 = 1
          vntNum2 = 2
          Set objMyComponent = Server.CreateObject("MyVBComponent.CMyClass")
          vntResult = objMyComponent.DebugTest(vntNum1, vntNum2)
          Response.Write(vntResult)
       %>
    					
  10. Place a breakpoint within the ASP page on the line that calls the DebugTest method.
  11. In the Project Explorer window of Visual InterDev, right-click this ASP page, and then click Set As Start Page.
  12. From the Debug menu, click Start (or press F5) to run the program.
NOTE: If your project is not already configured within Microsoft Internet Information Server (IIS) for debugging, Visual InterDev prompts you to set this up. Click Yes in all of the dialog boxes that Visual InterDev presents, and Visual InterDev configures this automatically. Also note that the function keys that are used for debugging are different in Visual InterDev and Visual Basic.

If the DLL is already loaded, you must restart IIS before you can debug the DLL, or you cannot stop on breakpoints. To restart IIS 4.0, type the following commands at a command prompt:

Net Stop IISAdmin /y
MTXSTOP
Net Start W3SVC

To restart IIS 5.0, type the following command at a command prompt:

iisreset

REFERENCES

For additional information%1, click the article numbers below to view the articles in the Microsoft Knowledge Base:

198432 PRB: Server Object Error 'ASP 0178' Instantiating COM Object

259725 PRB: Error When You Debug COM+ in the VB IDE with ASP Client

244272 INFO: Visual InterDev 6.0 Debugging Resources


Modification Type:MinorLast Reviewed:7/1/2004
Keywords:kbBug kbDebug kbhowto KB200998