Did you fing a solution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lb1

    #1

    Did you fing a solution

    Hi Michael,

    We have tha same problem with our application.

    Did you already find a solution for you problem with the processcmdkey
    and the appdomain?

    Leon

  • Michael W

    #2
    Re: Did you fing a solution

    Yes, we actually did figure out a work around. What we did is we
    created an implementation of IMessageFilter then added a new
    MessageFilter instance to each of the newly created AppDomains as well
    as the initial AppDomain. Our implementation of IMessageFilter adds a
    parent reference which is also an instance of IMessageFilter. In our
    shortcut key case (CTRL+SHIFT+... .) the MessageFilter passes the message
    to the parent MessageFilter if the parent is not null. You will also
    need to add a serializable method in MessageFilter to pass the call
    across AppDomains and make sure to do an Invoke on this serializable
    method to make sure it runs on the correct Thread. A side effect of our
    implementation is it is possible for the parent and the child AppDomains
    to both process the same message so one user interaction causes two
    actions. This could be handled by adding an interface to each of your
    objects being run in separate AppDomains which contains a method such as
    the following:

    public bool IsMessageHandle r(int keys);

    which is implemented on each AppDomains primary class to designate
    whether that class handles the passed keys. Then you just need to check
    the current app domain and the parent appdomain (if it exists) using
    this method to determine if the keys need to be processed.

    Hope that helps. Let me know if any of this is confusing or needs
    clarification.



    Mike


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    • Leon

      #3
      Re: Did you fing a solution

      Thanks at this time I also have an outstanding call to MS in
      microsoft.publi c.dotnet.framew ork.windowsform s.controls .
      Hopefully I also get an answer from them, if not I will try your solution.

      Thanks for your help.

      "Michael W" wrote:
      [color=blue]
      > Yes, we actually did figure out a work around. What we did is we
      > created an implementation of IMessageFilter then added a new
      > MessageFilter instance to each of the newly created AppDomains as well
      > as the initial AppDomain. Our implementation of IMessageFilter adds a
      > parent reference which is also an instance of IMessageFilter. In our
      > shortcut key case (CTRL+SHIFT+... .) the MessageFilter passes the message
      > to the parent MessageFilter if the parent is not null. You will also
      > need to add a serializable method in MessageFilter to pass the call
      > across AppDomains and make sure to do an Invoke on this serializable
      > method to make sure it runs on the correct Thread. A side effect of our
      > implementation is it is possible for the parent and the child AppDomains
      > to both process the same message so one user interaction causes two
      > actions. This could be handled by adding an interface to each of your
      > objects being run in separate AppDomains which contains a method such as
      > the following:
      >
      > public bool IsMessageHandle r(int keys);
      >
      > which is implemented on each AppDomains primary class to designate
      > whether that class handles the passed keys. Then you just need to check
      > the current app domain and the parent appdomain (if it exists) using
      > this method to determine if the keys need to be processed.
      >
      > Hope that helps. Let me know if any of this is confusing or needs
      > clarification.
      >
      >
      >
      > Mike
      >
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it!
      >[/color]

      Comment

      Working...