[求助]我想要这样搞CAD的标题栏
CAD2004里新增一个命令, 好象是Alt+0 或是 Ctrl+0 就能够反复地隐藏和显现CAD界面的标题栏. 我想那一定要用到API, 我在网上找了相关的资料, 但只有如何隐藏,而没有如何显现标题栏. 所以我的问题是: 如何显示被隐藏了的标题栏? 因为我也想在CAD2002里实现这种功能.这是我所能找到的相关内容的地址,请大家参考.
http://www.china-askpro.com/msg26/qa76.shtml Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Const SWP_FRAMECHANGED = &H20
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const HWND_TOP = 0
Private hasTitleBar As Boolean
Public Sub TitleBarChange()
Dim L As Long
L = GetWindowLong(Application.hwnd, GWL_STYLE)
If hasTitleBar Then
L = L Or WS_CAPTION
Else
L = L And Not (WS_CAPTION)
End If
L = SetWindowLong(Application.hwnd, GWL_STYLE, L)
hasTitleBar = Not hasTitleBar
SetWindowPos Application.hwnd, HWND_TOP, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
上述代码放在ThisDrawing内将下列代码加入到AcadDoc200?.lsp文件内(defun c:tbc() (command "-vbarun" "TitleBarChange")) 谢谢飞孤版主. 在声明里还再加一句
Private Declare Function GetActiveWindow Lib "user32" () As Long
就能得到当前活动窗体的句柄. 用以替换Application.hwnd就能实现了.
送上一个小软以表示对这个大家庭的谢意.
这个东西解压后是一个可执行文件. 可是个小软而已哟. 很容易地就把这项功能加入了我的CAD2002里面来了. 唉, VB里的API真的是难以搞通的啊, 要不是<A name=28647><FONT color=#990000><B>lzh741206</B></FONT></A>来帮忙, 我真的不知道还要加上 SetWindowPos 这个API来做处理呢. 下面是我的反馈, 成功了! 谢谢.
页:
[1]