Ejemplo n.º 1
0
        const string rootpathnoslash = @"c:\code";      // where to dump files

        public CapiDemoForm()
        {
            InitializeComponent();
            for (int i = 0; i < Environment.GetCommandLineArgs().Length; i++)
            {
                richTextBox.AppendText(Environment.GetCommandLineArgs()[i] + Environment.NewLine);
            }

            string appPath = System.Reflection.Assembly.GetEntryAssembly()?.Location;

            string uri           = "eddiscovery";
            string ddeservername = "edd-dde-server";

            DDEServer.RegisterURICallback(uri, appPath, ddeservername);

            ddeserver = new DDEServer();
            if (ddeserver.Start(ddeservername))
            {
                if (ddeserver.AddTopic("System", handleCallbackUrl))
                {
                    if (ddeserver.Register())
                    {
                        richTextBox.AppendText("DDE Server setup" + Environment.NewLine);
                    }
                }
            }

            Directory.CreateDirectory(rootpathnoslash);

            System.Diagnostics.Debug.Assert(CapiClientIdentity.id.Contains("-"));

            capi = new CompanionAPI(rootpathnoslash, CapiClientIdentity.id, $"EDCD-Program-1.2.3.4", uri);

            dateTimePicker.Value = DateTime.UtcNow;
        }
Ejemplo n.º 2
0
        private void handleCallbackUrl(IntPtr hurl)
        {
            string url = DDEServer.FromDdeStringHandle(hurl);

            richTextBox.AppendText("URL Callback " + url + Environment.NewLine);
            if (capi != null)
            {
                capi.URLCallBack(url);
            }
            richTextBox.ScrollToCaret();
        }