-
Notifications
You must be signed in to change notification settings - Fork 256
install
qiannian edited this page Jun 13, 2026
·
5 revisions
插件和配套工具可在这里获得 Github
把注册插件到系统
把下载下来的插件解压后,选中文件目录中的:install.bat右击以管理员的身份运行
手动使用 cmd 命令行进行注册
cd /d op路径
regsvr32 op_x86.dll项目 tools/ 工程会生成免注册辅助 DLL,当前产物默认名为 tools.dll。如果发布包中重命名为 tool.dll,示例中的文件名按实际文件名修改即可。此文件导出 2 个函数:
setupA(path): A 表示 ANSI 字符集,使用 ANSI 字符编码
setupW(path): W 表示宽字符集,使用 Unicode 字符编码
| 参数 | 类型 | 描述 |
|---|---|---|
| path | string | 指定 op_x86.dll 或 op_x64.dll 的路径。 |
返回值
类型:int
- 0:表示操作失败。
- 1:表示操作成功。
使用流程
- 当前进程、
tools.dll、op_x86.dll/op_x64.dll的位数必须一致。 - 先加载
tools.dll,调用setupW或setupA。 -
setupW/setupA返回 1 后,再使用op.opsoft创建 COM 对象。 - 免注册只在当前进程内生效,不会写入系统注册表。
示例一
typedef int (__cdecl *setupW_t)(const wchar_t *path);
HMODULE tool = LoadLibraryW(L"./x64/tools.dll");
setupW_t setupW = (setupW_t)GetProcAddress(tool, "setupW");
int result = setupW(L"./x64/op_x64.dll");
if (result != 1) {
printf("免注册加载 op_x64.dll 失败!");
return;
}
printf("免注册加载 op_x64.dll 成功!");示例二
import ctypes
from win32com.client import Dispatch
# 加载免注册工具 DLL
dll = ctypes.CDLL("./x64/tools.dll")
dll.setupW.argtypes = [ctypes.c_wchar_p]
dll.setupW.restype = ctypes.c_int
# setupW 必须在 Dispatch 之前调用
result = dll.setupW("./x64/op_x64.dll")
# 如果 result 不等于 1,则执行失败
if result != 1:
exit(0)
# 创建对象
op = Dispatch("op.opsoft")
# print version of op 打印op插件的版本
print(op.Ver())更多示例