How to Get folder addresses in C

Source: Internet
Author: User
How to Get folder addresses in C
 
 

# Include <stdio. h>
# Include <stdlib. h>

# Include <shlobj. h>

Void main (INT argc, char * argv [])
{
Tchar szpath [max_path];
If (succeeded (shgetfolderpath (null,
Csidl_common_admintools | csidl_flag_create,
Null,
0,
Szpath )))
{
Printf (szpath );
Printf ("/N ");
}
}

//************************************** *************************************
// Csidl_flag_create ($8000)
// Windows 2000: If the folder referenced by csidl does not exist, create this folder !.
// Csidl_flag_dont_verify ($4000)
// Windows 2000: whether or not the folder referenced by csidl exists!
// Csidl_admintools ($30)
// Indicates the current user's "Administrative Tools" system folder
// Csidl_altstartup ($ h1d)
// Unknown
// Csidl_appdata ($ 1a)
// Indicates the specific application data storage folder of the current user, for example, C:/Documents and Settings/username/Application Data
// Csidl_bitbucket ($)
// Indicates the recycle bin.
// Csidl_common_admintools ($ 2f)
// Indicates all users' "Administrative Tools" system folders
// Csidl_common_altstartup ($ 1D)
// Indicates all users (only Windows NT systems are supported)
// Csidl_common_appdata ($23)
// Indicates the specific application data storage folder of all users, for example, C:/Documents and Settings/all users/Application Data
// Csidl_common_shorttopdirectory ($19)
// Indicates the "desktop" folder of all users, for example, C:/Documents and Settings/all users/desktop.
// Csidl_common_documents ($ 2e)
// Indicates the "My Documents" folder for all users, for example, C:/Documents and Settings/all users/Documents
// Csidl_common_favorites ($ 1f)
// Indicates the "My favorites" folder of all users.
// Csidl_common_programs ($17)
// Indicates the "program" folder of all users, for example, C:/Documents and Settings/all users/Start Menu/programs
// Csidl_common_startmenu ($16)
// Indicates the "Start Menu" folder of all users, for example, C:/Documents and Settings/all users/Start Menu.
// Csidl_common_startup ($18)
// Indicates the "Start" folder of all users, for example, C:/Documents and Settings/all users/Start Menu/programs/startup
// Csidl_common_templates ($ 2d)
// Indicates the "modules" folder of all users, for example, C:/Documents and Settings/all users/templates
// Csidl_controls ($3)
// Indicates the "control panel" folder
// Csidl_cookies ($21)
// Indicates the cookie folder of the current user Internet Explorer, for example, C:/Documents and Settings/username/cookies
// Csidl_desktop ($0)
// Indicates the "desktop" virtual folder, which contains all the content in the computer
// Csidl_shorttopdirectory ($10)
// Indicates the current user's "desktop" folder, for example, C:/Documents and Settings/username/desktop
// Csidl_drives ($11)
// Indicates the "my computer" virtual folder, which contains all the drives on the computer
// Csidl_favorites ($6)
// Indicates the current user's "favorites" folder, for example, C:/Documents and Settings/username/favorites
// Csidl_fonts ($14)
// Indicates the "System font" folder, for example, C:/winnt/Fonts
// Csidl_history ($22)
// Indicates the "history" folder of Inernet Explorer
// Csidl_internet ($1)
// This virtual folder of the Internet
// Csidl_internet_cache ($20)
// Indicates the "cache" folder of the current user's Internet Explorer, such as: C:/Documents ents and settings/username/Temporary Internet Files
// Csidl_local_appdata ($ 1c)
// Indicates the application data folder of the current user, for example, C:/Documents and Settings/username/Local Settings/Application Data
// Csidl_mymusic
// Indicates the folder where the current user stores music files, for example, C:/Documents and Settings/user/My Documents/my music
// Csidl_mypictures ($27)
// Indicates the folder where the current user Stores image files, for example, C:/Documents and Settings/username/My Documents/my pictures
// Csidl_nethood ($13)
// Indicates the network connection folder of the current user, for example, C:/Documents and Settings/username/nethood.
// Csidl_network ($12)
// Indicates the virtual folder "Network Neighbor"
// Csidl_personal ($5)
// Indicates the "My Documents" folder of the current user, for example, C:/Documents and Settings/username/My Documents ents
// Csidl_printers ($4)
// Point to the virtual folder "Printer"
// Csidl_printhood ($ 1b)
// Indicates the virtual folder of the current user's network printer, for example, C:/Documents and Settings/username/printhood
// Csidl_profile ($28)
// Indicates the folder of the current user configuration file
// Csidl_program_files ($26)
// Indicates the folder of the program file, for example, C:/Program Files
// Csidl_program_files_common ($ 2B)
// Indicates that system programs Share Component folders, for example, C:/program files/common
// Csidl_programs ($2)
// Indicates the current user's "program" menu folder, for example: C:/Documents and Settings/username/Start Menu/programs
// Csidl_recent ($8)
// Indicates the current user's "document" menu folder, for example: C:/Documents and Settings/username/Start Menu/programs
// Csidl_sendto ($9)
// Indicates the "sent" folder of the current user, for example, C:/Documents and Settings/username/sendto
// Csidl_startmenu ($ B)
// Indicates the "Start" menu folder of the current user, for example, C:/Documents and Settings/username/Start Menu
// Csidl_startup ($7)
// Indicates the current user's "start" menu folder, for example: C:/Documents and Settings/username/Start Menu/programs/startup
// Csidl_system ($25)
// Indicates the Windows system folder, for example, C:/winnt/system32.
// Csidl_templates ($15)
// Indicates the folder for storing the document module in the system
// Csidl_windows ($24)
// Indicates the files in the Windows directory in the system, for example, C:/winnt.
//************************************** *************************************/

 

Csidl_personal
:
Void main (INT argc, char * argv [])
{
Tchar szpath [max_path];
If (succeeded (shgetfolderpath (null,
Csidl_personal | csidl_flag_create,
Null,
0,
Szpath )))
{
Printf (szpath );
Printf ("/N ");
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.