本帖最后由 xiaoyingzi 于 2011-8-31 23:17 编辑
- (defun c:setmycadtitle (/ app acadver wrap hwnd filename str hico)
- (vl-load-com)
- (setq app (vlax-get-acad-object)) ;CAD程序对象
- (setq acadver (atof (getvar "acadver"))) ;获取当前cad版本
- (setq wrap (vlax-create-object "DynamicWrapperX")) ;创建DynamicWrapperX对象
- (setq hwnd (vla-get-hwnd app)) ;当前文档句柄
- (cond
- ((= acadver 16.0)(setq str "xxxx For AutoCAD 2004"))
- ((= acadver 16.1)(setq str "xxxx For AutoCAD 2005"))
- ((= acadver 16.2)(setq str "xxxx For AutoCAD 2006"))
- ((= acadver 17.0)(setq str "xxxxFor AutoCAD 2007"))
- ((= acadver 17.1)(setq str "xxxx For AutoCAD 2008"))
- ((= acadver 17.2)(setq str "xxxx For AutoCAD 2009"))
- ((= acadver 18.0)(setq str "xxxx For AutoCAD 2010"))
- )
- (setq filename "mykey.ico")
- (vlax-invoke wrap 'Register "USER32" "SetWindowText" "i=ls" "r=l") ;注册SetWindowText函数
- (vlax-invoke wrap 'SetWindowText hwnd str) ;重设CAD程序标题窗口文字内容
- (vlax-release-object wrap)
- (princ)
- )
使用前需注册下http://bbs.mjtd.com/forum.php?mod=viewthread&tid=85724&highlight=api里的DynWrapX.dll 文件
|