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

相关文章:

  • 2022-01-31
  • 2022-01-13
  • 2022-02-21
  • 2021-07-23
  • 2021-10-24
  • 2022-12-23
  • 2021-11-22
  • 2021-12-23
猜你喜欢
  • 2021-08-10
  • 2022-12-23
  • 2021-11-06
  • 2021-05-02
  • 2021-05-18
相关资源
相似解决方案