Get a solution for Windows system icons

xiaoxiao2021-03-06  40

If you want to get a system icon in your computer or network neighbor, you can have the following solutions. Scenary One Icon Extract Software From C: /Winnt/System32/Shell32.dll or C: /WinNT/EXPLORER.EXE and then adds to its own program (the path varies from the operating system and installation directory) The shortcomings of the method are that the system icons of different operating systems have some changes, such as the system icons of 2003 and 2000, if you extracted 2000 icons, applications can appear in 2003. awkward. Solution 2 is also extracted with the C: / WinNT / System32 / shell32 file, but this time is done using the registry and Windows function. The code is as follows: hicon ctestdlg :: getShellicon (int NINDEX) {Hicon Hicon = NULL; HKEY HKEYSHELLCI

// Open the registry, read the corresponding icon item IF (regopenkeyex (hkey_local_machine, "software // microsoft // windows // currentversion ////// shell i cons", 0, key_read, & hkeyshellicons) == error_success) {char szBuffer [MAX_PATH]; DWORD dwSize = MAX_PATH; char szIndex [4]; sprintf (szIndex, "% d", nIndex); if (RegQueryValueEx (hkeyShellIcons, szIndex, NULL, NULL, (LPBYTE) szBuffer, & dwSize) == ERROR_SUCCESS ) {CString strFile, strIndex; AfxExtractSubString (strFile, szBuffer, 0, ','); AfxExtractSubString (strIndex, szBuffer, 1, ','); ExtractIconEx (strFile, atoi (strIndex), NULL, & hIcon, 1);} RegcloseKey (HKEYSHELLICONS);} if (! HiCon) ExtracticOnex ("shell32.dll", nindex, null, & hic, 1); return hicon;} This method overcomes the first method to use unfained disadvantages but code quantity comparison Big. (Index Directory is listed in the last list) Solution 3 uses the shell function ShgetSpecialFolderLocation and ShgetFileinfo. Code is as follows: LPITEMIDLIST lpItemIDList; SHFILEINFO shinfo; SHGetSpecialFolderLocation (this-> m_hWnd, CSIDL_NETWORK, & lpItemIDList); SHGetFileInfo ((LPCTSTR) lpItemIDList, NULL, & shinfo, sizeof (shinfo), SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME | SHGFI_ICON | SHGFI_SMALLICON | SHGFI_PIDL); this time The icon and Hicon in Shinfo saves the value of the obtained Icon. This method is both flexible, and the amount of code is relatively small, recommended. The second parameter in the ShgetSpecialFolderLocation is the CSIDL value of the image you want to get.

[Schedule 1: Nindex Value Description] NINDEX Meaning Description 0 Default Icon 1 Default .doc Icon * 2 Executable File Icon 3 Close Folder Icon Open Folder Icon 5.25 'Drive Icon 6 3.5' Drive Icon 7 Mobileable drive icon 8 hard drive icon 9 network drive icon 10 disconnected network drive icon 11 CD-ROM drive icon 12 RAM driver icon 13 Overall network icon 14 network connection icon U15 network workstation icon 16 local printer icon * 17 network icon U18 network working group icon U19 program group icon S20 document icon S21 set icon S22 lookup icon S23 help icon S24 run icon S25 sleep icon S26 Docking station icon U27 shutdown icon S28 shared icon T29 shortcut arrow icon T30 big arrow icon U31 empty recycling Station icon * 32 full recycling station icon * 33 dial network icon * 34 desktop icon 35 console icon * 36 program group icon S37 printer folder icon * 38 font folder icon * 39 Windows banner icon * 40 Audio CD icon .. ..49 The description of the symbol after .. There is a special usage: * These icons can be set in the registry. T These icons must be white background. s These icons will be used on the start menu. u These icons may not use or cannot modify the registry [Schedule 2: csidl values] a Number of Folders Are Used Frequently by Applications, But May Not Haven System. For Example, The System folder may be "C: / Windows" on one system and "C: / Winnt" on another CSIDL values ​​provide a unique system-independent way to identify these special folders The values ​​supersede the use of environment variables for this purpose A... CSIDL is used in conjunction with one of four Shell functions, SHGetFolderLocation, SHGetFolderPath, SHGetSpecialFolderLocation, and SHGetSpecialFolderPath, to retrieve a special folder's pathname or item ID list (PIDL). If a special folder does not exist, you can force its creation by using The Following Special Csidl:

CSIDL_FLAG_CREATE

Version 5.0

. Combine this CSIDL with any of the CSIDLs listed below to force the creation of the associated folder.The remaining CSIDLs correspond to either file system folders or virtual folders. Where the CSIDL identifies a file system folder, a commonly used path is given as an EXAMPLE. Other paths May be used. Some csidls can be be mapped to an equivalent% Variablename% Environment Variable. Csidls Are More Reliable, However, and Should Be Used if Possible.

CSIDL_ADMINTOOLS

Version 5.0

......................................

CSIDL_ALTSTARTUP

File System Directory That Corresponds to The User's Nonlocalized Startup Program Group.

CSIDL_APPDATA

Version 4.71.

File system directory that serves as a common repository for application-specific data A typical path is C:.. / Documents and Settings / username / Application Data This CSIDL is supported by the redistributable ShFolder.dll for systems that do not have the Internet Explorer 4.0 Integrated Shell Installed.

CSIDL_bitBucket

Virtual Folder Containing The Objects in The User's Recycle Bin.

CSIDL_COMMON_ADMINTOOLS

Version 5.0

. File System Directory Containing Containing Administrative Tools for All Users of the Computer.

CSIDL_COMMON_ALTSTARTUP

File System Directory That Corresponds to The Nonlocalized Startup Program Group for All Users. Valid Only for Windows NT® Systems.

CSIDL_COMMON_APPDATA

Version 5.0

. A type. A type..

CSIDL_COMMON_DESKTOPDIRECTORY

File system directory that contains files and folders that appear on the desktop for all users A typical path is C:.. / Documents and Settings / All Users / Desktop Valid only for Windows NT® systems.CSIDL_COMMON_DOCUMENTS

File system directory that contains documents that are common to all users Typical paths are C:. / Documents and Settings / All Users / Documents Valid for Windows NT® systems and Windows 95 and Windows 98 systems with Shfolder.dll installed..

CSIDL_COMMON_FAVORITES

File System Directory That Serves AS A Common Repository for All Users' Favorite Items. Valid Only for Windows NT® Systems.

CSIDL_COMMON_PROGRAMS

File system directory that contains the directories for the common program groups that appear on the Start menu for all users A typical path is C:. / Documents and Settings / All Users / Start Menu / Programs Valid only for Windows NT® systems..

CSIDL_COMMON_STARTMENU

File system directory that contains the programs and folders that appear on the Start menu for all users A typical path is C:.. / Documents and Settings / All Users / Start Menu Valid only for Windows NT® systems.

CSIDL_COMMON_STARTUP

. File system directory that contains the programs that appear in the Startup folder for all users A typical path is C:. / Documents and Settings / All Users / Start Menu / Programs / Startup Valid only for Windows NT® systems.

CSIDL_COMMON_TEMPLATES

File System Directory That Contains The Templates That Are Available To All Users. A Typical Path IS C: / Documents and Settings / All Users / Templates. Valid Only for Windows NT® Systems.

CSIDL_CONTROLS

Virtual Folder Containing Icons for the Control Panel Applications.

CSIDL_COOKIES

File System Directory That Serves as a common repository for Internet cookies. A type. A type c: / documents and settings / username / cookies.csidl_desktop

Windows Desktop-Virtual Folder That Is The Root of The Namespace.

CSIDL_DESKTOPDIRECTORY

File System Directory Used to Physically Store File Objects on The Desktop (Not to Be Confused with The Desktop Folder Itself). A Typical Path IS C: / Documents and Settings / UserName / Desktop

CSIDL_DRIVES

My Computer-Virtual Folder Containing Everything on The Local Computer: Storage Devices, Printers, And Control Panel. The Folder May Also Contain Mapped NetWork Drives.

CSIDL_FAVORITES

File System Directory That Serves As A Common Repository for the user's favorite item. A Typical Path is C: / Documents and settings / username / favorites.

CSIDL_FONTS

Virtual folder containing fonts. A type is c: / winnt / fonts.

CSIDL_HISTORY

File System Directory That Serves as a common repository for Internet History Items.

CSIDL_INTERNET

Virtual folder representing the internet.

CSIDL_INTERNET_CACHE

Version 4.72.

File System Directory That Serves AS A Common Repository for Temporary Internet Files. A Typical Path IS C: / Documents and Settings / UserName / Temporary Internet Files.

CSIDL_LOCAL_APPDATA

Version 5.0

. ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

CSIDL_MYMUSIC

File System Directory That Serves AS A Common Repository for Music Files.

CSIDL_MYPICTURES

Version 5.0

. A Typical path is c: / documents and settings / username / my documents / my pictures.

CSIDL_NETHOOD

A File System Folder Containing The Link Objects That May Exist in The My Network Places Virtual Folder. It is not the Same Ascsidl_network

Which represents the network namespace root. a Typical path is c: / documents and settings / username / ntend.

CSIDL_NETWORK

Network neighborhood-virtual folder representing the root of the network namespace hierarchy.

CSIDL_PERSONAL

File system directory that serves as a common repository for documents A typical path is C:. / Documents and Settings / username / My Documents This should be distinguished from the virtual My Documents folder in the namespace To access that virtual folder, use the.. Technique Described in

Managing the file system

.

CSIDL_PRINTERS

Virtual Folder Containing Installed Printers.

CSIDL_PRINTHOOD

File System Directory That Contains The Link Objects That May Exist in The Printers Virtual Folder. A Typical Path IS C: / Documents and Settings / UserName / Printhood.

CSIDL_PROFILE

Version 5.0

User's Profile Folder.

CSIDL_PROGRAM_FILES

Version 5.0

Files folder. A Typical Path IS C: / Program Files.

CSIDL_PROGRAM_FILES_COMMON

Version 5.0

........................ ..

CSIDL_PROGRAMS

File System Directory That Contains The User's Program Groups (Which Are Also File System Director). A Typical Path IS C: / Documents and Settings / UserName / Start Menu / Programs.

CSIDL_RECENT

File System Directory That Contains The User's Most Recently Used Documents. A Typical Path IS C: / Documents and Settings / UserName / Recent. To Create A Shortcut in this Folder, USE

ShaddtoreCentDocs

In addition to create the shell's list of recent Documents and adds the shortcut to the documents Submenu of the start menu.csidl_sendto

File System Directory That Contains Send To Menu Items. A Typical Path IS C: / Documents and Settings / UserName / Sendto.

CSIDL_STARTMENU

File System Directory Containing Start Menu Items. A Typical Path IS C: / Documents and Settings / UserName / Start Menu.

CSIDL_STARTUP

File system directory that corresponds to the user's Startup program group The system starts these programs whenever any user logs onto Windows NT® or starts Windows® 95. A typical path is C:. / Documents and Settings / username / Start Menu / Programs / Startup .

CSIDL_SYSTEM

Version 5.0

.....................

CSIDL_TEMPLATES

File System Directory That Serves as a common repository for document templates.

CSIDL_WINDOWS

Version 5.0

Windows Directory or sysroot. This Corresponds to the% WINDIR% OR% SystemRoot% Environment Variables. A Typical Path IS C: / Winnt. Author: Simahao 2005.1.3

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

New Post(0)