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.