4

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

无论如何,手动切换并不好,因为用户在本地或远程使用应用程序时必须不断地使用它。当然只有在乎外观的用户。

我想保留手动开关,但还要添加另一个自动开关来检查 Windows 的性能设置(我不知道如何用英语说这个,我的意思是让任何版本的 Windows 看起来的性能设置,如 Windows '98)。我希望(如果可能的话)拥有一个适用于每个 Windows 版本(2K、XP、Vista、7 和服务器对应版本)的独特功能。

请注意,我不仅对知道我的系统是否在 RDP 中运行感兴趣,而且对性能设置是否设置为高图像质量感兴趣。

4

4 回答 4

2

你可以使用我在 Delphi Jedi Apilib 中的 JwaWinsta 单元。

更具体地说,您可以将 WinStationQueryInformationW 与返回 WINSTATIONCLIENT 结构的 WinStationClient 信息类一起使用。

在这个结构中是 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 成员。

于 2010-12-02T16:41:33.863 回答
1

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

这个 OldNewThing 帖子有更多信息。

于 2010-12-02T12:56:43.820 回答
0

您好您可以使用 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 中标明

于 2010-12-02T11:33:40.623 回答
0
// 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;
于 2010-12-03T09:17:47.810 回答