How to adjust the adaptive screen resolution?

I need a function to click the button window to display and then click the button full screen. And the full screen will have 2k display and 1080p display, how to deal with this problem. R.SetRes seems difficult to execute. This function is equivalent to pressing f11. Need to be successful after windows packaging.