[CONNECT .NET] How to listen to the EnterIdleEvent with the CONNECT .NET API or P/Invoke?

I can't find any way of listening to the EnterIdleEvent with the CONNECT .NET API. I guess it was possible in V8i to P/Invoke  "mdlInput_setFunction (INPUT_ENTER_IDLE, OnEnterIdleState);" to get the same event, but it seems that this function is not exported in CONNECT anymore.

Is there any replacement?

Parents
  • Well, at the end, it was not too complicated to receive some more information using standard approach and tools (MicroStation SDK Update 12 used):

    1. Macro sdksearch available in MicroStation SDK shell provides first insight: skdsearch mdlInput_setFunction found that mdlInput_setFunction(INPUT_ENTER_IDLE,*) is available in remap definition and it points to InputCallback::SetEnterIdleFunction.
    2. Whereas InputCallback::SetEnterIdleFunction is documented in MicroStation API, the method SetEnterIdleFunction not. I recommend to raise service ticket for this issue, also is probably able to get some insight why the remap tool knows it, but documentation not.
    3. Even when it's not documented, using DLL Export Viewer confirms it's published in ustation.dll.

    With regards,

      Jan

    Answer Verified By: Tomáš Juřík 

  • Hi Jan,

    thank you for your helpful replies. The InputCallback::SetEnterIdleFunction method is public so it is callable. I have tried it with P/Invoke and it works well. See the code snippet bellow.

    However, the exported name is decorated so the P/Invoke way of calling the method is not the best approach. Using the older C# COM API or C++/CLI wrapper is preferable.

    Tom

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    private delegate void InputFunc_EnterIdle();
    
    [DllImport("ustation.dll",
      EntryPoint = "?SetEnterIdleFunction@InputCallback@@SAP6AXH@ZP6AXH@Z@Z",
      ExactSpelling = true,
      CallingConvention = CallingConvention.Cdecl)]
    private static extern InputFunc_EnterIdle InputCallback_SetEnterIdleFunction(InputFunc_EnterIdle newFunc);

Reply
  • Hi Jan,

    thank you for your helpful replies. The InputCallback::SetEnterIdleFunction method is public so it is callable. I have tried it with P/Invoke and it works well. See the code snippet bellow.

    However, the exported name is decorated so the P/Invoke way of calling the method is not the best approach. Using the older C# COM API or C++/CLI wrapper is preferable.

    Tom

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    private delegate void InputFunc_EnterIdle();
    
    [DllImport("ustation.dll",
      EntryPoint = "?SetEnterIdleFunction@InputCallback@@SAP6AXH@ZP6AXH@Z@Z",
      ExactSpelling = true,
      CallingConvention = CallingConvention.Cdecl)]
    private static extern InputFunc_EnterIdle InputCallback_SetEnterIdleFunction(InputFunc_EnterIdle newFunc);

Children