scry_wxj 发表于 2011-5-31 22:53:02

求一段在lisp或VBA下更改AutoCAD标题的程序

求一段在lisp或VBA下更改AutoCAD标题的程序,最好是LISP,谢谢扣位大侠了?

highflybird 发表于 2011-5-31 23:47:02

本帖最后由 highflybird 于 2011-5-31 23:50 编辑

新建一个vba文件,插入模块,写入下面的代码:运行即可:

Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Sub test()

   Dim CADhwnd As Long
   CADhwnd = ThisDrawing.Application.hwnd
   Call SetWindowText(CADhwnd, "窗口标题已经改变!")   '改变CAD程序标题
   
   Dim DOChwnd As Long
   DOChwnd = ThisDrawing.hwnd
   Call SetWindowText(DOChwnd, "图形标题已经改变!")   '改变图形窗口标题
   
End Sub

highflybird 发表于 2011-5-31 23:54:05

本帖最后由 highflybird 于 2011-5-31 23:54 编辑

回复 scry_wxj 的帖子

如果用DynamicWrapperX也很简单

(setq DWX (vlax-create-object "DynamicWrapperX"))
(vlax-invoke DWX 'Register "USER32" "SetWindowTextW" "i=lw" "r=l")
(vlax-invoke DWX 'SetWindowTextW (vla-get-hwnd (vlax-get-acad-object)) "呵呵!神了!")
(vlax-release-object DWX)

yanshengjiang 发表于 2011-6-2 20:05:10

回复 highflybird 的帖子

那请问怎么修改cad左上角的图标呢

highflybir 发表于 2011-6-3 00:32:58

本帖最后由 highflybir 于 2011-6-3 00:45 编辑

回复 yanshengjiang 的帖子

(setq DWX (vlax-create-object "DynamicWrapperX"))
(vlax-invoke DWX 'Register "Shell32" "ExtractIconW" "i=lwl" "r=l")
(vlax-invoke DWX 'Register "USER32" "SendMessageW" "i=llll" "r=l")
(setq WM_SETICON 128)
(setq *APP (vlax-get-acad-object))
(setq hWnd (vla-get-hwnd *APP))
(setq icon (vlax-invoke DWX 'ExtractIconW 0 "C:/windows/system32/shell32.dll" 0))
(setq ret(vlax-invoke DWX 'SendMessageW hwnd WM_SETICON 0 icon))
(vlax-release-object DWX)
下面的是获取ACAD.exe的图标。


(setq DWX (vlax-create-object "DynamicWrapperX"))
(vlax-invoke DWX 'Register "Shell32" "ExtractIconW" "i=lwl" "r=l")
(vlax-invoke DWX 'Register "USER32" "SendMessageW" "i=llll" "r=l")
(setq WM_SETICON 128)
(setq *APP (vlax-get-acad-object))
(setq name (vla-get-FullName *APP))
(setq hWnd (vla-get-hwnd *APP))
(setq count (vlax-invoke DWX 'ExtractIconW 0 name -1))
(setq icon (vlax-invoke DWX 'ExtractIconW 0 name 0))
(setq ret(vlax-invoke DWX 'SendMessageW hwnd WM_SETICON 0 icon))
(vlax-release-object DWX)


scry_wxj 发表于 2011-6-3 13:40:14

回复 highflybird 的帖子

谢谢你.    它提示   错误: 参数类型错误: VLA-OBJECT nil    ,能否再解答一下.

yanshengjiang 发表于 2011-6-3 15:42:53

鍥炲 highflybir 鐨勫笘瀛

鏈嬪弸 鎴戝緢鑿溿

yanshengjiang 发表于 2011-6-3 15:51:33

鑰佹槸涔辩爜 閮侀椃

yanshengjiang 发表于 2011-6-3 15:56:51

luanma銆

scry_wxj 发表于 2011-6-3 16:27:57

怎么是乱码?
页: [1] 2 3
查看完整版本: 求一段在lisp或VBA下更改AutoCAD标题的程序