The Delphi function to get My Videos folder

CK CK 3788 
Created at
Updated at  
2,344 0 0

In order to get My Videos folder, you need to call SHGetSpecialFolderPath(). But I recommend you to use below wrapper for easy control.

 

function GetSpecialFolderPath(Folder: Integer; CanCreate: Boolean): string;
// Gets path of special system folders
//
// Call this routine as follows:
// GetSpecialFolderPath (CSIDL_PERSONAL, false)
//        returns folder as result
//
var
   FilePath: array [0..255] of char;
begin
 SHGetSpecialFolderPath(0, @FilePath[0], FOLDER, CanCreate);
 Result := FilePath;
end;

What you want is simply 'My Videos' folder, you can get it as below way.

m_directory.Text := GetSpecialFolderPath(CSIDL_MYVIDEO, True);

In case that you need to get other special folders like My Musics, My Pictures, or something like that, below information will be helpful for you.

CSIDL_DESKTOP                       = $0000; { <desktop> }
CSIDL_INTERNET                      = $0001; { Internet Explorer (icon on desktop) }
CSIDL_PROGRAMS                      = $0002; { Start MenuPrograms }
CSIDL_CONTROLS                      = $0003; { My ComputerControl Panel }
CSIDL_PRINTERS                      = $0004; { My ComputerPrinters }
CSIDL_PERSONAL                      = $0005; { My Documents.  This is equivalent to CSIDL_MYDOCUMENTS in XP and above }
CSIDL_FAVORITES                     = $0006; { <user name>Favorites }
CSIDL_STARTUP                       = $0007; { Start MenuProgramsStartup }
CSIDL_RECENT                        = $0008; { <user name>Recent }
CSIDL_SENDTO                        = $0009; { <user name>SendTo }
CSIDL_BITBUCKET                     = $000a; { <desktop>Recycle Bin }
CSIDL_STARTMENU                     = $000b; { <user name>Start Menu }
CSIDL_MYDOCUMENTS                   = $000c; { logical "My Documents" desktop icon }
CSIDL_MYMUSIC                       = $000d; { "My Music" folder }
CSIDL_MYVIDEO                       = $000e; { "My Video" folder }
CSIDL_DESKTOPDIRECTORY              = $0010; { <user name>Desktop }
CSIDL_DRIVES                        = $0011; { My Computer }
CSIDL_NETWORK                       = $0012; { Network Neighborhood (My Network Places) }
CSIDL_NETHOOD                       = $0013; { <user name> ethood }
CSIDL_FONTS                         = $0014; { windowsfonts }
CSIDL_TEMPLATES                     = $0015;
CSIDL_COMMON_STARTMENU              = $0016; { All UsersStart Menu }
CSIDL_COMMON_PROGRAMS               = $0017; { All UsersStart MenuPrograms }
CSIDL_COMMON_STARTUP                = $0018; { All UsersStartup }
CSIDL_COMMON_DESKTOPDIRECTORY       = $0019; { All UsersDesktop }
CSIDL_APPDATA                       = $001a; { <user name>Application Data }
CSIDL_PRINTHOOD                     = $001b; { <user name>PrintHood }
CSIDL_LOCAL_APPDATA                 = $001c; { <user name>Local SettingsApplication Data (non roaming) }
CSIDL_ALTSTARTUP                    = $001d; { non localized startup }
CSIDL_COMMON_ALTSTARTUP             = $001e; { non localized common startup }
CSIDL_COMMON_FAVORITES              = $001f;
CSIDL_INTERNET_CACHE                = $0020;
CSIDL_COOKIES                       = $0021;
CSIDL_HISTORY                       = $0022;
CSIDL_COMMON_APPDATA                = $0023; { All UsersApplication Data }
CSIDL_WINDOWS                       = $0024; { GetWindowsDirectory() }
CSIDL_SYSTEM                        = $0025; { GetSystemDirectory() }
CSIDL_PROGRAM_FILES                 = $0026; { C:Program Files }
CSIDL_MYPICTURES                    = $0027; { C:Program FilesMy Pictures }
CSIDL_PROFILE                       = $0028; { USERPROFILE }
CSIDL_SYSTEMX86                     = $0029; { x86 system directory on RISC }
CSIDL_PROGRAM_FILESX86              = $002a; { x86 C:Program Files on RISC }
CSIDL_PROGRAM_FILES_COMMON          = $002b; { C:Program FilesCommon }
CSIDL_PROGRAM_FILES_COMMONX86       = $002c; { x86 C:Program FilesCommon on RISC }
CSIDL_COMMON_TEMPLATES              = $002d; { All UsersTemplates }
CSIDL_COMMON_DOCUMENTS              = $002e; { All UsersDocuments }
CSIDL_COMMON_ADMINTOOLS             = $002f; { All UsersStart MenuProgramsAdministrative Tools }
CSIDL_ADMINTOOLS                    = $0030; { <user name>Start MenuProgramsAdministrative Tools }
CSIDL_CONNECTIONS                   = $0031; { Network and Dial-up Connections }
CSIDL_COMMON_MUSIC                  = $0035; { All UsersMy Music }
CSIDL_COMMON_PICTURES               = $0036; { All UsersMy Pictures }
CSIDL_COMMON_VIDEO                  = $0037; { All UsersMy Video }
CSIDL_RESOURCES                     = $0038; { Resource Directory }
CSIDL_RESOURCES_LOCALIZED           = $0039; { Localized Resource Directory }
CSIDL_COMMON_OEM_LINKS              = $003a; { Links to All Users OEM specific apps }
CSIDL_CDBURN_AREA                   = $003b; { USERPROFILELocal SettingsApplication DataMicrosoftCD Burning }
CSIDL_COMPUTERSNEARME               = $003d; { Computers Near Me (computered from Workgroup membership) }
CSIDL_PROFILES                      = $003e;

 

Tags CloudFront Private URL CloudFront Signed URL CloudFront Temporary URL My Pictures My Videos SHGetSpecialFolderPath Startup Folder 내 비디오 Facebook X
Comments 0
  1. Building a Simple DNS Server in Delphi with TTL Support
    687
  2. Run PowerShell Command as Administrator in Delphi
    659
  3. Run command with Administrator permission in Delphi on Microsoft Windows
    767
  4. Delphi code to send data to web server based on POST method
    1,037
  5. Good Delphi components
    932
  6. How to download/grap web pages or XML document at internet website in Delphi XE?
    880
  7. Delphi Program can command level execution program with hidden mode
    703
  8. How To Turn On/Off Monitor with Delphi
    858
  9. How to get application version number in Delphi
    1,559
  10. Get Application Data Path on Delphi
    840
  11. I want to select directory(folder) not file. How can I do that ?
    625
  12. Changing the Title of a Print Dialog in Delphi
    1,098
  13. Auto Logon Programming in Delphi
    1,034
  14. Thread Application Implementation in TThread
    670
  15. Is there directory selection VCL component in Delphi ?
    525
  16. How to launch the external application in Delphi ?
    1,074
  17. How to print external document ?
    423
  18. Delphi API to get windows temporary directory
    587
  19. Delphi API to get the current working directory
    1,254
  20. How to resize PNG file in Delphi ?
    1,227
  21. Get the length of arrays and a string
    1,745
  22. Delphi Pointer Types
    22,115
  23. How to read/wrtie INI file in Delphi ?
    3,126
  24. How to get file created time, modified time, and last accessed time ?
    3,352
Recently updated
  1. Google OAuth Token Expiration: Causes and Solutions
    31
  2. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    57
  3. Why SPF and DKIM Are Essential for Linux Email Servers?
    51
  4. How do I create animated background for Google Meet?
    23,256
  5. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    273
  6. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    105
  7. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    170
  8. Array of arguments passed to script in PHP
    99
  9. Invalid Auction Storms in Ad Tech
    108
  10. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    209
  11. The Two Clocks of Ad Server Architecture
    78
  12. Frequency Cap Architecture Overview
    527
  13. Collecting Proof-of-Play from 100,000 Screens
    154
  14. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    303
  15. What is RedisVL?
    117
  16. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    247
  17. TPU & GPU Cluster Management Tools
    258
  18. The Concept of Scaffolding in AI Agents
    245
  19. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    599
  20. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    269
  21. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    355
  22. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    207
  23. Machine Learning: Training vs. Ranking
    231
  24. The Continuous Learning Machine: Designing a Loop That Actually Turns
    229
  25. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    204
  26. Designing a Data Curation System Around a Vector Database
    230
  27. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    264
  28. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    674
  29. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    201
  30. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    233