Which is the correct syntax to P/Invoke the acedGrRead function, specially the third argument?
This code is wrong:
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
extern static public int acedGrRead(int track, int type, double[] output);
public void LAcedGrRead()
{
int track = 1, type = new int();
double[] output = new double[3];
while (track > 0)
{
acedGrRead(track, type, output);
if (type == 3) track = 0
}
}
Who can tell me the right code?
There's really no need to use acedGrRead() in ObjectARX these days.
That's a legacy API that does not work (because it disables all kinds
of things like use of menus and so forth), and that's why You shouldn't
use it to start with.
To arrive at the same functionality, you add a handler to the Editor's
PointMonitor event just before you call it's GetPoint() method, and
remove the handler after the GetPoint() call returns.
In the handler, you can get the cursor location, draw temporary graphics,
query the objects in the aperture/pickbox, and do other things that you
can't easily do via acedGrRead().