0

I have an application running that is scaled to match resolution of a monitor. It is written to adjust to any monitor resolution. If I establish connection using remote desktop and then start the application, it picks up the Remote Desktop's resolution (its settings) instead of the original desktop resolution.

Question is - how to retrieve the original resolution settings (the ones that are restored after remote connection is closed)?

Current settings are retrieved using: SystemInformation.PrimaryMonitorSize

sonne
  • 377
  • 5
  • 20
  • Can you clarify the sequence of events? Are you launching the application IN a remote desktop session? – dodexahedron Nov 05 '13 at 19:24
  • 1. The application starts and forms are resized to match screen resolution. 2. Remote session is established and restarts the application. 3. The application is now started and resized based on the remote settings, not the original resolution. – sonne Nov 05 '13 at 19:25
  • 1
    Sucks that return posts the comment, doesn't it? >. – dodexahedron Nov 05 '13 at 19:26
  • You may be better off to listen for [resolution change notification](http://stackoverflow.com/questions/11983111/detect-when-new-display-is-connected/11985093#11985093) instead... you don't need RDC to change resolution - change of local resolution (or drag to other monitor) should behave as bad if you fix size based on current first monitor size... – Alexei Levenkov Nov 05 '13 at 19:30
  • @AlexeiLevenkov - I don't recommend shutting down an application and restarting it when you switch monitors. Ouch. – P.Brian.Mackey Nov 05 '13 at 19:31
  • @P.Brian.Mackey - not the case, the application is accessed from many different PC's, with different resolutions. It maybe restarted, which will inevitably cause application to mismatch its original resolution settings. – sonne Nov 05 '13 at 19:32
  • @AlexeiLevenkov - if the application is closed, how will it listen for resolution change notification? – sonne Nov 05 '13 at 19:36
  • @AlexeiLevenkov - It will not. I mean to say the OP commented that the second step in his process is "Remote session is established and restarts the application. 3. The app is now started and resized...". If changing the resolution requires application restart then the user needs to modify his workflow first so it doesn't require restart. – P.Brian.Mackey Nov 05 '13 at 19:36
  • @P.Brian.Mackey - got it... removed that comment. – Alexei Levenkov Nov 05 '13 at 19:38
  • Just to clear things a little, the resolution change is not needed at all, the remote session causes it when other users restart the application. – sonne Nov 05 '13 at 19:38
  • I'm not sure now what is your problem - user connects to machine with RDC, starts application and you want program to be sized to fit physical screen of that machine even if user will never see than native resolution? Than you solution to pick size of a monitor seem to be fine... – Alexei Levenkov Nov 05 '13 at 19:44
  • @Alexei Levenkov - Yes, that is what I need, however, my method resizes the application to user's setting of remote desktop, which is not what I want. The application is publicly displayed on a screen, which means its resolution should always be relative to its own screen. – sonne Nov 05 '13 at 19:45
  • You are right... You probably have to dig into PInvoke of [EnumDisplayDevices](http://msdn.microsoft.com/en-us/library/windows/desktop/dd162609(v=vs.85).aspx) to potentially get display resolution for monitor attached to physical adapter... (This just a guess, I'd not go this route - but it look like you must have fixed size irrespective what current screen resolution for current user is, so low level methods are probably ok). – Alexei Levenkov Nov 05 '13 at 20:22

0 Answers0