首页 > 课堂 > 电脑知识 > 正文

DLL(OCX)文件注册与反注册方法(regsvr32用法)

2024-05-08 13:47:33
字体:
来源:转载
供稿:网友
注册DLL与反注册DLL文件的方法

如果经常需要注册与反注册dll可以用注册表文件

复制代码
代码如下:
[HKEY_CLASSES_ROOT/dllfile/shell/Unregister]
"Command"="regsvr32 %1 /u"
[HKEY_CLASSES_ROOT/dllfile/shell/Register]
"Command"="regsvr32 %1"

当我们需要注册或者反注册dll时,只要在该dll文件上按下鼠标右键即可!

由于下面的方法太过啰嗦,这里简单的说下,注册dll

一般情况下,为了经常使用,建议将dll复制到系统盘的windows/system32目录,如果不是的,有时候需要加上dll的完整路径
注册dll

复制代码
代码如下:
regsvr32 /s winshow.dll

反注册dll

复制代码
代码如下:
regsvr32 /u winshow.dll


ocx 控件注册方法

ocx 控件的安装方式有很多种,这里介绍最简单的一种。
OCX 控件文件复制到某个目录

步骤:

1.将需要安装的目录,例如 C 盘根目录下。
2.进入开始菜单,点击“运行”
3.在出现的框中键入regsvr32 C:/xxxx.ocx 。(XXXX 为 控件名,C:/为目录)
4.点击确认后等待出现提醒注册成功即可。

如果是偶尔一个软件使用,将这个ocx文件复制到软件目录即可。

反注册DLL大法
UnRegister DLLs
You can use the Regsvr32 tool (Regsvr32.exe) to register and unregister object linking and
embedding (OLE) controls such as dynamic-link library (DLL) or ActiveX Controls (OCX) files
that are self-registerable.

RegSvr32.exe has the following command-line options:
Regsvr32 [/n] [/i[:cmdline]] dllname
/u - Unregister server
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll
uninstall
/n - do not call DllRegisterServer; this option must be used with /i
When you use Regsvr32.exe, it attempts to load the component and call its DLLSelfRegister
function. If this attempt is successful, Regsvr32.exe displays a dialog indicating success.
If the attempt is unsuccessful, Regsvr32.exe returns an error message, which may include a
Win32 error code.
Example: To unregister Winshow's winshow.dll:
Click the Start button, and select Run
Enter this command line:
regsvr32 /u [systemroot]/winshow.dll
For example, in a Windows XP machine in which your systemroot was at c:/winnt, you would
enter:
regsvr32 /u c:/winnt/winshow.dll
你能构使用Regsvr32工具Regsvr32.exe注册和反注册目标链接和深层OLE控制器类似于自动注册的动态链接库(DLL)和ActiveX控件。
(OCX)文件。
Regsvr32命令行参数:
格式:Regsvr32 [/n] [/i[:cmdline命令行]] dllnamedll文件名
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表