HOWTO: Debug a Visual Basic DLL from Visual InterDev

ID: Q200998


The information in this article applies to:
  • Microsoft Visual InterDev, version 6.0
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 6.0


SUMMARY

This article demonstrates how to debug a Visual Basic ActiveX DLL using Visual InterDev 6.0 or later.


MORE INFORMATION

The COM DLL needs to be registered on the machine that is creating (Server.CreateObject) the object.

Step-by-Step Example

  1. Start Visual Basic on the machine 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, select Make MyVBComponent.dll.


  6. Set a breakpoint on the "DebugTest = vntNum1 + vntNum2" line in the DLL.


  7. From the Run menu, select Start (F5) 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 calling the DebugTest method.


  11. Right-click on this ASP page within Visual InterDev's Project Explorer and select Set As Start Page.


  12. From the Debug menu, select Start (F5) to run the program.


NOTE: If your project is not already configured within Internet Information Server (IIS) for debugging, Visual InterDev will prompt you to set this up. Click Yes from all the dialog boxes presented by Visual InterDev, and Visual InterDev will configure this automatically. Also note that the function keys used for debugging are different in Visual InterDev and Visual Basic.

If the DLL is already loaded you will have to restart IIS before being able to debug the DLL or you will not be able to stop on breakpoints.

You can restart IIS by running the following commands from a command prompt:
Net Stop IISAdmin /y
MTXSTOP
Net Start W3SVC

Additional query words:

Keywords : kbASP kbDebug kbVBp600 kbVisID600 kbGrpASP
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: January 27, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.