Need help in shiny apps for disable shiny main apps window or disable the close button

NEED HELP IN SHINY APPS FOR DISABLE SHINAY MAIN APPS WINDOW OR DISABLE THE CLOSE BUTTON.

Shiny Apps program scenario :

I am calling a C# function from my shiny apps using "rclr" module.
That "C#" function will open a gateway window to fetch "data frame" from C# application to R.

What Problem I am getting:

  1. When it's calling the cross-platform "C#" application window by calling the C# function from R,
    THAT WINDOW IS NOT COMING IN FRONT OF SHINY APPS MAIN PANEL.
    EVERY TIME I AM USING "ALT+TAB" TO GET THE 3RD PARTY WINDOW BACK.

    MEANWHILE, IF I CLOSE THE SHINY APPS MAIN PANEL, WHEN 3RD PARTY WINDOW STILL RUNNING OR ALIVE OR NOT CLOSED THEN I AM GETTING ERROR
    AND RSTUDIO IS GETTING HANGED.

To address the issue below options i was tring:

  1. Tring to disable the main shiny panel window disable or hidden when 3rd party process is running. So that nobody can close the main shiny panel window.
  2. Tring to disable or hide shiny main panel top right corner window close button. So that nobody can close the main shiny panel window when 3rd party process is running.

BUT NITHER WAY I GOT ANY SOLUTION TO ADDRESS THIS ISSUE.
AND NOT ABLE TO FIND ANY CODE WHICH WILL HELP TO DISABLE THE MAIN SHINY APPS WINDOW OR DISABLE THE CLOSE BUTTON.

LOOKING FOR HELP TO ADDRESS THE SAME. ANY KIND OF SUGGESTIONS, APPROACH AND HELP FOR THIS PROBLEM APPRECIATED.

Please find below the part of code for better understanding the problem scenario

Lets take below example.

rm(list=ls())

library(shiny)
# shiny apps/browser is 1st window 
doshiny <- function() {
  app=shinyApp(
    ui = fluidPage(
      bsButton("CLICK_ME", label = "CLICK ME", block = TRUE, width = 90, style="primary")
    ),
    server = function(input, output, session) {
      
      observeEvent( input$CLICK_ME,{
        print("Cliecked !")
        
        GetDataFrameFunResult = GetDataFrameFun (); # one new window will open (2nd window from dll)
      })
      session$onSessionEnded(function() {
        stopApp()
      })
    }
  )
  runApp(app)
}

openshiny <- function() {
  doshiny()
  print("Finished.")
}


GetDataFrameFun <- function(){     # function call GetDataFrame(), its will open a c# window

  connectorObj <- GetConnectorObj()
  return( clrCall( connectorObj, 'GetDataFrame' ) )
}

GetConnectorObj <- function(){   # CLR call
  
  WD <- getwd()
  PATH <- paste( WD, '/target.dll', sep="" )
  rClr::clrLoadAssembly( PATH );
  return( clrNew( 'namespaceName.className' ) )
}

openshiny()

now my objective is, do not allow a user to close the 1st window when 2nd window is still open.

Hi! Welcome to RStudio Community!

It looks like your code was not formatted correctly to make it easy to read for people trying to help you. Formatting code allows for people to more easily identify where issues may be occuring, and makes it easier to read, in general. I have edited you post to format the code properly.

In the future please put code that is inline (such as a function name, like mutate or filter) inside of backticks (`mutate`) and chunks of code (including error messages and code copied from the console) can be put between sets of three backticks:

```
example <- foo %>%
  filter(a == 1)
```

This process can be done automatically by highlighting your code, either inline or in a chunk, and clicking the </> button on the toolbar of the reply window!

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code


In addition, comments in R are added using the # symbol rather than //. This will likely cause issues when users try to copy your code, so I changed them in your code.