



















Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private lHwnd As Long
Private Sub Form_Load()
On Error GoTo ErrTrap
Dim acadApp As Object
Set acadApp = CreateObject("AutoCAD.Application")
acadApp.Visible = True
lHwnd = GetParent(GetParent(acadApp.Activedocument.hwnd))
If lHwnd = 0 Then Exit Sub
SetParent lHwnd, Form1.hwnd
Exit Sub
ErrTrap:
On Error GoTo 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
If lHwnd = 0 Then Exit Sub
SetParent lHwnd, 0
End Sub
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。