本帖最后由 highflybir 于 2012-8-21 02:17 编辑
-
- (vl-load-com)
- ;;; ====================================================================
- ;;; 隐藏CAD菜单栏和标题栏
- ;;; ====================================================================
- (defun C:Ccc (/ DWX app hwnd menu)
- ;; Create a DynamicWrapperX instance and register win32 API functions.
- (setq DWX (vlax-create-object "DynamicWrapperX"))
- (and (null DWX) (exit))
- (vlax-invoke DWX 'Register "USER32" "SetWindowLong" "i=lll" "r=l") ;注册SetWindowLong函数
- (vlax-invoke DWX 'Register "USER32" "GetWindowLong" "i=ll" "r=l") ;注册GetWindowLong函数
- (vlax-invoke DWX 'Register "USER32" "SetMenu" "i=ll" "r=l") ;设置菜单
- (vlax-invoke DWX 'Register "USER32" "GetMenu" "i=l" "r=l") ;取得当前菜单句柄
- ;;Hide the title and menubar
- (setq app (vlax-get-acad-object)) ;当前CAD程序
- (setq hwnd (vla-get-hwnd app)) ;CAD窗口句柄
- (ShowTitle DWX hwnd nil) ;隐藏标题栏
- (setq menu (vlax-invoke DWX 'GetMenu hwnd)) ;获得程序的菜单句柄
- (and (/= menu 0) (setq hMenu menu)) ;此处应把hMenu设置为全局变量
- (vlax-invoke DWX 'SetMenu hwnd 0) ;(vlax-invoke DWX 'SetMenu hwnd hMenu) 恢复菜单栏
- ;; Release object
- (vlax-release-object app)
- (vlax-release-object DWX)
- (princ)
- )
- (defun ShowTitle (DWX hwnd Show / oldStyle) ;如果show 为t 那么显示,否则不显示
- (setq oldStyle (vlax-invoke Dwx 'GetWindowLong hwnd -16)) ;GWL_STYLE -16
- (if Show
- (if (zerop (logand oldstyle 12582912)) ;WS_CAPTION 12582912 C00000
- (vlax-invoke DWX 'SetWindowLong hwnd -16 (+ oldstyle 12582912))
- )
- (if (/= 0 (logand oldstyle 12582912)) ;WS_CAPTION 12582912 C00000
- (vlax-invoke DWX 'SetWindowLong hwnd -16 (- oldstyle 12582912))
- )
- )
- )
|