Open window designed in WPF from external exe and receive return values from methods

StackOverflow https://stackoverflow.com/questions/22991032

  •  01-07-2023
  •  | 
  •  

سؤال

Is there some "new/better" way to open a WPF window and get some return object when it closes than using COM?

Or is it still - in year 2014 - the way to go?

Something like this:

[Guid("14B55D90-E07B-4DC9-B2EE-25F15607518B")]
[ComVisible(true)]
public interface ComInterface
{
    [DispId(0)]
    void ShowWindow();
}

[Guid("CC01974D-82E2-4E9E-A48C-562D3ED83459")]
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(ComInterface))]

public class ComClass: ComInterface
{
    public void ShowWindow()
    {
        MainWPFWindow window = new MainWPFWindow();
        window.Show();
    }
}
هل كانت مفيدة؟

المحلول

What you are apparently looking for is inter-process communication. With .NET, you have various options, among the following:

Here is another list for IPC methods: Interprocess Communications

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top