How to unregister dll automatically when reached a specifi date/time?

Posted on 2004-11-30
Last Modified: 2008-02-01
Hi all,

I've developed a dll by programming with VB6 named "MyDLL.dll" and also register to system by calling "regsvr32 D:\mydll.dll". I just want to know how can i unregister it in programming VB. Here is the scenario:

After 4 days since register the dll, i want to dll will unregister itself from system? How can i do that?
Question by:dungla
    LVL 6

    Expert Comment

    you cant have your dll unregister automatically - but you can have it check the datediff of when it was installed and when its being accessed.

    you can store the install date in the registry to check on access or in a text file.
    LVL 16

    Accepted Solution

    You can also just schedule the unregister, figure out the day of week that is 4 days from now and in a DOS script do...

    at 12:01 /next:Thursday "regsvr32 -u D:\mydll.dll"

    or figure out the  day of month and do...

    at 12:01 /next:17 "regsvr32 -u D:\mydll.dll"

    On windows 2000 and later, these will run in the system account.
    LVL 1

    Expert Comment

    You can unregister it in code by shelling regsvr32 like so - Shell "regsvr32.exe MyDLL.dll" & Space(1) & "/u  /s"
    LVL 13

    Author Comment


    I have only one file, is the DLL file, how can I make it run the shell code automatically?

    Thank for your solution
    LVL 1

    Expert Comment

    Oops! Guess I read the question too quickly. Hope the other solution works!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now