Search code examples
delphiwinapiterminal-services

How do I discover the image-quality settings of a Remote Desktop session?


I am using DevExpress skins. I implemented a switch to disable skins manually. I need this basically because of a Terminal server (I need to have a flat look to save on connection bandwith).

Anyway, the manual switch isn't good because the user must continously use it when using the application locally or remotely. Of course only a user who cares about look.

I would like to leave the manual switch but to add also another automatic switch that checks the Windows settings for performance (I don't know how to tell this in English, anyway, I mean that setting for performance that lets any version of Windows look, like Windows '98). I would like (if it is possible) to have a unique function that works on every Windows version (2K, XP, Vista, 7, and the server counterparts).

Please note I am not interested in merely knowing whether my system is running in RDP, but whether the performance settings are set for high image quality or not.


Solution

  • // returns the color bit depth (8, 16, 32, ....) on the machine
    // note: it works also for rdp (it returns the color bit depth of
    // the current session, not some default settings on the server)
    function GetBitColorDepth: integer;
    var
      DC: THandle;    // display context
    begin
      DC := GetDC(HWND(nil));
      Result := GetDeviceCaps(DC, BITSPIXEL);
      ReleaseDC(HWND(nil), DC);
    end;