📄 shellapi.h
字号:
#define NIS_SHAREDICON 0x00000002
// says this is the source of a shared icon
// Notify Icon Infotip flags
#define NIIF_NONE 0x00000000
// icon flags are mutually exclusive
// and take only the lowest 2 bits
#define NIIF_INFO 0x00000001
#define NIIF_WARNING 0x00000002
#define NIIF_ERROR 0x00000003
#if (_WIN32_IE >= 0x0600)
#define NIIF_USER 0x00000004
#endif
#define NIIF_ICON_MASK 0x0000000F
#if (_WIN32_IE >= 0x0501)
#define NIIF_NOSOUND 0x00000010
#endif
#endif
SHSTDAPI_(BOOL) Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA lpData);
SHSTDAPI_(BOOL) Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW lpData);
#ifdef UNICODE
#define Shell_NotifyIcon Shell_NotifyIconW
#else
#define Shell_NotifyIcon Shell_NotifyIconA
#endif // !UNICODE
////
//// End Tray Notification Icons
////
#ifndef SHFILEINFO_DEFINED
#define SHFILEINFO_DEFINED
////
//// Begin SHGetFileInfo
////
/*
* The SHGetFileInfo API provides an easy way to get attributes
* for a file given a pathname.
*
* PARAMETERS
*
* pszPath file name to get info about
* dwFileAttributes file attribs, only used with SHGFI_USEFILEATTRIBUTES
* psfi place to return file info
* cbFileInfo size of structure
* uFlags flags
*
* RETURN
* TRUE if things worked
*/
typedef struct _SHFILEINFOA
{
HICON hIcon; // out: icon
int iIcon; // out: icon index
DWORD dwAttributes; // out: SFGAO_ flags
CHAR szDisplayName[MAX_PATH]; // out: display name (or path)
CHAR szTypeName[80]; // out: type name
} SHFILEINFOA;
typedef struct _SHFILEINFOW
{
HICON hIcon; // out: icon
int iIcon; // out: icon index
DWORD dwAttributes; // out: SFGAO_ flags
WCHAR szDisplayName[MAX_PATH]; // out: display name (or path)
WCHAR szTypeName[80]; // out: type name
} SHFILEINFOW;
#ifdef UNICODE
typedef SHFILEINFOW SHFILEINFO;
#else
typedef SHFILEINFOA SHFILEINFO;
#endif // UNICODE
// NOTE: This is also in shlwapi.h. Please keep in synch.
#endif // !SHFILEINFO_DEFINED
#define SHGFI_ICON 0x000000100 // get icon
#define SHGFI_DISPLAYNAME 0x000000200 // get display name
#define SHGFI_TYPENAME 0x000000400 // get type name
#define SHGFI_ATTRIBUTES 0x000000800 // get attributes
#define SHGFI_ICONLOCATION 0x000001000 // get icon location
#define SHGFI_EXETYPE 0x000002000 // return exe type
#define SHGFI_SYSICONINDEX 0x000004000 // get system icon index
#define SHGFI_LINKOVERLAY 0x000008000 // put a link overlay on icon
#define SHGFI_SELECTED 0x000010000 // show icon in selected state
#define SHGFI_ATTR_SPECIFIED 0x000020000 // get only specified attributes
#define SHGFI_LARGEICON 0x000000000 // get large icon
#define SHGFI_SMALLICON 0x000000001 // get small icon
#define SHGFI_OPENICON 0x000000002 // get open icon
#define SHGFI_SHELLICONSIZE 0x000000004 // get shell size icon
#define SHGFI_PIDL 0x000000008 // pszPath is a pidl
#define SHGFI_USEFILEATTRIBUTES 0x000000010 // use passed dwFileAttribute
#if (_WIN32_IE >= 0x0500)
#define SHGFI_ADDOVERLAYS 0x000000020 // apply the appropriate overlays
#define SHGFI_OVERLAYINDEX 0x000000040 // Get the index of the overlay
// in the upper 8 bits of the iIcon
#endif
SHSTDAPI_(DWORD_PTR) SHGetFileInfoA(LPCSTR pszPath, DWORD dwFileAttributes, SHFILEINFOA *psfi, UINT cbFileInfo, UINT uFlags);
SHSTDAPI_(DWORD_PTR) SHGetFileInfoW(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
#ifdef UNICODE
#define SHGetFileInfo SHGetFileInfoW
#else
#define SHGetFileInfo SHGetFileInfoA
#endif // !UNICODE
#define SHGetDiskFreeSpace SHGetDiskFreeSpaceEx
SHSTDAPI_(BOOL) SHGetDiskFreeSpaceExA(LPCSTR pszDirectoryName, ULARGE_INTEGER* pulFreeBytesAvailableToCaller, ULARGE_INTEGER* pulTotalNumberOfBytes, ULARGE_INTEGER* pulTotalNumberOfFreeBytes);
SHSTDAPI_(BOOL) SHGetDiskFreeSpaceExW(LPCWSTR pszDirectoryName, ULARGE_INTEGER* pulFreeBytesAvailableToCaller, ULARGE_INTEGER* pulTotalNumberOfBytes, ULARGE_INTEGER* pulTotalNumberOfFreeBytes);
#ifdef UNICODE
#define SHGetDiskFreeSpaceEx SHGetDiskFreeSpaceExW
#else
#define SHGetDiskFreeSpaceEx SHGetDiskFreeSpaceExA
#endif // !UNICODE
SHSTDAPI_(BOOL) SHGetNewLinkInfoA(LPCSTR pszLinkTo, LPCSTR pszDir, LPSTR pszName, BOOL *pfMustCopy, UINT uFlags);
SHSTDAPI_(BOOL) SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy, UINT uFlags);
#ifdef UNICODE
#define SHGetNewLinkInfo SHGetNewLinkInfoW
#else
#define SHGetNewLinkInfo SHGetNewLinkInfoA
#endif // !UNICODE
#define SHGNLI_PIDL 0x000000001 // pszLinkTo is a pidl
#define SHGNLI_PREFIXNAME 0x000000002 // Make name "Shortcut to xxx"
#define SHGNLI_NOUNIQUE 0x000000004 // don't do the unique name generation
#if (_WIN32_IE >= 0x0501)
#define SHGNLI_NOLNK 0x000000008 // don't add ".lnk" extension
#endif // _WIN2_IE >= 0x0501
////
//// End SHGetFileInfo
////
// Printer stuff
#define PRINTACTION_OPEN 0
#define PRINTACTION_PROPERTIES 1
#define PRINTACTION_NETINSTALL 2
#define PRINTACTION_NETINSTALLLINK 3
#define PRINTACTION_TESTPAGE 4
#define PRINTACTION_OPENNETPRN 5
#ifdef WINNT
#define PRINTACTION_DOCUMENTDEFAULTS 6
#define PRINTACTION_SERVERPROPERTIES 7
#endif
SHSTDAPI_(BOOL) SHInvokePrinterCommandA(HWND hwnd, UINT uAction, LPCSTR lpBuf1, LPCSTR lpBuf2, BOOL fModal);
SHSTDAPI_(BOOL) SHInvokePrinterCommandW(HWND hwnd, UINT uAction, LPCWSTR lpBuf1, LPCWSTR lpBuf2, BOOL fModal);
#ifdef UNICODE
#define SHInvokePrinterCommand SHInvokePrinterCommandW
#else
#define SHInvokePrinterCommand SHInvokePrinterCommandA
#endif // !UNICODE
#endif /* WINVER >= 0x0400 */
#if (_WIN32_WINNT >= 0x0500) || (_WIN32_WINDOWS >= 0x0500)
//
// The SHLoadNonloadedIconOverlayIdentifiers API causes the shell's
// icon overlay manager to load any registered icon overlay
// identifers that are not currently loaded. This is useful if an
// overlay identifier did not load at shell startup but is needed
// and can be loaded at a later time. Identifiers already loaded
// are not affected. Overlay identifiers implement the
// IShellIconOverlayIdentifier interface.
//
// Returns:
// S_OK
//
SHSTDAPI SHLoadNonloadedIconOverlayIdentifiers(void);
//
// The SHIsFileAvailableOffline API determines whether a file
// or folder is available for offline use.
//
// Parameters:
// pwszPath file name to get info about
// pdwStatus (optional) OFFLINE_STATUS_* flags returned here
//
// Returns:
// S_OK File/directory is available offline, unless
// OFFLINE_STATUS_INCOMPLETE is returned.
// E_INVALIDARG Path is invalid, or not a net path
// E_FAIL File/directory is not available offline
//
// Notes:
// OFFLINE_STATUS_INCOMPLETE is never returned for directories.
// Both OFFLINE_STATUS_LOCAL and OFFLINE_STATUS_REMOTE may be returned,
// indicating "open in both places." This is common when the server is online.
//
SHSTDAPI SHIsFileAvailableOffline(LPCWSTR pwszPath, LPDWORD pdwStatus);
#define OFFLINE_STATUS_LOCAL 0x0001 // If open, it's open locally
#define OFFLINE_STATUS_REMOTE 0x0002 // If open, it's open remotely
#define OFFLINE_STATUS_INCOMPLETE 0x0004 // The local copy is currently imcomplete.
// The file will not be available offline
// until it has been synchronized.
#endif
// sets the specified path to use the string resource
// as the UI instead of the file system name
SHSTDAPI SHSetLocalizedName(LPWSTR pszPath, LPCWSTR pszResModule, int idsRes);
//====== ShellMessageBox ================================================
// If lpcTitle is NULL, the title is taken from hWnd
// If lpcText is NULL, this is assumed to be an Out Of Memory message
// If the selector of lpcTitle or lpcText is NULL, the offset should be a
// string resource ID
// The variable arguments must all be 32-bit values (even if fewer bits
// are actually used)
// lpcText (or whatever string resource it causes to be loaded) should
// be a formatting string similar to wsprintf except that only the
// following formats are available:
// %% formats to a single '%'
// %nn%s the nn-th arg is a string which is inserted
// %nn%ld the nn-th arg is a DWORD, and formatted decimal
// %nn%lx the nn-th arg is a DWORD, and formatted hex
// note that lengths are allowed on the %s, %ld, and %lx, just
// like wsprintf
//
#if (_WIN32_IE >= 0x0601)
int _cdecl ShellMessageBoxA(
HINSTANCE hAppInst,
HWND hWnd,
LPCSTR lpcText,
LPCSTR lpcTitle,
UINT fuStyle,
...);
int _cdecl ShellMessageBoxW(
HINSTANCE hAppInst,
HWND hWnd,
LPCWSTR lpcText,
LPCWSTR lpcTitle,
UINT fuStyle,
...);
#ifdef UNICODE
#define ShellMessageBox ShellMessageBoxW
#else
#define ShellMessageBox ShellMessageBoxA
#endif // !UNICODE
#endif // (_WIN32_IE >= 0x0601)
#if (_WIN32_IE >= 0x0601)
SHSTDAPI_(BOOL) IsLFNDriveA(LPCSTR pszPath);
SHSTDAPI_(BOOL) IsLFNDriveW(LPCWSTR pszPath);
#ifdef UNICODE
#define IsLFNDrive IsLFNDriveW
#else
#define IsLFNDrive IsLFNDriveA
#endif // !UNICODE
#endif // (_WIN32_IE >= 0x0601)
#if _WIN32_IE >= 0x0600
STDAPI SHEnumerateUnreadMailAccountsA(HKEY hKeyUser, DWORD dwIndex, LPSTR pszMailAddress, int cchMailAddress);
STDAPI SHEnumerateUnreadMailAccountsW(HKEY hKeyUser, DWORD dwIndex, LPWSTR pszMailAddress, int cchMailAddress);
#ifdef UNICODE
#define SHEnumerateUnreadMailAccounts SHEnumerateUnreadMailAccountsW
#else
#define SHEnumerateUnreadMailAccounts SHEnumerateUnreadMailAccountsA
#endif // !UNICODE
STDAPI SHGetUnreadMailCountA(HKEY hKeyUser, LPCSTR pszMailAddress, DWORD *pdwCount, FILETIME *pFileTime, LPSTR pszShellExecuteCommand, int cchShellExecuteCommand);
STDAPI SHGetUnreadMailCountW(HKEY hKeyUser, LPCWSTR pszMailAddress, DWORD *pdwCount, FILETIME *pFileTime, LPWSTR pszShellExecuteCommand, int cchShellExecuteCommand);
#ifdef UNICODE
#define SHGetUnreadMailCount SHGetUnreadMailCountW
#else
#define SHGetUnreadMailCount SHGetUnreadMailCountA
#endif // !UNICODE
STDAPI SHSetUnreadMailCountA(LPCSTR pszMailAddress, DWORD dwCount, LPCSTR pszShellExecuteCommand);
STDAPI SHSetUnreadMailCountW(LPCWSTR pszMailAddress, DWORD dwCount, LPCWSTR pszShellExecuteCommand);
#ifdef UNICODE
#define SHSetUnreadMailCount SHSetUnreadMailCountW
#else
#define SHSetUnreadMailCount SHSetUnreadMailCountA
#endif // !UNICODE
#endif /* _WIN32_IE >= 0x0600 */
#if (_WIN32_IE >= 0x0601)
STDAPI_(BOOL) SHTestTokenMembership(HANDLE hToken, ULONG ulRID);
#endif // (_WIN32_IE >= 0x0601)
#if _WIN32_IE >= 0x0600
STDAPI SHGetImageList(int iImageList, REFIID riid, void **ppvObj);
#define SHIL_LARGE 0 // normally 32x32
#define SHIL_SMALL 1 // normally 16x16
#define SHIL_EXTRALARGE 2
#define SHIL_SYSSMALL 3 // like SHIL_SMALL, but tracks system small icon metric correctly
#define SHIL_LAST SHIL_SYSSMALL
// Function call types for ntshrui folder sharing helpers
typedef HRESULT (STDMETHODCALLTYPE *PFNCANSHAREFOLDERW)(IN LPCWSTR pszPath);
typedef HRESULT (STDMETHODCALLTYPE *PFNSHOWSHAREFOLDERUIW)(IN HWND hwndParent, IN LPCWSTR pszPath);
#endif /* _WIN32_IE >= 0x0600 */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#if !defined(_WIN64)
#include <poppack.h>
#endif
#endif /* _INC_SHELLAPI */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -