一个简单的lsp注册模块函数
;;; ==============================================
;;; lsp注册模块
;;; 使用方法,将(jiany0001)插到你的程序中即可使用
;;; ==============================================
(defun jiany0001(/ bb dcl_re f fname fsys jqm n zcm)
(vl-load-com)
(defun jy (jqm) ; 算法:注册码=(机器码+144356842)^0.89取整,可自己修改
(itoa (fix (expt (+ (atoi jqm) 144356842) 0.89))))
(setq fsys (vlax-create-object "Scripting.FileSystemObject"))
(if (/= (vlax-invoke-method fsys "DriveExists" "C") :vlax-false)
(setq jqm (itoa (vlax-get-property (vlax-invoke-method fsys "GetDrive" "C") "SerialNumber"))))
(setq zcm (vl-registry-read "HKEY_CURRENT_USER\\Software\\TH++\\" "Number"))
(if (/= zcm (jy jqm))
(progn
(setq fname (vl-filename-mktemp "zhuc.dcl") f (open fname "w"))
(write-line "zhuc:dialog{ label=\"注册信息\";" f)
(write-line ":edit_box{label=\" 机器码\";key=\"e01\";edit_width=18;}" f)
(write-line ":edit_box{label=\" 授权码\";key=\"e02\";edit_width=18;}" f)
(write-line ":row{:button {label=\"注册\";key=\"e03\";is_default=true;}" f)
(write-line ":button {label=\"取消\";is_cancel=true;}}}" f)
(close f)
(new_dialog "zhuc" (setq dcl_re (load_dialog fname)))
(set_tile "e01" jqm)
(set_tile "e02" "联系QQ:XXXXXX")
(action_tile "e03" "(setq zcm(get_tile \"e02\")) (done_dialog 1)")
(if (= (start_dialog) 1)(vl-registry-write "HKEY_CURRENT_USER\\software\\TH++\\" "Number" zcm))
(unload_dialog dcl_re)
(vl-file-delete fname)
(if (/= zcm (jy jqm))
(progn(alert "注册失败!") (exit))
(alert "注册成功!"))))
(princ)
)
;;; =====================================
;;; 配套的注册机程序
;;; =====================================
(defun c:zhuc (/ dcl_re f fname jqm)
(vl-load-com)
(defun jy (jqm) ; 算法:注册码=(机器码+144356842)^0.89取整
(itoa (fix (expt (+ (atoi jqm) 144356842) 0.89))))
(setq fname (vl-filename-mktemp "zhuc.dcl")f (open fname "w"))
(write-line "zhuc:dialog{ label=\"注册机\";" f)
(write-line ":edit_box{label=\" 机器码\";key=\"e01\";edit_width=18;}" f)
(write-line ":edit_box{label=\" 授权码\";key=\"e02\";edit_width=18;}" f)
(write-line ":row{:button {label=\"计算\";key=\"e03\";is_default=true;}" f)
(write-line ":button {label=\"取消\";is_cancel=true;}}}" f)
(close f)
(new_dialog "zhuc" (setq dcl_re (load_dialog fname)))
(action_tile "e03" "(setq jqm(get_tile \"e01\")) (set_tile \"e02\" (jy jqm))")
(start_dialog)
(unload_dialog dcl_re)
(vl-file-delete fname)
(princ)
)
zyx1029 发表于 2024-8-3 18:56
(defun c:tt () ;;; 这个是你的程序启动命令格式
(jiany0001) ;;; 这个就是注册程序检测
下边接 ...
谢谢,我明白了。意思要在我的程序加一行调用一下。 lxl304712346 发表于 2024-7-30 11:42
你的可以,为什么我的没有注册环节?兄弟你怎么改的?
(defun c:tt () ;;; 这个是你的程序启动命令格式
(jiany0001) ;;; 这个就是注册程序检测
下边接着放你的程序源码
例如:
(defun c:Y11(/ gp)
(jiany0001)
(setq gp (ssget)) (command "change" gp "" "p" "c" "1" "")) 这个好,现成的,谢谢分享,
本帖最后由 davide888 于 2015-1-5 15:20 编辑
顶了再说 支持!必须支持!谢谢! 好东西啊 郎大师出品必精品 支持源码! 感谢分享! 顶哦 感谢大师 我就喜欢现成的哈哈感谢 下载来研究一下。。。谢谢分享