ActiveX DLL unload delay


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: ActiveX DLL unload delay

  1. #1
    Tim Tow, CPA MCSD Guest

    ActiveX DLL unload delay

    Hi Dan,

    In the MSDN article, "Starting and Ending a Component"
    (http://msdn.microsoft.com/library/de.../vbconstarting
    endingcomponent.htm), there is the following note:

    "A client application written in Visual Basic may not attempt to unload an
    in-process component immediately after the last reference is released. The
    frequency of attempts depends on how frequently idle time becomes available;
    in general it will be around two minutes."

    I am currently experiencing this exact thing where I have a component that
    *apparently* releases all object references, etc and the ActiveX DLL will
    unload after 2-3 minutes... Do you know of a way to *gracefully force*
    (what an oxymoron!) this DLL to unload.. Would FreeLibrary work (and
    would it unload dependent DLL's as well?)

    Tim

    --
    Tim Tow, CPA MCSD
    Microsoft MVP - Excel
    Applied OLAP, Inc






    Share on Google+

  2. #2
    Dan Appleman Guest

    Re: ActiveX DLL unload delay

    Tim:

    Now that's actually an interesting question.

    My first reaction was to think no: FreeLibrary wouldn't work because when VB did
    it's FreeLibrary
    call you would get an error.

    However... it occurred to me that the error might not cause a problem. Under
    newer operating systems,
    FreeLibrary doesn't cause an exception - just returns an error value. And VB
    might not raise a runtime
    error in that case.

    So my suggestion is to try it. Use GetModuleHandle to get the handle and call
    FreeLibrary on it.
    Be absolutely sure all references have truly been released - or you will get
    that exception. If it does work (and be
    sure to test it on all the major OS's), let me know.

    Dan


    "Tim Tow, CPA MCSD" wrote:

    > Hi Dan,
    >
    > In the MSDN article, "Starting and Ending a Component"
    > (http://msdn.microsoft.com/library/de.../vbconstarting
    > endingcomponent.htm), there is the following note:
    >
    > "A client application written in Visual Basic may not attempt to unload an
    > in-process component immediately after the last reference is released. The
    > frequency of attempts depends on how frequently idle time becomes available;
    > in general it will be around two minutes."
    >
    > I am currently experiencing this exact thing where I have a component that
    > *apparently* releases all object references, etc and the ActiveX DLL will
    > unload after 2-3 minutes... Do you know of a way to *gracefully force*
    > (what an oxymoron!) this DLL to unload.. Would FreeLibrary work (and
    > would it unload dependent DLL's as well?)
    >
    > Tim
    >
    > --
    > Tim Tow, CPA MCSD
    > Microsoft MVP - Excel
    > Applied OLAP, Inc


    Share on Google+

  3. #3
    Tim Tow, CPA MCSD Guest

    Re: ActiveX DLL unload delay


    "Dan Appleman" <dan@desaware.com> wrote in message
    news:38F2D1E2.F9272BF9@desaware.com...
    > My first reaction was to think no: FreeLibrary wouldn't work because when

    VB did
    > it's FreeLibrary call you would get an error.


    That is what I thought too.. And we were correct... It crapped in both
    Win98 and Win2000.. I may try and use Numega SmartCheck to spy on the vb
    runtime and see if/what it does to unload..

    Any other takers? Chris Kinsman, Keith Pleas, are you out there?


    --
    Tim Tow, CPA MCSD
    Microsoft MVP - Excel
    Applied OLAP, Inc





    Share on Google+

Similar Threads

  1. ActiveX DLL in ASP
    By Ilse in forum VB Classic
    Replies: 2
    Last Post: 04-20-2002, 08:03 AM
  2. ActiveX DLL in ASP
    By ilse in forum ASP.NET
    Replies: 0
    Last Post: 04-02-2002, 03:52 PM
  3. Calling a DLL from COM+ ActiveX DLL
    By Bruce Casson in forum VB Classic
    Replies: 1
    Last Post: 03-21-2002, 12:51 PM
  4. Sharing single instance of Activex DLL
    By Ed in forum VB Classic
    Replies: 7
    Last Post: 05-11-2001, 09:21 PM
  5. Re: Updating ActiveX DLL
    By Sam Wood in forum Enterprise
    Replies: 0
    Last Post: 05-17-2000, 02:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center