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
将cad嵌入到vb中
最新推荐文章于 2024-09-29 10:32:44 发布
2451

被折叠的 条评论
为什么被折叠?



