如何发现远程桌面会话的图像质量设置?

发布于 2024-10-05 14:00:36 字数 360 浏览 3 评论 0原文

我正在使用 DevExpress 皮肤。我实现了一个手动禁用皮肤的开关。我需要这个基本上是因为终端服务器(我需要有一个扁平的外观以节省连接带宽)。

不管怎样,手动切换并不好,因为用户在本地或远程使用应用程序时必须连续使用它。当然只有关心外观的用户。

我想保留手动开关,但添加另一个自动开关 检查 Windows 设置性能的开关(我不知道如何 用英语告诉我,无论如何,我的意思是性能设置可以让任何人 Windows 版本的外观,如 Windows '98)。我想(如果可能的话) 具有适用于每个 Windows 版本(2K、XP、Vista、7、 和服务器对应项)。

请注意,我不仅仅想知道我的系统是否在 RDP 中运行,还想知道性能设置是否设置为高图像质量。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

权谋诡计 2024-10-12 14:00:44
// 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;
// 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;
乜一 2024-10-12 14:00:43

你好
您可以使用 WTSEnumerateSessions api 检查用户是否在 rdp 模式下运行。

var pSessionInfo: PWTS_SESSION_INFOW;
SessionInfo: WTS_SESSION_INFO;
SessionCount: Cardinal;
i: Integer;
begin
  try
    Result := -1;
    if WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, pSessionInfo, SessionCount) then
      begin
        SessionInfo := pSessionInfo^;
        for i := 0 to SessionCount - 1 do
          begin
            if SessionInfo.State = WTSActive then
              begin
                if Pos('rdp', LowerCase(SessionInfo.pWinStationName)) <> 0 then
                  ShowMessage('this is rdp');
              end;
            pSessionInfo := PWTS_SESSION_INFOW(Pointer(Integer(pSessionInfo) + SizeOf(WTS_SESSION_INFOW)));
            SessionInfo := pSessionInfo^;
          end;
      end;
  finally
    WTSFreeMemory(PSessionInfo);
  end;

希望这能回答您的问题。顺便说一句,delphi 没有 WTSEnumerateSessions 的导入,因此您必须手动导入它,或者下载 Jwa 库。该函数在 JwaWtsApi32.pas 中贴标

Hi
You can use WTSEnumerateSessions api to check if the user is running in rdp mode.

var pSessionInfo: PWTS_SESSION_INFOW;
SessionInfo: WTS_SESSION_INFO;
SessionCount: Cardinal;
i: Integer;
begin
  try
    Result := -1;
    if WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, pSessionInfo, SessionCount) then
      begin
        SessionInfo := pSessionInfo^;
        for i := 0 to SessionCount - 1 do
          begin
            if SessionInfo.State = WTSActive then
              begin
                if Pos('rdp', LowerCase(SessionInfo.pWinStationName)) <> 0 then
                  ShowMessage('this is rdp');
              end;
            pSessionInfo := PWTS_SESSION_INFOW(Pointer(Integer(pSessionInfo) + SizeOf(WTS_SESSION_INFOW)));
            SessionInfo := pSessionInfo^;
          end;
      end;
  finally
    WTSFreeMemory(PSessionInfo);
  end;

Hope this answers your question. BTW delphi doesn't have an import for WTSEnumerateSessions, so you will have to import it by hand, or download a Jwa library. The function is decalred in JwaWtsApi32.pas

掀纱窥君容 2024-10-12 14:00:42

使用 SM_REMOTESESSION 系统指标来确定您的程序是否通过 RDP 运行。

这篇 OldNewThing 帖子提供了更多信息。

Use the SM_REMOTESESSION System Metric to determine if your program is running over RDP.

This OldNewThing post has much more information.

十秒萌定你 2024-10-12 14:00:41

You can use my JwaWinsta unit which is in the Delphi Jedi Apilib.

More specifically you can use WinStationQueryInformationW with the WinStationClient info class which returns a WINSTATIONCLIENT structure.

此结构中是 WinStationClientFlags 成员,它是一个位字段,可以包含以下常量的任何掩码:

  TS_PERF_DISABLE_NOTHING = $0;
  TS_PERF_DISABLE_WALLPAPER = $1;
  TS_PERF_DISABLE_FULLWINDOWDRAG = $2;
  TS_PERF_DISABLE_MENUANIMATIONS = $4;
  TS_PERF_DISABLE_THEMING = $8;
  TS_PERF_ENABLE_ENHANCED_GRAPHICS = $10;
  TS_PERF_DISABLE_CURSOR_SHADOW = $20;
  TS_PERF_DISABLE_CURSORSETTINGS = $40;
  TS_PERF_ENABLE_FONT_SMOOTHING= $80;
  TS_PERF_ENABLE_DESKTOP_COMPOSITION = $100;
  TS_PERF_DEFAULT_NONPERFCLIENT_SETTING = $40000000;
  TS_PERF_RESERVED1 = $80000000;

此外,此结构还返回 ColorDepth 成员。

You can use my JwaWinsta unit which is in the Delphi Jedi Apilib.

More specifically you can use WinStationQueryInformationW with the WinStationClient info class which returns a WINSTATIONCLIENT structure.

In this structure is the WinStationClientFlags member which is a bitfield that can contain any mask of the following constant:

  TS_PERF_DISABLE_NOTHING = $0;
  TS_PERF_DISABLE_WALLPAPER = $1;
  TS_PERF_DISABLE_FULLWINDOWDRAG = $2;
  TS_PERF_DISABLE_MENUANIMATIONS = $4;
  TS_PERF_DISABLE_THEMING = $8;
  TS_PERF_ENABLE_ENHANCED_GRAPHICS = $10;
  TS_PERF_DISABLE_CURSOR_SHADOW = $20;
  TS_PERF_DISABLE_CURSORSETTINGS = $40;
  TS_PERF_ENABLE_FONT_SMOOTHING= $80;
  TS_PERF_ENABLE_DESKTOP_COMPOSITION = $100;
  TS_PERF_DEFAULT_NONPERFCLIENT_SETTING = $40000000;
  TS_PERF_RESERVED1 = $80000000;

Further more this structure also returns the ColorDepth member.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文