Author Topic: how to use acedInvoke in AutoCAD 2007,2008 and 2009  (Read 202 times)

0 Members and 1 Guest are viewing this topic.

guohq

  • Newt
  • Posts: 82
how to use acedInvoke in AutoCAD 2007,2008 and 2009
« on: August 20, 2021, 12:07:20 PM »
Since AutoCAD 2011, the Application.Invoke method is provided. I want to implement this function in Autocad 2007,2008 and 2009, but acedInvoke does not seem to work.

       <DllImport("acad.exe", EntryPoint:="acedInvoke", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Auto), System.Security.SuppressUnmanagedCodeSecurity()> _
        Private Shared Function acedInvoke(ByVal args As IntPtr, ByRef result As IntPtr) As Integer

        End Function

here is the test code

(defun c:GetVariableValue(VarName)
   (eval (read VarName))
)
(Setq aa 1234321)


acedInvoke(New ResultBuffer(New TypedValue(LispDataType.Text, "GetVariableValue"), New TypedValue(LispDataType.Text, "aa"))



The above code runs fine in AutoCAD2010.
« Last Edit: August 20, 2021, 12:15:27 PM by guohq »

guohq

  • Newt
  • Posts: 82
Re: how to use acedInvoke in AutoCAD 2007,2008 and 2009
« Reply #1 on: August 20, 2021, 12:47:42 PM »
sorry ,I use the wrong code. the right code is

acedInvoke(New ResultBuffer(New TypedValue(LispDataType.Text, "c:GetVariableValue"), New TypedValue(LispDataType.Text, "aa"))