--将打印功能在注册表修改为开机启动
isExist = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
if (isExist) then
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "WorkerService.Printer",
SessionVar.Expand("%AppFolder%\\Printer\\WorkerService.Printer.exe"), REG_SZ);
else
Registry.CreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "WorkerService.Printer",
SessionVar.Expand("%AppFolder%\\Printer\\WorkerService.Printer.exe"), REG_SZ);
end
--将打印功能在注册表修改为开机启动
本文介绍如何通过修改注册表实现打印服务随系统启动自动运行。首先检查注册表项是否存在,若存在则直接设置值;若不存在,则创建相应注册表项并设置值。具体步骤包括使用Registry.DoesKeyExist检查HKEY_LOCAL_MACHINE下指定路径是否存在,存在则调用Registry.SetValue设置WorkerService.Printer值,否则先创建键再设置值。
1887

被折叠的 条评论
为什么被折叠?



