delphi uniGUI获取设备信息  
官方Delphi 学习QQ群: 682628230(三千人)\n
频道

delphi uniGUI获取设备信息


有时候我们需要知道客户是使用什么设备登录的系统,在uniGUI中可以通过UniApplication.UniPlatform来获取。


简单记录一下,uniGUI的资料不太多,需要深入了解的,请多看DEMO。


详细使用请参考Demo:

目录:uniGUI\Demos\Touch\Detect Platform


以下是主要代码


type

  TUniPlatforms = set of TUniPlatform;

//定义一个变量

uPlat: TUniPlatforms;


uPlat := UniApplication.UniPlatform;  //获取设备信息  可以放在在页面(窗体)时


//设备类型

function DetectDeviceType: string;

begin

  if (upPhone in uPlat) then

     Result := '手机'

  else if (upTablet in uPlat) then

    result := '平板'

  else if (upDesktop in uPlat) then

    result := '电脑';

end;


function DetectModel: string;

begin

  if (upiPad in uPlat) then

    Result := 'iPad'

  else if (upiPod in uPlat) then

    Result := 'iPod'

  else if (upiPhone in uPlat) then

    Result := 'iPhone'

  else if (upAndroid in uPlat) then

    Result := 'Android Mobile Device'

  else if (upDesktop in uPlat) then

    Result := 'Desktop PC';

end;


function DetectOperationSystem: string;

begin

  if (upAndroid in uPlat) then

    Result := 'Android'

  else if (upiOS in uPlat) then

    Result := 'iOS'

  else if (upDesktop in uPlat) then

    Result := 'Desktop OS';

end;


function DetectPlatform: string;

begin

  if (upDesktop in uPlat) then

    result := 'Desktop'

  else if (upMobile in uPlat) then

    result := 'Mobile';

end;


直接调用对应的函数,就可以知道具体的设备信息了。

————————————————


原文链接:https://blog.csdn.net/tanqth/article/details/117303203



推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.046064138412476 seconds