Thanks for writing and taking time to explain your issue.
I understand that, when you connect your dual monitor, particular application gets minimized.
Pressing the second monitor is very much like pressing Shift + Tab. You're basically jumping out of the application and into the background. This will force the display driver to redirect its focus, causing the primary application to minimize.
That is not actually an issue. That is the default behavior of a full-screen application on a dual display setup. If you will click anywhere outside the app, your app would normally minimize. If you don't want this to happen.
If your application provide option for selecting either Windowed or Windowed Full-screen, please give a try.
--If the reply is helpful, please Upvote and Accept as answer.--