Hiding/Showing a window of a program that was started through DCOM (PLUS: showing the icon in the systray for said Process)

Dear all!

Currently, we are trying to get access to a C# program that was started through another process via DCOM.

The whole is an OPCAE Server that must/can only run as a single instance. (Manual second start should access the running instance.)

Starting the program standalone places the icon in the systray when minimized, when the window is visible, the icon moves to the taskbar.

When the program is started through the DCOM Process, no systray icon is visible and thus, we cannot show the window. The process is started under Administrator (not system).

What we want to achieve is:

No matter whether the program is started directly, or through DCOM, the systray icon should appear making it possible to show/hide the main window. (Or, alternatively, if we start the program manually – after the DCOM process has already started it, it should open the main window.)

We've so far tried the commonly known approaches with FindWindow, FindWindowByName, ShowWindow, and quite a few other approaches from Stackoverflow or pinvoke.net, or codeproject.com – all without success.

Any hints, tips, ideas would be greatly appreciated.

by desrtfx via /r/csharp

Leave a Reply