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

Miscellaneous

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

How to Register an OCX

Keywords: 	  register OCX

;////////////////////////////////////////////////////////////////////////////////
; Winbatch - down and dirty method to Register/UnRegister DLL OCX's
;
; Typical Call register.wbt E:\WBDEMO\MSFLXGRD.OCX 1 <-- registers
;              register.wbt E:\WBDEMO\MSFLXGRD.OCX 2 <-- unregisters
;
; Stan Littlefield - 01/20/2001
;////////////////////////////////////////////////////////////////////////////////

IF IsDefined(param1)==@NO
   message("Error","Please Enter Complete Path of DLL or OCX to Register/UnRegister")
   exit
Else
   y = StrIndexNc(param1,".DLL",1,@FWDSCAN)
   z = StrIndexNc(param1,".OCX",1,@FWDSCAN)
   If y+z=0
      message("Error","This call only works with .DLL or .OCX Files")
   Endif
Endif

IF IsDefined(param2)==@NO
   message("Error","Must Enter 2nd Parameter: 1=Register 2=Unregister")
   exit
Endif


If param2=='1'
   x = DllCall("%param1%", long:"DllRegisterServer")
   If x<>0
      message("Error","Could Not Register %param1%.")
   Else
      message("Success","%param1% Registered.")
   Endif
Else
   x = DllCall("%param1%", long:"DllUnregisterServer")
   If x<>0
      message("Error","Could Not Register %param1%.")
   Else
      message("Success","%param1% UnRegistered.")
   Endif
Endif

exit


Article ID:   W14866
File Created: 2006:01:03:09:34:28
Last Updated: 2006:01:03:09:34:28