.NET How to communicate with Windows Forms app from Sharpshell COM Extension?

302 views Asked by At

I have a windows form application (Synchronization application Like DropBox and Google Drive) and also COM Components(Shell extensions) that I created using SharpShell that added features to windows file system. My question is how the COM communicate with the Windows Form application. e.g

When I create a singleton in my windows forms application, the COM extension can't see this Singleton(null) as I think it is a different process. my question is I want the best practice of how COM Process(C# code) communicate with Windows forms app(also c# code) or I want my singleton to be seen by both of the apps.

public class FileLoggerDoubleCheckLocking : BaseFileLogger
{
    private static FileLoggerDoubleCheckLocking _instance;
    private static readonly object _lock = new object();

    private FileLoggerDoubleCheckLocking()
    {
    }

    public static FileLoggerDoubleCheckLocking Instance
    {
        get
        {
            if (_instance == null)
            {
                lock (_lock)
                {
                    if (_instance == null)
                    {
                        _instance = new FileLoggerDoubleCheckLocking();
                    }
                }
            }
            return _instance;
        }
    }
}
1

There are 1 answers

1
yo2011 On

Thanks, I already solved it by using WCF Named Pipes WCF Named Pipes