明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2434|回复: 7

能动态的向注册表中写 、读系统时间吗?

[复制链接]
发表于 2004-3-23 18:47:00 | 显示全部楼层 |阅读模式
我室这样写的,但调试后发现vl-registry-wrie函数中的<值>参数不能运算,比如 (setq date (rtos (getvar "cdate") 2 8))......... (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\test" "date")...... 这样之后,到注册表中去查,结果是date,不是想要的时间。不知道怎么了。请斑竹指点。 下面是我想要达到目的的代码: (defun copyrighets-protected ()
;;sub
(defun getvalue (vlist key)
(cdr(assoc key vlist))
)
;;sub
(defun remainingday (nowday oldday)
(- (+ (* 356 (getvalue nowday "year")) (* 30 (getvalue nowday "month")) (* 1 (getvalue nowday "day")))
(+ (* 356 (getvalue nowday "year")) (* 30 (getvalue nowday "month")) (* 1 (getvalue nowday "day")))
)
)
;;
(setq date (rtos (getvar "cdate") 2 8 ))
(setq year (read (substr date 1 4 ))
month (read (substr date 5 2))
day (read (substr date 7 2))
)
(setq nowdate (list (cons "year" year) (cons "month" month) (cons "day" day )))
(vl-load-com)
(if(not(setq registrydate (vl-registry-read
"HKEY_CURRENT_USER\\Software\\Autodesk\\quickplotrights"
"registrydate"
)
)
)
(vl-registry-write
"HKEY_CURRENT_USER\\Software\\Autodesk\\quickplotrights"
"registrydate"
"nowdate"
)
(setq rday (remainingday nowdate (read registrydate)))
)
)
发表于 2004-3-23 19:05:00 | 显示全部楼层
你写的是"data",结果当然是"data"了,一个字符串怎么会运算?你并没有将变量data写到注册表中,你加了引号,仅表示字符串"data",同变量data除了看起来比较像以外,就没有什么关系了
 楼主| 发表于 2004-3-23 21:37:00 | 显示全部楼层
那么 如果是(setq a '( 1 2         12))这样的表,我怎样把a 写到注册表?
发表于 2004-3-23 21:44:00 | 显示全部楼层
转化成字符串
 楼主| 发表于 2004-3-24 12:41:00 | 显示全部楼层
好象不能把表直接转换成字符串把!?


请你指点一下,谢谢了。
发表于 2004-3-24 15:15:00 | 显示全部楼层
(vl-prin1-to-string .....)
 楼主| 发表于 2004-3-24 17:53:00 | 显示全部楼层
谢谢,谢谢。我还需努力!
发表于 2004-3-25 08:14:00 | 显示全部楼层
(defun COPYRIGHETS-PROTECTED-LAI (/ NOWDATE REGISTRYDATE)
(defun REMAININGDAY (NOWDAY OLDDAY)
(- (+ (* 356 (atoi (substr NOWDAY 1 4)))
(* 30 (atoi (substr NOWDAY 5 2)))
(* 1 (atoi (substr NOWDAY 7 2)))
)
(+ (* 356 (atoi (substr OLDDAY 1 4)))
(* 30 (atoi (substr OLDDAY 5 2)))
(* 1 (atoi (substr OLDDAY 7 2)))
)
)
)
(vl-load-com)
(setq NOWDATE (rtos (getvar "cdate") 2 8))
(if (not (setq REGISTRYDATE
(vl-registry-read
"HKEY_CURRENT_USER\\Software\\Autodesk\\quickplotrights"
"registrydate"
)
)
)
(vl-registry-write
"HKEY_CURRENT_USER\\Software\\Autodesk\\quickplotrights"
"registrydate"
NOWDATE
)
)
(REMAININGDAY NOWDATE REGISTRYDATE)
) ;;(vl-registry-delete "HKEY_CURRENT_USER\\Software\\Autodesk\\quickplotrights")
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 23:50 , Processed in 0.257197 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表