在使用Shlwapi.h中的系列函数时,需要:
不过,需要注意的是,有些字符串操作函数存在安全隐患,比如StrCpy,需要使用替代函数StringCchCopy,也可以自己写字符串拷贝函数,比如:
下面是Shlwapi.h中的所有函数列表,注意:在使用之前一定要查询最新的MSDN,以确定哪些函数有安全隐患,因而是不被推荐使用的。
String Function
=====================================
CharLowerWrapW
CharUpperBuffWrapW
ChrCmpI
CompareStringWrapW
GetAcceptLanguages
GetDateFormatWrapW
GetTimeFormatWrapW
IntlStrEqN
IntlStrEqNI
IntlStrEqWorker
IsCharAlphaNumericWrapW
IsCharSpace
OutputDebugStringWrapW
SHLoadIndirectString
SHStrDup
StrCat
StrCatBuff
StrCatChainW
StrChr
StrChrI
StrCmp
StrCmpC
StrCmpI
StrCmpIC
StrCmpLogicalW
StrCmpN
StrCmpNC
StrCmpNI
StrCmpNIC
StrCpy
StrCpyN
StrCSpn
StrCSpnI
StrDup
StrFormatByteSize64
StrFormatByteSizeA
StrFormatByteSizeW
StrFormatKBSize
StrFromTimeInterval
StrIsIntlEqual
StrNCat
StrPBrk
StrRChr
StrRChrI
StrRetToBSTR
StrRetToBuf
StrRetToStr
StrRetToStrN
StrRStrI
StrSpn
StrStr
StrStrI
StrToInt
StrToInt64Ex
StrToIntEx
StrTrim
wnsprintf
wvnsprintf
Path Functions
=====================================
PathAddBackslash
PathAddExtension
PathAppend
PathBuildRoot
PathCanonicalize
PathCombine
PathCommonPrefix
PathCompactPath
PathCompactPathEx
PathCreateFromUrl
PathCreateFromUrlAlloc
PathFileExists
PathFindExtension
PathFindFileName
PathFindNextComponent
PathFindOnPath
PathFindSuffixArray
PathGetArgs
PathGetCharType
PathGetDriveNumber
PathIsContentType
PathIsDirectory
PathIsDirectoryEmpty
PathIsFileSpec
PathIsHTMLFile
PathIsLFNFileSpec
PathIsNetworkPath
PathIsPrefix
PathIsRelative
PathIsRoot
PathIsSameRoot
PathIsSystemFolder
PathIsUNC
PathIsUNCServer
PathIsUNCServerShare
PathIsURL
PathMakePretty
PathMakeSystemFolder
PathMatchSpec
PathMatchSpecEx
PathParseIconLocation
PathQuoteSpaces
PathRelativePathTo
PathRemoveArgs
PathRemoveBackslash
PathRemoveBlanks
PathRemoveExtension
PathRemoveFileSpec
PathRenameExtension
PathSearchAndQualify
PathSetDlgItemPath
PathSkipRoot
PathStripPath
PathStripToRoot
PathUndecorate
PathUnExpandEnvStrings
PathUnmakeSystemFolder
PathUnquoteSpaces
SHSkipJunction
UrlApplyScheme
UrlCanonicalize
UrlCombine
UrlCompare
UrlCreateFromPath
UrlEscape
UrlEscapeSpaces
UrlFixupW
UrlGetLocation
UrlGetPart
UrlHash
UrlIs
UrlIsFileUrl
UrlIsNoHistory
UrlIsOpaque
UrlUnescape
UrlUnescapeInPlace
Registry Functions
=====================================
AssocCreate
AssocGetPerceivedType
AssocIsDangerous
AssocQueryKey
AssocQueryString
AssocQueryStringByKey
SHCopyKey
SHDeleteEmptyKey
SHDeleteKey
SHDeleteValue
SHEnumKeyEx
SHEnumValue
SHGetValue
SHOpenRegStream
SHOpenRegStream2
SHQueryInfoKey
SHQueryValueEx
SHRegCloseUSKey
SHRegCreateUSKey
SHRegDeleteEmptyUSKey
SHRegDeleteUSValue
SHRegDuplicateHKey
SHRegEnumUSKey
SHRegEnumUSValue
SHRegGetBoolUSValue
SHRegGetIntW
SHRegGetPath
SHRegGetUSValue
SHRegGetValue
SHRegOpenUSKey
SHRegQueryInfoUSKey
SHRegQueryUSValue
SHRegSetPath
SHRegSetUSValue
SHRegSetValue
SHRegWriteUSValue
SHSetValue
Color Palette Functions
=====================================
ColorAdjustLuma
ColorHLSToRGB
ColorRGBToHLS
SHCreateShellPalette
SHGetInverseCMAP
#include <Shlwapi.h>
#pragma comment(lib, "Shlwapi.lib")
#pragma comment(lib, "Shlwapi.lib")
不过,需要注意的是,有些字符串操作函数存在安全隐患,比如StrCpy,需要使用替代函数StringCchCopy,也可以自己写字符串拷贝函数,比如:
VOID StrCopy(PTSTR pszDest, int nMaxCount, PCTSTR pszSrc)
{
while (nMaxCount && (*pszSrc != '\0'))
{
*pszDest++ = *pszSrc++;
nMaxCount--;
}
if (nMaxCount == 0)
{
pszDest--;
}
*pszDest = '\0';
}
{
while (nMaxCount && (*pszSrc != '\0'))
{
*pszDest++ = *pszSrc++;
nMaxCount--;
}
if (nMaxCount == 0)
{
pszDest--;
}
*pszDest = '\0';
}
下面是Shlwapi.h中的所有函数列表,注意:在使用之前一定要查询最新的MSDN,以确定哪些函数有安全隐患,因而是不被推荐使用的。
String Function
=====================================
CharLowerWrapW
CharUpperBuffWrapW
ChrCmpI
CompareStringWrapW
GetAcceptLanguages
GetDateFormatWrapW
GetTimeFormatWrapW
IntlStrEqN
IntlStrEqNI
IntlStrEqWorker
IsCharAlphaNumericWrapW
IsCharSpace
OutputDebugStringWrapW
SHLoadIndirectString
SHStrDup
StrCat
StrCatBuff
StrCatChainW
StrChr
StrChrI
StrCmp
StrCmpC
StrCmpI
StrCmpIC
StrCmpLogicalW
StrCmpN
StrCmpNC
StrCmpNI
StrCmpNIC
StrCpy
StrCpyN
StrCSpn
StrCSpnI
StrDup
StrFormatByteSize64
StrFormatByteSizeA
StrFormatByteSizeW
StrFormatKBSize
StrFromTimeInterval
StrIsIntlEqual
StrNCat
StrPBrk
StrRChr
StrRChrI
StrRetToBSTR
StrRetToBuf
StrRetToStr
StrRetToStrN
StrRStrI
StrSpn
StrStr
StrStrI
StrToInt
StrToInt64Ex
StrToIntEx
StrTrim
wnsprintf
wvnsprintf
Path Functions
=====================================
PathAddBackslash
PathAddExtension
PathAppend
PathBuildRoot
PathCanonicalize
PathCombine
PathCommonPrefix
PathCompactPath
PathCompactPathEx
PathCreateFromUrl
PathCreateFromUrlAlloc
PathFileExists
PathFindExtension
PathFindFileName
PathFindNextComponent
PathFindOnPath
PathFindSuffixArray
PathGetArgs
PathGetCharType
PathGetDriveNumber
PathIsContentType
PathIsDirectory
PathIsDirectoryEmpty
PathIsFileSpec
PathIsHTMLFile
PathIsLFNFileSpec
PathIsNetworkPath
PathIsPrefix
PathIsRelative
PathIsRoot
PathIsSameRoot
PathIsSystemFolder
PathIsUNC
PathIsUNCServer
PathIsUNCServerShare
PathIsURL
PathMakePretty
PathMakeSystemFolder
PathMatchSpec
PathMatchSpecEx
PathParseIconLocation
PathQuoteSpaces
PathRelativePathTo
PathRemoveArgs
PathRemoveBackslash
PathRemoveBlanks
PathRemoveExtension
PathRemoveFileSpec
PathRenameExtension
PathSearchAndQualify
PathSetDlgItemPath
PathSkipRoot
PathStripPath
PathStripToRoot
PathUndecorate
PathUnExpandEnvStrings
PathUnmakeSystemFolder
PathUnquoteSpaces
SHSkipJunction
UrlApplyScheme
UrlCanonicalize
UrlCombine
UrlCompare
UrlCreateFromPath
UrlEscape
UrlEscapeSpaces
UrlFixupW
UrlGetLocation
UrlGetPart
UrlHash
UrlIs
UrlIsFileUrl
UrlIsNoHistory
UrlIsOpaque
UrlUnescape
UrlUnescapeInPlace
Registry Functions
=====================================
AssocCreate
AssocGetPerceivedType
AssocIsDangerous
AssocQueryKey
AssocQueryString
AssocQueryStringByKey
SHCopyKey
SHDeleteEmptyKey
SHDeleteKey
SHDeleteValue
SHEnumKeyEx
SHEnumValue
SHGetValue
SHOpenRegStream
SHOpenRegStream2
SHQueryInfoKey
SHQueryValueEx
SHRegCloseUSKey
SHRegCreateUSKey
SHRegDeleteEmptyUSKey
SHRegDeleteUSValue
SHRegDuplicateHKey
SHRegEnumUSKey
SHRegEnumUSValue
SHRegGetBoolUSValue
SHRegGetIntW
SHRegGetPath
SHRegGetUSValue
SHRegGetValue
SHRegOpenUSKey
SHRegQueryInfoUSKey
SHRegQueryUSValue
SHRegSetPath
SHRegSetUSValue
SHRegSetValue
SHRegWriteUSValue
SHSetValue
Color Palette Functions
=====================================
ColorAdjustLuma
ColorHLSToRGB
ColorRGBToHLS
SHCreateShellPalette
SHGetInverseCMAP
毛毛
2008/09/25 16:48
hello 你好,为什么我的Shlwapi.h文件中找不到Color Palette Functions中的函数,找了好久了,也不知道原因所在
qpsoft 回复于 2008/09/26 13:00
VS的版本不够?
分页: 1/1
1
1
缓冲区初始化的方法及效率对比
StrToInt不能替代_tstoi



