Results 1 to 4 of 4

Thread: Unregister and Delete Dlls programmatically

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276

    Unregister and Delete Dlls programmatically

    Hi,
    I am writing an application that will Unregister and delete the Dlls in a given directory structure. I tried this in 2 ways but am having problems in both.

    1) I tried the ShellExecute to do this using the "open" verb but this resulted in the successful/unsuccessful Notification message. The appln would be functioning for a batch of DLLs and I don't want a notification to be sent. Is this possible? How do i disable notifications?
    VB Code:
    1. l = ShellExecute(Me.hwnd, "Open", "c:/Winnt/system32/regsvr32.exe /u", "D:/Dlls/xxxx.dll", "c:/", SW_HIDE)
    2) Secondly I tried this code borrowed from an article posted by Clunietp. Here the difficulty i encountered was that the Dll had to be hardcoded in the Declaration Statement itself. Anyone has any ideas on how the DLL can be passed as an argument to a similar API Call?
    VB Code:
    1. Private Declare Function UnRegComCtl32 Lib "D:/DLLs/xxxx.dll" _
    2.          Alias "DllUnregisterServer" () As Long
    Also, I want ways to clean the registry entries - Class IDs of the deleted DLLs. Any ideas?

    thanks,
    Jemima.
    Last edited by JemimaChadwick; Sep 26th, 2001 at 05:45 AM.

  2. #2
    jim mcnamara
    Guest
    This code sample gets around the hard-coded problem for calling DllUnRegister or DllRegister - from allapi.net

    http://www.allapi.net/apilist/exampl...er%20Server%20(2)

  3. #3
    Addicted Member Michael Woolsey's Avatar
    Join Date
    Nov 2000
    Location
    Calgary, Alberta, Canada.
    Posts
    243
    Try adding the /s option to your regsvr32 call...
    VB Code:
    1. l = ShellExecute(Me.hwnd, "Open", "c:/Winnt/system32/regsvr32.exe /s /u", "D:/Dlls/xxxx.dll", "c:/", SW_HIDE)
    Also jims link is broken... try this one: http://www.allapi.net/apilist/exampl...20Server%20(2)

    Hope this helps
    Michael
    Last edited by Michael Woolsey; Sep 26th, 2001 at 10:42 AM.
    Application/Web Developer

    Visual Basic 6.0 SP5
    Active Server Pages
    Oracle 9i
    - I'm going to live forever, or die trying!

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276

    Ultimate!

    Thanks Michael. That did it!

    Thanks to u too, jim. But my app terminates with a VBSTAT.exe Application Error on call to
    VB Code:
    1. CallWindowProc(pa, hWnd, ByVal 0&, ByVal 0&, ByVal 0&)
    Anyhow, now everything's fine! I got the app working.

    Still, What about the Registry? Even if I unregister and delete Dlls this way, the class-id(s) would remain in the registry right? Anyone know any application or code for cleaning the registry from "hanging references"?

    - Jemima.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width