none
Inter process communication with a deskband RRS feed

  • Question

  • Hi there,

    I have written a custom deskband and I would like to communicate with it from another application.  I am now wondering how I can call a function of my deskband from another process. I know there are different ways in Windows to establish inter process communication but I am wondering which one I should try?

    Thanks and best wishes

    Oliver

    Thursday, March 17, 2011 6:41 PM

All replies

  • A desk band would be running inside Explorer.exe which is usually a medium integrity level process. What will be your app's integrity level? Some IPC methods do not work across integrity levels

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Thursday, March 24, 2011 6:05 AM
    Moderator
  • Iwrote a Desk band couple of months ago and I used IPC to communicate with my main application. It worked well. Define an Interface to communicate for both Desk Band and the main application,then you can use IPC channel to communicate.

     //Desk Band Side

    try
                {
                    string ipcPath = "ipc://" + SharedConstants.ProNetChannelName + "/" + SharedConstants.ProNetServiceName;
                 

                    priceService = (IPriceService)Activator.GetObject
                           (typeof(IPriceService),
                            ipcPath);

                    priceService.CanCallServices(false);
                    MiniToolbarService.canCallRemoteMethods = true;
                }
                catch (RemotingException exRemote)
                {
                    MiniToolbarService.canCallRemoteMethods = false;
                }
                catch (Exception ex)
                {
                    RootServiceProvider.ExceptionHandler.HandleException(ex);
                }

     

    //Main Application

     try
                {

                    System.Collections.IDictionary properties = new System.Collections.Hashtable();
                    properties["portName"] = SharedConstants.ProNetChannelName;
                    properties["name"] = "TWSChannel";
                    properties["tokenImpersonationLevel"] = TokenImpersonationLevel.Impersonation;
                    properties["includeVersions"] = false;
                    properties["strictBinding"] = false;
                    properties["secure"] = true;
                    properties["authorizedGroup"] = "Everyone";
                    properties["exclusiveAddressUse"] = false;
                    IpcChannel ipcCh = new IpcChannel(properties, null, null);

                    bool channelExist = false;

                    if (ChannelServices.RegisteredChannels.Length > 0 && ChannelServices.RegisteredChannels[0].ChannelName.Equals(ipcCh.ChannelName))
                        channelExist = true;

                    if (!channelExist)
                        ChannelServices.RegisterChannel(ipcCh, false);

                }
                catch (Exception ex)
                {
                    RootServiceProvider.ExceptionHandler.HandleException(ex);
                }
                finally
                {
                    RemotingConfiguration.RegisterWellKnownServiceType
                       (typeof(PriceService),// Main Class implements IPriceService
                               SharedConstants.ProNetServiceName,
                               WellKnownObjectMode.Singleton);

                }

    Thursday, July 28, 2011 6:05 AM