首先感谢郎大大的源码分享,并指明出处 http://bbs.mjtd.com/thread-112653-1-1.html
这个是郎大大分享的一段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)
- )
|