VC中的常用函数

1.文件路径

>

void _splitpath(

   const char *path,

   char *drive,

   char *dir,

   char *fname,

   char *ext

);

不需要获取的,直接传NULL(如只获取文件扩展名-_splitpath(文件名,NULL,NULL,NULL,szExtName));

>    PathFindExtension

    LPTSTR pszExtension;
    char strFileName[] = "test.htm";
    pszExtension = PathFindExtension(strFileName);

 

>

TCHAR szPath1[] = TEXT("c:\\dir1\\file.txt");

PathStripPath(szPath1);

// Result: szPath1 == file.txt

 

>

Shell Path Handling Functions

This section describes the Windows Shell path handling functions. The programming elements explained in this documentation are exported by Shlwapi.dll and defined in Shlwapi.h and Shlwapi.lib.

TopicContents
PathAddBackslash

Adds a backslash to the end of a string to create the correct syntax for a path. If the source path already has a trailing backslash, no backslash will be added.

PathAddExtension

Adds a file extension to a path string.

PathAppend

Appends one path to the end of another.

PathBuildRoot

Creates a root path from a given drive number.

PathCanonicalize

Removes elements of a file path according to special strings inserted into that path.

PathCombine

Concatenates two strings that represent properly formed paths into one path; also concatenates any relative path elements.

PathCommonPrefix

Compares two paths to determine if they share a common prefix. A prefix is one of these types: "C:\\", ".", "..", "..\\".

PathCompactPath

Truncates a file path to fit within a given pixel width by replacing path components with ellipses.

PathCompactPathEx

Truncates a path to fit within a certain number of characters by replacing path components with ellipses.

PathCreateFromUrl

Converts a file URL to a Microsoft MS-DOS path.

PathCreateFromUrlAlloc

Creates a path from a file URL.

PathFileExists

Determines whether a path to a file system object such as a file or directory is valid.

PathFindExtension

Searches a path for an extension.

PathFindFileName

Searches a path for a file name.

PathFindNextComponent

Parses a path and returns the portion of that path that follows the first backslash.

PathFindOnPath

Searches for a file.

PathFindSuffixArray

Determines whether a given file name has one of a list of suffixes.

PathGetArgs

Finds the command line arguments within a given path.

PathGetCharType

Determines the type of character in relation to a path.

PathGetDriveNumber

Searches a path for a drive letter within the range of 'A' to 'Z' and returns the corresponding drive number.

PathIsContentType

Determines if a file's registered content type matches the specified content type. This function obtains the content type for the specified file type and compares that string with the pszContentType. The comparison is not case-sensitive.

PathIsDirectory

Verifies that a path is a valid directory.

PathIsDirectoryEmpty

Determines whether a specified path is an empty directory.

PathIsFileSpec

Searches a path for any path-delimiting characters (for example, ':' or '\' ). If there are no path-delimiting characters present, the path is considered to be a File Spec path.

PathIsHTMLFile

Determines if a file is an HTML file. The determination is made based on the content type that is registered for the file's extension.

PathIsLFNFileSpec

Determines whether a file name is in long format.

PathIsNetworkPath

Determines whether a path string represents a network resource.

PathIsPrefix

Searches a path to determine if it contains a valid prefix of the type passed by pszPrefix. A prefix is one of these types: "C:\\", ".", "..", "..\\".

PathIsRelative

Searches a path and determines if it is relative.

PathIsRoot

Parses a path to determine if it is a directory root.

PathIsSameRoot

Compares two paths to determine if they have a common root component.

PathIsSystemFolder

Determines if an existing folder contains the attributes that make it a system folder. Alternately, this function indicates if certain attributes qualify a folder to be a system folder.

PathIsUNC

Determines if the string is a valid Universal Naming Convention (UNC) for a server and share path.

PathIsUNCServer

Determines if a string is a valid UNC for a server path only.

PathIsUNCServerShare

Determines if a string is a valid UNC share path, \\ server\ share.

PathIsURL

Tests a given string to determine if it conforms to a valid URL format.

PathMakePretty

Converts a path to all lowercase characters to give the path a consistent appearance.

PathMakeSystemFolder

Gives an existing folder the proper attributes to become a system folder.

PathMatchSpec

Searches a string using a MS-DOS wild card match type.

PathMatchSpecEx

Searches a string using a MS-DOS wild card match type and a flag.

PathParseIconLocation

Parses a file location string that contains a file location and icon index, and returns separate values.

PathQuoteSpaces

Searches a path for spaces. If spaces are found, the entire path is enclosed in quotation marks.

PathRelativePathTo

Creates a relative path from one file or folder to another.

PathRemoveArgs

Removes any arguments from a given path.

PathRemoveBackslash

Removes the trailing backslash from a given path.

PathRemoveBlanks

Removes all leading and trailing spaces from a string.

PathRemoveExtension

Removes the file extension from a path, if one is present.

PathRemoveFileSpec

Removes the trailing file name and backslash from a path, if they are present.

PathRenameExtension

Replaces the extension of a file name with a new extension. If the file name does not contain an extension, the extension will be attached to the end of the string.

PathSearchAndQualify

Determines if a given path is correctly formatted and fully qualified.

PathSetDlgItemPath

Sets the text of a child control in a window or dialog box, using PathCompactPath to ensure the path fits in the control.

PathSkipRoot

Parses a path, ignoring the drive letter or UNC server/share path elements.

PathStripPath

Removes the path portion of a fully qualified path and file.

PathStripToRoot

Removes all parts of the path except for the root information.

PathUndecorate

Removes the decoration from a path string.

PathUnExpandEnvStrings

Replaces folder names in a fully-qualified path with their associated environment string.

PathUnmakeSystemFolder

Removes the attributes from a folder that make it a system folder. This folder must actually exist in the file system.

PathUnquoteSpaces

Removes quotes from the beginning and end of a path.

SHSkipJunction

Checks a bind context to see if it is safe to bind to a particular component object.

UrlApplyScheme

Determines a scheme for a specified URL string, and returns a string with an appropriate prefix.

UrlCanonicalize

Converts a URL string into canonical form.

UrlCombine

When provided with a relative URL and its base, returns a URL in canonical form.

UrlCompare

Makes a case-sensitive comparison of two URL strings.

UrlCreateFromPath

Converts a MS-DOS path to a canonicalized URL.

UrlEscape

Converts characters in a URL that might be altered during transport across the Internet ("unsafe" characters) into their corresponding escape sequences.

UrlEscapeSpaces

A macro that converts space characters into their corresponding escape sequence.

UrlFixupW

Attempts to correct a URL whose protocol identifier is incorrect. For example, htttp will be changed to http. Priority is given to the first character in the protocol identifier section so htp will be converted to http instead of ftp.

UrlGetLocation

Retrieves the location from a URL.

UrlGetPart

Accepts a URL string and returns a specified part of that URL.

UrlHash

Hashes a URL string.

UrlIs

Tests whether or not a URL is a specified type.

UrlIsFileUrl

Tests a URL to determine if it is a file URL.

UrlIsNoHistory

Returns whether a URL is a No History URL.

UrlIsOpaque

Returns whether a URL is opaque.

UrlUnescape

Converts escape sequences back into ordinary characters.

UrlUnescapeInPlace

Converts escape sequences back into ordinary characters and overwrites the original string.

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值