请问如何将CAD作为VB的子窗口?
请问如何将CAD作为VB的子窗口?将CAD嵌套入VB,作为VB的一个子窗体。 <p>'/////autocad软件窗口能够出现在VB窗体中<br/>Option Explicit</p><p>Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long<br/>Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long<br/>Private lHwnd As Long</p><p>Private Sub Form_Load()</p><p> <br/> On Error GoTo ErrTrap<br/> Dim acadApp As Object<br/> Set acadApp = CreateObject("AutoCAD.Application")<br/> acadApp.Visible = True<br/> lHwnd = GetParent(GetParent(acadApp.Activedocument.hwnd))<br/> If lHwnd = 0 Then Exit Sub<br/> SetParent lHwnd, Form1.hwnd<br/> Exit Sub</p><p> <br/>ErrTrap:<br/> On Error GoTo 0<br/>End Sub</p><p>Private Sub Form_Unload(Cancel As Integer)<br/> If lHwnd = 0 Then Exit Sub<br/> SetParent lHwnd, 0<br/>End Sub</p> 楼上的方案非常好。高手就是高手。谢谢楼上的。再请问下,控制CAD窗口大小用什么命令呢?就是控制CAD窗口在VB界面里的大小,CAD窗口的大小随VB界面大小的改变而改变。 <p>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)</p><p>这个函数应该可以,自己研究吧</p> 谢谢“home”兄!! <p>又学习到一招。</p> 有这种方法?我没不知道,过来学习一下 控制CAD窗口大小用什么命令呢?就是控制CAD窗口在VB界面里的大小,CAD窗口的大小随VB界面大小的改变而改变 挺不错的,请问如何能够使得cad窗体脱离vb界面呢 高手,要好好学习
页:
[1]