Site Search:
Sign in | Join | Help

Why error when trying to "RegisterFocusTrigger()"?

Last post 04-03-2008 6:42 PM by tolac. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-02-2008 8:55 PM

    Why error when trying to "RegisterFocusTrigger()"?

     Hi everyone,

    I am sorry if post this question in the wrong place.

    I am using C#, Continuum to intercept user click buttons in Modal Dialog Window by the following code:

    In Main:
    Application GpApp;
    Type t = Type.GetTypeFromProgID("Dynamics.Application", false);
    GpApp = (Application)Activator.CreateInstance(t);
    GpApp.RegisterFocusTrigger("window 'PM_Transaction_Entry' of form 'PM_Transaction_Entry", focusType, attachType, new ModalDialogHandler(), "action");

    In ModalDialogHandler class:
    class ModalDialogHandler
        {
            public void action(int dialog_type, string prompt, string control_1, string control_2, string control_3, int answer)
            {
                System.Console.WriteLine("Answer: " + answer.ToString());
            }
        }

    I always get error "Specified cast is not valid." when I run this code.

    Thank you in advance, I appreciate all you answers.

    Tola 

    • 67.131.46.122
  • 04-03-2008 6:42 PM In reply to

    Re: Why error when trying to "RegisterFocusTrigger()"?

    Hi everyone,

    Regarding to my problem, I have checked:

    Register for COM interop  (in Project -> Properties -> Build )

    It worked very well. But I still not understand why.

    Anyone could explain me about this matter?

     

    Tola 

    • 67.131.46.122
Page 1 of 1 (2 items)