zzxm 发表于 2008-11-7 21:11:00

我在学习中

wxl6503 发表于 2008-12-16 20:13:00

<p>我也想学学!</p>

zhanzhe 发表于 2008-12-17 22:27:00

郁闷!看不了!唉,等吧!努力吧!

清河静 发表于 2008-12-19 19:54:00

尊重你,等我有了41个帖子再来.

我冲 发表于 2008-12-19 21:06:00

<p>这个好像很重要啊,我也弄过就是把时间一改还是能用,学习下,</p><p>还有能不能想办法限制次数呢?</p><p></p>

我冲 发表于 2008-12-19 21:25:00

<p>这么多啊,还要41,等等了</p>

357785513 发表于 2008-12-19 23:53:00

这种贴我本来是不想回的

<p>这种贴我本来是不想回的.但看大家那么热情,还是回一下吧,看看这个.也许在某个方面能帮上你的</p><p>;;;Copyrignt chengqiang Lin 2008 for mengyang<br/>;;;为梦扬软件添加使用期限<br/>(defun my_a_date ()<br/>(setq mengyang_code_e<br/>(vl-registry-read<br/>&nbsp;&nbsp;&nbsp; "HKEY_CURRENT_USER\\Software\\MengYang"<br/>&nbsp;&nbsp;&nbsp; "my_code_date_start"<br/>)<br/>);<font color="#ff0000">读出首次安装梦扬软件的日期 </font><br/>(if (/= mengyang_code_e nil)<br/>(progn<br/>(setq mengyang_code_e<br/>(vl-registry-read<br/>&nbsp;&nbsp;&nbsp; "HKEY_CURRENT_USER\\Software\\MengYang"<br/>&nbsp;&nbsp;&nbsp; "my_code_date_start"<br/>)<br/>);<font color="#ff0000">如果已经安装梦扬则读出首次安装梦扬软件的日期</font><font color="#ff0000">
                        <br/></font>(setq OLD_x (atof mengyang_code_e))<br/>(setq OLD (substr mengyang_code_e 3 2))<br/>(setq OLD_1 (atof OLD))<br/>(setq OLD_2 (- 30 OLD_1))<br/>(setq OLD_3 (- (+ (+ 30 OLD_x) 100) (+ OLD_1 OLD_2)));;;+<font color="#ff0000">30天试用</font><br/>(setq date_d_e (getvar "cdate"))<font color="#ff0000">;;;获取当前日期</font><br/>(setq date_d_1_e (rtos date_d_e 2 20))<br/>(setq date_d_2_e (substr date_d_1_e 5 4))<br/>(setq date_d_3_e (atof date_d_2_e))<br/>(setq my_da (- OLD_3 date_d_3_e))<br/>(if (&gt; my_da 30.0)(setq my_da (- 30 (- 100 My_da)))(princ))<br/>(if (&gt; my_da 30.0)(vl-registry-delete "HKEY_CURRENT_USER\\Software\\MengYang" "code")(princ))<br/><font color="#ff0000">;;剩余的使用日期</font><br/>(setq LP1 "\n--&gt;距你使用梦扬软件的最后期限还剩")<br/>(setq LP3 "天!")<br/>(setq LP2 (rtos my_da))<br/>(setq Princ_LP (strcat LP1 LP2 LP3))<br/>(cond <br/>((&lt;= my_da 0)(alert "\n梦扬软件已经到了使用期限,请你重新注册!")(vl-registry-delete "HKEY_CURRENT_USER\\Software\\MengYang" "code"))<br/>((&lt;= my_da 30)(prompt Princ_LP))<br/>((&gt; my_da 30)(alert "\n梦扬软件已经到了使用期限,请你重新注册!")(vl-registry-delete "HKEY_CURRENT_USER\\Software\\MengYang" "code"))<br/>)<br/>)<br/>(princ)<br/>)<br/>)<br/>------------------------------------------------------------------------------------</p><p>Lisp主代码(2)--主注册程序:</p><p>------------------------------------------------------------------------------------<br/>;;;梦扬软件注册模块<br/>;;;Copyrignt chengqiang Lin 2008 for mengyang<br/>(defun huanying_f ()<br/>(vl-load-com)<br/>(mc_PopupBox<br/>&nbsp;&nbsp;&nbsp; "请注册梦扬软件!"<br/>&nbsp;&nbsp;&nbsp; 0.5<br/>&nbsp;&nbsp;&nbsp; "提示:"<br/>&nbsp;&nbsp;&nbsp; 48<br/>)<br/>);;;<font color="#ff0000">首次运行提示注册</font><br/>(defun error_m ()<br/>(vl-load-com)<br/>(mc_PopupBox<br/>&nbsp;&nbsp;&nbsp; "注册码有误,请检查注册码,或向林承强寻求帮助!"<br/>&nbsp;&nbsp;&nbsp; 0.5<br/>&nbsp;&nbsp;&nbsp; "警告:"<br/>&nbsp;&nbsp;&nbsp; 48<br/>);<font color="#ff0000">注册失败提示信息</font><br/>(command "TEXTSCR");<font color="#ff0000">弹出窗口,类似按下F2</font><br/>)<br/>(defun mycopyright ();<font color="#ff0000">主函数</font><br/>(setq mengyang_code<br/>(vl-registry-read "HKEY_CURRENT_USER\\Software\\MengYang" "code")<br/>);读随机数<br/>(if (= mengyang_code nil);<font color="#ff0000">如果随机数不存在就创建随机数</font><br/>&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq cpr (getvar "cputicks"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq cpr_1 (rtos cpr))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq cpr_1_1 (substr cpr_1 4 8))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq mengyang_code<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vl-registry-write<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "HKEY_CURRENT_USER\\Software\\MengYang"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "code"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cpr_1_1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ));<font color="#ff0000">将随机数写入到系统注册表</font><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (princ)<br/>)<br/>(setq m_code<br/>(vl-registry-read "HKEY_CURRENT_USER\\Software\\MengYang" "code")<br/>)<br/>(setq sn<br/>(vl-registry-read "HKEY_CURRENT_USER\\Software\\MengYang" "sn")<br/>)<br/>(setq cpr_right (* (/ (/ (atoi m_code) 3) 4) 7)));<font color="#ff0000">注册码算法</font><br/>(if (/= sn nil)<br/>&nbsp;&nbsp;&nbsp; (setq sn (atoi sn))<br/>&nbsp;&nbsp;&nbsp; (princ)<br/>)<br/>(if (/= sn cpr_right)<br/>&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (huanying_f)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt "\n请注册梦扬软件")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq my_meg (strcat "\n请记住你的随机数是:" m_code))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt my_meg)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt my_meg)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq cv (load_dialog "cv.dcl"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq what_next 2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (while (&gt;= what_next 2)<br/>(if (null (new_dialog "my" cv)));<font color="#ff0000">加载对话框</font><br/>&nbsp;&nbsp; (exit)<br/>)<br/>(action_tile "code_cv" "(setq code_cv $value)")<br/>(action_tile<br/>&nbsp;&nbsp; "code_cv_ps"<br/>&nbsp;&nbsp; "(setq code_cv_ps $value)(setq code_cv_ps (atoi code_cv_ps))"<br/>)<br/>(action_tile "ok" "(done_dialog 1)")<br/>(action_tile "cancel" "(done_dialog 0)")<br/>(set_tile "code_cv" m_code)<br/>(mode_tile "code_cv" 1)<br/>(setq what_next (start_dialog))<br/>(cond<br/>&nbsp;&nbsp; ((= what_next 4)<br/>&nbsp;&nbsp;&nbsp; (PTT_MX)<br/>&nbsp;&nbsp;&nbsp; (command "osnap" "mid,int,end")<br/>&nbsp;&nbsp; )<br/>&nbsp;&nbsp; ((= what_next 0)<br/>&nbsp;&nbsp;&nbsp; (prompt "\n用户取消了操作!\n用户取消了操作!")<br/>&nbsp;&nbsp; )<br/>)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (unload_dialog cv)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt my_meg)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt my_meg)<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (princ)<br/>)<br/>(if (= code_cv_ps cpr_right));<font color="#ff0000">成功注册后将注册信息写入到注册表</font><br/>&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (alert<br/>"\n--&gt;非常感谢!你已成功注册梦扬软件,感谢你的使用."<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq code_cv_ps_s (rtos code_cv_ps))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq sn (vl-registry-write<br/>&nbsp;&nbsp; "HKEY_CURRENT_USER\\Software\\MengYang"<br/>&nbsp;&nbsp; "sn"<br/>&nbsp;&nbsp; code_cv_ps_s<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq sn_cn (vl-registry-write<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "HKEY_CURRENT_USER\\Software\\MengYang"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "梦扬软件注册码"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; code_cv_ps_s<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>(setq date_d (getvar "cdate"))<br/>(setq date_d_1 (rtos date_d 2 20))<br/>(setq date_d_2 (substr date_d_1 5 4))<br/>(setq mengyang_code(vl-registry-write "HKEY_CURRENT_USER\\Software\\MengYang" "my_code_date_start"&nbsp;&nbsp; date_d_2 ))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (/= sn nil)<br/>(setq sn (atoi sn))<br/>(princ)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq sn_at (vl-registry-write<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "HKEY_CURRENT_USER\\Software\\MengYang"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "action"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "on"<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq sn_2 (vl-registry-write<br/>&nbsp;&nbsp;&nbsp;&nbsp; "HKEY_CURRENT_USER\\Software\\MengYang"<br/>&nbsp;&nbsp;&nbsp;&nbsp; "sn_2"<br/>&nbsp;&nbsp;&nbsp;&nbsp; "on"<br/>&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq code_cv_ps nil)<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (princ)<br/>)<br/>(if (= sn cpr_right)<br/>&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt "\n--&gt;你已成功注册梦扬软件,感谢使用!")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vl-registry-delete "HKEY_CURRENT_USER\\Software\\MengYang" "sn_2")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq cpr_right nil)<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (error_m)<br/>)<br/>)</p><p>------------------------------------------------------------------------------------</p><p>Lisp主代码(3)--用到的一个函数:</p><p>(defun mc_PopupBox (strText intWaitTime strTitle intDispType)<br/>(vlax-invoke-method<br/>&nbsp;&nbsp;&nbsp; (vlax-create-object "wscript.shell")<br/>&nbsp;&nbsp;&nbsp; 'Popup<br/>&nbsp;&nbsp;&nbsp; strText<br/>&nbsp;&nbsp;&nbsp; intWaitTime<br/>&nbsp;&nbsp;&nbsp; strTitle<br/>&nbsp;&nbsp;&nbsp; intDispType<br/>)<br/>)</p><p>------------------------------------------------------------------------------------</p><p>Lisp主代码(4)--对话框DCL对话框代码:</p><p>&nbsp;&nbsp;&nbsp; my : dialog {<br/>&nbsp;&nbsp;&nbsp; label = "-注册梦扬软件-梦扬软件-林承强";<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :column{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :column{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :boxed_column {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label = "数据窗口";<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :column{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : edit_box {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; label = "用户随机数:";<br/>&nbsp;&nbsp;&nbsp; key&nbsp;&nbsp; = "code_cv";<br/>&nbsp;&nbsp;&nbsp; width = 5;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :column{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : edit_box {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; label = "注册码  :";<br/>&nbsp;&nbsp;&nbsp; key&nbsp;&nbsp; = "code_cv_ps";<br/>&nbsp;&nbsp;&nbsp; width = 5;<br/>}<br/>}<br/>}<br/>}<br/>}<br/>ok_cancel;<br/>&nbsp;&nbsp;&nbsp; }</p><p>------------------------------------------------------------------------------------</p><p>试例:</p><p>------------------------------------------------------------------------------------<br/>;;;尺寸标准强制检测<br/>;;;Copyrignt chengqiang Lin 2008 for mengyang<br/>(defun c:j ();;;<font color="#ff0000">你定义的主程序<br/></font>(mycopyright);;;<font color="#ff0000">首先加载注册验算可以将(mycopyright)放到你的子程序这个位置,当执行J命令时程序首先执行注册验算,通过后才执行下面的代码.</font><br/>(setvar "cmdecho" 0) (setq KE 0)<br/>(setq plot_max (getvar "extmax"))<br/>(setq plot_min (getvar "extmin"))<br/>(setq plot_max_1 (car plot_max))<br/>(setq plot_max_2 (cadr plot_max))<br/>(setq plot_max (list plot_max_1 plot_max_2))<br/>(setq plot_min_1 (car plot_min))<br/>(setq plot_min_2 (cadr plot_min))<br/>(setq plot_min (list plot_min_1 plot_min_2))<br/>(setq ss (ssget "c" plot_min plot_max '((0 . "DIMENSION")))n 0)<br/>(setq date_s (getvar "cdate"))<br/>(setq date_s_1 (rtos date_s 2 20)).....................................</p>

庞琛虹 发表于 2008-12-20 09:28:00

<p>哈哈..学习</p><p></p>

kezhouljc 发表于 2008-12-24 10:16:00

看不到,基本需要努力一下。

llc1968 发表于 2008-12-26 20:05:00

哈哈,看不见呀!!!
页: 1 2 3 4 5 6 7 8 9 10 [11] 12 13 14 15 16 17 18 19 20
查看完整版本: 程序期限的设定