设为首页 加入收藏

TOP

[函数] Firemonkey 取得 Windows 目前 User 的 Desktop 目录
2017-10-10 12:05:43 】 浏览:8108
Tags:函数 Firemonkey 取得 Windows 目前 User Desktop 目录

下列方法仅提供 Windows 平台使用,所以需要使用编译开关,代码如下:

uses
  {$IFDEF MSWINDOWS}
  Winapi.Windows,
  Winapi.SHFolder,
  {$ENDIF}

{$IFDEF MSWINDOWS}
const CSIDL_DESKTOP = $0000; // <desktop>
function GetDesktopPath: string;
var
  LStr: array[0 .. MAX_PATH] of Char;
begin
  SetLastError(ERROR_SUCCESS);

  if SHGetFolderPath(0, CSIDL_DESKTOP, 0, 0, @LStr) = S_OK then
    Result := LStr;
end;
{$ENDIF}

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇新公司一个半月 下一篇delphi xe7 多线程调用CMD,使用管..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目