DCOM Remote Control in C#

Kristijan Cizmar

Posted on 06.05.2016 12:19

Hi Guys,
I am trying to add a reference of the remote computer (name or IP address) to a DCOM object.
When I do the following it works on the local machine:

private void btnOpnDWSFT_Click(object sender, EventArgs e)
{
DEWEsoft.IApp x = new DEWEsoft.App();
x.Init();
x.Width = 1000;
x.Height = 800;
x.Visible = true;
}


But where shall I add the reference to the Remote Machine? BTW: The DCOM server is running on the remote machine and I got it working in LabView somehow but I couldn't get it work in C#. I would like to remote controll DEWEsoft on a different Machine and also to read some measurements from the channels.

Do you have some programming examples for that too?

Best regards,
Kristijan

Kristijan Cizmar

Posted on 21.05.2016 13:43

No one an idea?

8908183 8908183

Posted on 08.09.2016 10:10

any idea???

please help.

آموزش C#

Marc Rupprath

Posted on 17.11.2017 15:12

Hello,

it is a time ago since you opened the thread.

For direkt access via DCOM i have also no soultion but what you can do instead:


1. Create a WCF (Windows Communication Server), this can behosted with a small ap or as Windwos service and runs on the DEWESOFT machine

This handles all functions calls to the lokal DCOM Interface

The Service encapsulates this local calls by prowiding "his" Functions for WCF clients.

2. Create a WCF Client that calls the "Warpper functions" the WCF Server provides.

The WCF client is the applikations that want's to control the DEWESOFT.

In real the WCF client only communicates with the wcf server.

Thre are plenty of examples how to exchange data and finction calls between wcf server and client.

Short comprehension: Your are controlling the wcf server from remote by using your wcf client, that is part of your DEWOSOFT Remoting solution.

The sWCF server will then make the apropriate local calls to DEWESOFT DCOM and returns the resukt to the wcf client.


Hope that helps a little bi ;-)


Marc















Kristijan Cizmar

Posted on 17.08.2018 15:34

Hi all,


It has been a while, since I asked for a help regarding this issue here. I am running quit well with my automation projects, using a direct DCOM connection. I would like to share my solution if anyone else has the same issues.


The idea is to connect to a local or remote (Local Area Network) DEWESoft and to have a DEWESoft.App object. With that object you can do what ever is needed for your automation projects (e.g. loading setup files, change sample rate, configuring channels, start & stop stroing etc.).


For that it's needed to specify the name of the machine where you want to connect and the setup file you want to load.


In my example it is the "localhost" machine and the "harmonics_60A.d7s" setup file. You'll need to adapt these parameters to fit your own needs.


If you are running that in a corporate network you may also have to adapt some parameters within the 'XDewe' Class.cs file.


One more thing: If your are going to start and control DEWESoft on a remote machine, you will also have to change the DCOM permissions of the AppObject for the interactive user (see https://forum.dewesoft.com/software-discussions/developers/remote-automated-dcom-cvi-activex-access-denied for details)


Best regards,

Kristijan


  public class App
  {
    public static XDewe xDewe { get; set; }

    static void Main(string[] args)
    {
       
      // Dewesoft INIT
      App.xDewe = new XDewe();
      xDewe.ConnectDcom("localhost", @"C:\DEWESetup\harmonics_60A.d7s");

      Task.Delay(1000).Wait();

      // Get DEWESoft Measurement values and display it in the console window.
      for (int i = 0; i < 10; i++)
      {
        xDewe.IndicatorUpdate();
        Task.Delay(750).Wait();
        Console.Clear();
      }

      // Finish it... 
      cout("Thats it. Happy coding!");
      Task.Delay(750).Wait();

      // Clear DEWE Object.
      xDewe.Stop();
    }

    public static void coutw(string v)
    {
      Console.WriteLine("WARNING: " + v);
    }
    public static void cout(string v)
    {
      Console.WriteLine(v);
    }
  }

Attached files:
Login to reply to this topic. If you don't have account yet, you can signup for free account .
This website uses cookies to ensure you get the best experience on our website. Learn more