Shell Programming: Use CSIDL to open a special folder

zhaozj2021-02-08  199

CSIDL Description and Instructions: CSIDL represents the identifier value of a special folder in the Windows Shell. The special folder that is said here is a folder defined by the Windows Shell, for example: "My Document", "Recycle Bin", "INERNET CACHE Folder" is some special folders specified by shell. These special files The clip can be a physical path on a disk, or a virtual folder! Note: The Virtual Folder virtual folder is a folder defined by the Windows Shell, but this folder does not have your computer. Any physical path to correspond. For example: "My Computer" is a virtual folder containing all drives, as well as "Control Panel" is also a virtual folder, and so on. Virtual folders are rarely applied to non-shell functions. In Windows2000 / NT, many of the folders involved in CSIDL are for each user. But similar to CSIDL_COMMON_ * can be used for all users.

In many applications, a CSIDL can be combined with one of the following identities:

CSIDL_FLAG_CREATE ($ 8000) Windows 2000: If this CSIDL is not referenced, the folder is created!. Csidl_flag_dont_verify ($ 4000) Windows 2000: Whether this CSIDL is referenced by the folder exists!

CSIDL_ADMINTOOLS ($ 30) represents the current user's "management tool" system folder CSIDL_ALTSTARTUP ($ H1D) Unknown CSIDL_APPDATA ($ 1A) Indicates a specific application data storage folder of the current user, for example: c: / documents and settings / username / Application Data CSIDL_bitBucket ($ a) Indicates the recycle bin csidl_common_admintools ($ 2f) means that all users' "management tool" system folder CSIDL_COMMON_ALTSTARTUP ($ 1D) ​​means all users (only supporting Windows NT systems) CSIDL_COMMON_APPDATA ($ 23) means all users Specific application data storage folder, for example: c: / documents and settings / all users / application data csidl_common_desktopdirectory ($ 19) represents "desktop" folders for all users, for example: c: / documents and settings / all users / desktop . CSIDL_COMMON_DOCUMENTS ($ 2e) represents all users '"My Documents" folders, such as: c: / documents and settings / all users / documents csidl_common_favorites ($ 1F) represents all users' My Favorites folder.

CSIDL_COMMON_PROGRAMS ($ 17) represents all users '"program" folders, such as: c: / stores and settings / all users / start menu / programs CSIDL_COMMON_STARTMENU ($ 16) represents all users' "Start Menu" folders, for example: C: / Documents / Start Menu CSIDL_COMMON_STARTUP ($ 18) represents all users' "launch" folders, such as: c: / documents and settings / all users / start men / programs / startup csidl_common_templates ($ 2D) means all users "Module" folder, for example: c: / documents and settings / all users / templates csidl_controls ($ 3) Represents the "Control Panel" folder CSIDL_COOKIES ($ 21) represents the Cookie folder of the current user Internet Explorer, for example: C: / Documents And settings / username / cookies csidl_desktop ($ 0) Represents the Desktop virtual folder, contains all content in your computer CSIDL_DESKTOPDIRECTORY ($ 10) represents the current user's desktop folder, for example: c: / documents and settings / username / Desktop CSIDL_DRIVES ($ 11) Represents "My Computer" virtual folder, contains all drives CSIDL_FAVORITES ($ 6) in your computer represents the current user's Favorites folder, for example: c: / documents and settings / username / favorites csidl_fonts ($ 14) Represents "System Font" folder, for example: C: / Winnt / Fonts CSIDL_HISTORY ($ 22) indicates that INERNET Explorer's "History" folder CSIDL_INTERNET ($ 1) represents this virtual folder CSIDL_INTERNET_CACHE ($ 20) Represents the "cache" folder of the current user's Internet Explorer, for example: c: / documents and settings / username / temporary Internet files csidl_local_Appdata ($ 1C) represents the current user's application data folder, for example: C: / Documents and Settings / username / local settings / Application Data CSIDL_MYMUSIC represents a folder of the current user to store music files, for example: c: / documents and settings / user / my documents / my music csidl_mypictures ($ 27) represents a folder of the current user stores image files, for example : C: / documents and settings / username / my documents / my pictures csidl_netood ($ 13) represents a folder of the current user exists, for example:

C: / Documents and Settings / UserName / NetHood CSIDL_NETWORK ($ 12) Represents "Online Neighbors" Virtual Folder CSIDL_PERSONAL ($ 5) represents the current user's "My Document" folder, for example: c: / documents and settings / username / My Documents CSIDL_PRINTERS ($ 4) Points to "Printer" Virtual Folder CSIDL_PrinThood ($ 1B) represents the virtual folder of the network printer exists in the current user, for example: c: / documents and settings / username / printhood csidl_profile ($ 28) indicates that the current use User Profile Folder CSIDL_PROGRAM_FILES ($ 26) Represents folder of the program file, for example: C: / Program Files CSIDL_PROGRAM_FILES_COMMON ($ 2B) Represents System Program Shared Components folder, for example: C: / Program Files / Common CSIDL_PROGRAMS ($ 2) Represents the current user's "program" menu folder, for example: c: / store menu / programs CSIDL_RECENT ($ 8) Represents the current user's "Document" menu folder, for example: C: / Documents and Settings / UserName / Start Menu / Programs CSIDL_SENDTO ($ 9) represents the "Send to" folder of the current user, for example: c: / docuto csidl_startMenu ($ b) represents the "Start" menu folder of the current user, for example : C: / documents and settings / username / start menu CSIDL_STARTUP ($ 7) Represents the current user's "Start" menu folder, for example: c: / documents and settings / username / start menu / programs / startup csidl_system ($ 25) means Windows Systematic system folder, for example: C: / Wi NNT / System32 CSIDL_TEMPLATES ($ 15) indicates that the folder CSIDL_WINDOWS ($ 24) in the system is represented by the file of the Windows directory in the system, for example: C: / WinntCSIDL can be used in the following API function, as for Instructions for functions, we can refer to the API in MSDN: ShgetFolderLocation, ShgetFolderPath, ShgetSpecialFolderLocation, ShgetspecialFolderPath

Let's take a look at the following example: // Open some special folders, you need to add ActiveX, Shellapi, SHlobj unit Uses ActiveX, Shellapi, Shlobj; Function OpenSpecialFolder (Flag: Integer; Handle: hwnd = 0): boolean; // Here the Flag is CSIDL value Procedure FreePidl (pidl: PItemIDList) we need to open the folder; // relieved PItemIDList instance var allocator: IMalloc; begin if Succeeded (shlobj.SHGetMalloc (allocator)) then begin allocator.Free (pidl) {$ IFDEF VER90} allocator.release; {$ ENDIF} end; end; var exinfo: tshellexecuteinfo; begin fillcha (exinfo, sizeof (exinfo), 0); // Set the initial value for the exinfo do begin Cbsize: = sizeof (exInfo); fMask: = SEE_MASK_FLAG_DDEWAIT or SEE_MASK_IDLIST; Wnd: = handle; nShow: = SW_SHOWNORMAL; lpVerb: = 'open'; SHGetSpecialFolderLocation (handle, Flag, PItemIDLIst (lpIDList)); // the specified target value CSIDL Folder END; SHELLEXECUTEEX; // Open Folder FreePIDL (End; //) This function is called: Procedure TFORM1.BUTTON5Click (Sender: TOBJECT); Begin OpenSpecialFolder ($ 0); / / Or OpenSpecialFolder (CSIDL_DESKTOP) opens "Desktop" window END; Everyone can refer to MSDN!

转载请注明原文地址:https://www.9cbs.com/read-2736.html

New Post(0)