VB app doesn't terminate. Stays resident?

Discussion in 'AutoCAD' started by Jason Smith, Feb 20, 2004.

  1. Jason Smith

    Jason Smith Guest

    Thank you all for your help. It turned out to be a simple typo in my active
    x dll. Spent many hours for something so simple. Now the routine works and
    the speed is excellent.

    I do have one question. After the app completes, it does not unload.
    Taskmanager still indictes it is running. And each time I run the app, it
    adds another to the list, etc.

    Is there something I am not doing?

    The code is:

    Public Sub Cleanse()

    On Error Resume Next

    Set AcadApp = GetObject(, "AutoCAD.Application")
    If Err Then
    Err.Clear
    Set AcadApp = CreateObject("AutoCAD.Application")
    End If

    Set DwgCleaner = AcadApp.GetInterfaceObject("CleanerDll.CleanerClass")

    Dim obj As Object
    Dim lyr As Object
    Dim blk As Object
    Dim piece As Object
    Dim DimSt As Object

    For Each oFile In CleanFileList

    FileCopy SourceLoc + "\" + oFile, WorkingLoc + "\" + oFile
    AcadApp.Documents.Open (WorkingLoc + "\" + oFile)

    Call DwgCleaner.CleanerSub(AcadApp) ' My dll that cleans the files

    AcadApp.ActiveDocument.Save
    AcadApp.ActiveDocument.Close

    Next oFile

    End Sub
     
    Jason Smith, Feb 20, 2004
    #1
  2. Where are you setting your dll's object to nothing? Also, are you using
    Option Explicit?

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    Thank you all for your help. It turned out to be a simple typo in my active
    x dll. Spent many hours for something so simple. Now the routine works and
    the speed is excellent.

    I do have one question. After the app completes, it does not unload.
    Taskmanager still indictes it is running. And each time I run the app, it
    adds another to the list, etc.

    Is there something I am not doing?

    The code is:

    Public Sub Cleanse()

    On Error Resume Next

    Set AcadApp = GetObject(, "AutoCAD.Application")
    If Err Then
    Err.Clear
    Set AcadApp = CreateObject("AutoCAD.Application")
    End If

    Set DwgCleaner = AcadApp.GetInterfaceObject("CleanerDll.CleanerClass")

    Dim obj As Object
    Dim lyr As Object
    Dim blk As Object
    Dim piece As Object
    Dim DimSt As Object

    For Each oFile In CleanFileList

    FileCopy SourceLoc + "\" + oFile, WorkingLoc + "\" + oFile
    AcadApp.Documents.Open (WorkingLoc + "\" + oFile)

    Call DwgCleaner.CleanerSub(AcadApp) ' My dll that cleans the files

    AcadApp.ActiveDocument.Save
    AcadApp.ActiveDocument.Close

    Next oFile

    End Sub
     
    R. Robert Bell, Feb 20, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.