how can call acedDragGen in vb6.0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i callacedDragGen in vb6.0 with my codes,but not is not work, my codes blow :
press F5 ,then select an objecte in modelspace, it view error ,can you help me?
NO7CLGC.jpg)
'module1.bas
Public Declare Function acedDragGen Lib "C:\Program Files\AutoCAD 2006\acad.exe" (ByRef ads_name() As Long, ByRef mystr As String, ByVal cursor As Integer, ByVal funname As Long, ByRef retupt() As Double) As Integer
Public app As AcadApplication
Public doc As AcadDocument
Public p1(0 To 2) As Double
Public Function myfun(ByRef pt() As Double, ByRef mt() As Double) As Integer
mt(0, 0) = 1#: mt(0, 1) = 0#: mt(0, 2) = 0#: mt(0, 3) = 0#
mt(1, 0) = 0#: mt(1, 1) = 1#: mt(1, 2) = 0#: mt(1, 3) = 0#
mt(2, 0) = 0#: mt(2, 1) = 0#: mt(2, 2) = 1#: mt(2, 3) = 0#
mt(3, 0) = 0#: mt(3, 1) = 0#: mt(3, 2) = 0#: mt(3, 3) = 1#
mt(0, 0) = pt(0): mt(1, 0) = pt(1): mt(2, 0) = pt(2)
End Function
'form1
Private Sub Command1_Click()
Dim ent As AcadEntity
Dim pt As Variant
doc.Utility.GetEntity ent, pt, "\n选择对象"
Dim ret As Integer
Dim prmstr As String
prmstr = "指定点:"
Dim myent(0) As Long
myent(0) = ent.ObjectID
On Error Resume Next
ret = acedDragGen(myent, prmstr, 0, AddressOf myfun, p1)
If Error Then MsgBox "错误"
End Sub
Private Sub Form_Load()
Set app = GetObject(, "autocad.application")
Set doc = app.ActiveDocument
End Sub