WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

CTL3D

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Killing off CTL3DV2.DLL

Keywords: CTL3DV2.DLL CTL3D 

On some systems, a rogue copy of CTL3DV2.DLL somehow got installed and thus becomes the default CTL3DV2.DLL used by applications, (including WinBatch).

The rogue copy, not being in the Windows/System directory, whines at startup about not being properly installed.

So how do you delete the rogue copy so that the real copy will function?

Please note that there are related articles in the tech support database about CTL3D. (Search for CTL3D to find them.) Before assuming that all you need to do is to delete the bad copy, read the other articles and be sure that there is not a single copy of the DLL with multiple drive mappings confusing the situation.

Here is some code, assuming a compiled winbatch.exe file: Note that there may be bugs in this code. They are left in as an exercise for the reader...

;Define name of DLL to kill
Dll2Kill=strlower("C:\Windows\System\ctl3dv2.dll")

;Check PrettyDialogs flag
PrettyDialogs=IniReadPvt("Main","PrettyDialogs",1,"wwwbatch.ini")

if PrettyDialogs==1    ; Dll possiby in use
   ;Find name of DLL we are using...
   DLLInUse=strlower(FileLocate("ctl3dv2.dll"))

   if DllInUse==Dll2Kill  ; Can't do it on this pass, use workaround
      ;Turn PrettyDialogs flag off
      IniWritePvt("Main","PrettyDialogs",0,"wwwbatch.ini")
      ;Run this smae script again
      Run(WinExeName(""),"")
      ;and exit
      exit
   else
     ; We're not using that copy.	Ought to be able to just delete the turkey
       If FileExist(Dll2Kill)
	  ErrorMode(@off)
	  LastError()
	  FileDelete(Dll2Kill)
	  err=LastError()
	  ErrorMode(@CANCEL)
	  if err!=0
	     Message("Dll in use, not deleted",Dll2Kill)
	  else
	     Message("Dll Deleted",Dll2Kill)
	  endif
	  exit
       endif
    endif
 
else	   ; PrettyDialogs==0 
   ; Wait for prior incarnation to exit(and free up dll
   TimeDelay(8)
   If FileExist(Dll2Kill)
       ErrorMode(@off)
       LastError()
       FileDelete(Dll2Kill)
       err=LastError()
       ErrorMode(@CANCEL)
       if err!=0
	  Message("Dll in use, not deleted",Dll2Kill)
       else
	  Message("Dll Deleted",Dll2Kill)
       endif
   endif
   IniWritePvt("Main","PrettyDialogs",1,"wwwbatch.ini") ; turn pretty dialogs back on
endif
exit




Article ID:   W12801
Filename:   CTL3D How to delete.txt
File Created: 1999:04:15:16:49:44
Last Updated: 1999:04:15:16:49:44