[MDL V8i] mdlSystem_abortRequested

Hello, should mdlSystem_abortRequested work in DLL projects?

I am pressing CTRL+C, but mdlSystem_abortRequested does still return 0.

I have also tried to enable it using mdlSystem_userAbortEnable(1); without change...

Only that happen after my process is that annoying 'DING' sound is played as many times as I pressed CTRL+C. 

I have also tried to process pending messages before call... also without success...

Thanks.

Parents
  • Have you tried mdlSystem_extendedAbortEnable and mdlSystem_extendedAbortRequested?

    mdlSystem_extendedAbortEnable and mdlSystem_extendedAbortRequested allow an MDL application to check for a user abort using the same mechanism as MicroStation's update and fence processing. This lets the user abort a process using Escape, Reset or <Ctrl-C>. The other methods of signaling abort limit the user to pressing <Ctrl-C> to abort the application.

    Cheers,

    /Chris Z.

  • Hello Chris...

    I had not it tried, but now I have and these do not work either...

    Any idea? - other than Win32 API :)

  • Can you provide a better description of your use case?

    Like a pseudocode (or actual code if it is small) so we can look closer on the context?

    Cheers,

    /Chris Z.

  • I have made something as follows:

    struct MDLStateModule : public IStateModule
    {
      virtual void Install()
      {
        mdlState_startPrimitive(NULL, NULL, 00);
        mdlState_setCurrentCommandName((MSWChar*) L"My command"); 
        mdlUndo_mark();
        mdlSystem_extendedAbortEnable(TRUE);
      }

      virtual void Uninstall()
      {
        mdlSystem_extendedAbortEnable(FALSE);
        mdlState_startDefaultCommand();
      }

      virtual BoolInt Cancel()
      {
        if (mdlSystem_extendedAbortRequested())
        {
          mdlSystem_extendedAbortEnable(TRUE); // should reset state
          if (ACTIONBUTTON_YES == mdlDialog_openMessageBoxW( 
            DIALOGID_MsgBoxYesNo, (MSWChar*) L"Cancel this process?", MSGBOX_ICON_QUESTION))
            return TRUE;
        }
        return FALSE;
      }
    };


    ...

    // follows processing...

    IStateModule & state_module = ISTateModule::Get( STATE_MODULE_MDL );
    state_module.Install();

    while (get next element...)
    {
      if (state_module.Cancel()) // never returns TRUE
        break;

      ... do some stuff
    }

    state_module.Uninstall();
Reply
  • I have made something as follows:

    struct MDLStateModule : public IStateModule
    {
      virtual void Install()
      {
        mdlState_startPrimitive(NULL, NULL, 00);
        mdlState_setCurrentCommandName((MSWChar*) L"My command"); 
        mdlUndo_mark();
        mdlSystem_extendedAbortEnable(TRUE);
      }

      virtual void Uninstall()
      {
        mdlSystem_extendedAbortEnable(FALSE);
        mdlState_startDefaultCommand();
      }

      virtual BoolInt Cancel()
      {
        if (mdlSystem_extendedAbortRequested())
        {
          mdlSystem_extendedAbortEnable(TRUE); // should reset state
          if (ACTIONBUTTON_YES == mdlDialog_openMessageBoxW( 
            DIALOGID_MsgBoxYesNo, (MSWChar*) L"Cancel this process?", MSGBOX_ICON_QUESTION))
            return TRUE;
        }
        return FALSE;
      }
    };


    ...

    // follows processing...

    IStateModule & state_module = ISTateModule::Get( STATE_MODULE_MDL );
    state_module.Install();

    while (get next element...)
    {
      if (state_module.Cancel()) // never returns TRUE
        break;

      ... do some stuff
    }

    state_module.Uninstall();
Children
No Data