Einzelnen Beitrag anzeigen

Metal_Snake2

Registriert seit: 19. Nov 2004
134 Beiträge
 
Delphi 7 Personal
 
#15

Re: String Formatieren/Parsen

  Alt 8. Mär 2008, 19:43
Also ich verwende folgende Unit:

Delphi-Quellcode:
unit uPathUtils;

Interface

Uses
    Windows;

Const
    // Return flags for PathGetCharType
    GCT_INVALID = $0000;
    GCT_LFNCHAR = $0001;
    GCT_SHORTCHAR = $0002;
    GCT_WILD = $0004;
    GCT_SEPARATOR = $0008;

Function PathAddBackslash(lpszPath: PChar): PChar; stdcall;
Function PathAddBackslashA(lpszPath: PAnsiChar): PAnsiChar; stdcall;
Function PathAddBackslashW(lpszPath: PWideChar): PWideChar; stdcall;

Function PathAddExtension(lpszPath, lpszExtension: PChar): BOOL; stdcall;
Function PathAddExtensionA(lpszPath, lpszExtension: PAnsiChar): BOOL; stdcall;
Function PathAddExtensionW(lpszPath, lpszExtension: PWideChar): BOOL; stdcall;

Function PathAppend(pszPath, pszMore: PChar): BOOL; stdcall;
Function PathAppendA(pszPath, pszMore: PAnsiChar): BOOL; stdcall;
Function PathAppendW(pszPath, pszMore: PWideChar): BOOL; stdcall;

Function PathBuildRoot(pszRoot: PChar; iDrive: Integer): PChar; stdcall;
Function PathBuildRootA(pszRoot: PAnsiChar; iDrive: Integer): PAnsiChar; stdcall;
Function PathBuildRootW(pszRoot: PWideChar; iDrive: Integer): PWideChar; stdcall;

Function PathCanonicalize(lpszDest, lpszSrc: PChar): BOOL; stdcall;
Function PathCanonicalizeA(lpszDest, lpszSrc: PAnsiChar): BOOL; stdcall;
Function PathCanonicalizeW(lpszDest, lpszSrc: PWideChar): BOOL; stdcall;

Function PathCombine(lpszDest, lpszDir, lpszFile: PChar): PChar; stdcall;
Function PathCombineA(lpszDest, lpszDir, lpszFile: PAnsiChar): PAnsiChar; stdcall;
Function PathCombineW(lpszDest, lpszDir, lpszFile: PWideChar): PWideChar; stdcall;

Function PathCommonPrefix(pszFile1, pszFile2, achPath: PChar): Integer; stdcall;
Function PathCommonPrefixA(pszFile1, pszFile2, achPath: PAnsiChar): Integer; stdcall;
Function PathCommonPrefixW(pszFile1, pszFile2, achPath: PWideChar): Integer; stdcall;

Function PathCompactPath(DC: HDC; pszPath: PChar; dx: UINT): BOOL; stdcall;
Function PathCompactPathA(DC: HDC; pszPath: PAnsiChar; dx: UINT): BOOL; stdcall;
Function PathCompactPathW(DC: HDC; pszPath: PWideChar; dx: UINT): BOOL; stdcall;

Function PathCompactPathEx(pszOut, pszSrc: PChar; cchMax: UINT; dwFlags: DWORD): BOOL; stdcall;
Function PathCompactPathExA(pszOut, pszSrc: PAnsiChar; cchMax: UINT; dwFlags: DWORD): BOOL; stdcall;
Function PathCompactPathExW(pszOut, pszSrc: PWideChar; cchMax: UINT; dwFlags: DWORD): BOOL; stdcall;

Function PathFileExists(pszPath: PChar): BOOL; stdcall;
Function PathFileExistsA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathFileExistsW(pszPath: PWideChar): BOOL; stdcall;

Function PathFindExtension(pszPath: PChar): PChar; stdcall;
Function PathFindExtensionA(pszPath: PAnsiChar): PAnsiChar; stdcall;
Function PathFindExtensionW(pszPath: PWideChar): PWideChar; stdcall;

Function PathFindFileName(pszPath: PChar): PChar; stdcall;
Function PathFindFileNameA(pszPath: PAnsiChar): PAnsiChar; stdcall;
Function PathFindFileNameW(pszPath: PWideChar): PWideChar; stdcall;

Function PathFindNextComponent(pszPath: PChar): PChar; stdcall;
Function PathFindNextComponentA(pszPath: PAnsiChar): PAnsiChar; stdcall;
Function PathFindNextComponentW(pszPath: PWideChar): PWideChar; stdcall;

Function PathFindOnPath(pszPath, ppszOtherDirs: PChar): BOOL; stdcall;
Function PathFindOnPathA(pszPath, ppszOtherDirs: PAnsiChar): BOOL; stdcall;
Function PathFindOnPathW(pszPath, ppszOtherDirs: PWideChar): BOOL; stdcall;

Function PathFindSuffixArray(pszPath: PChar; Const apszSuffix: PChar; iArraySize: Integer): PChar; stdcall;
Function PathFindSuffixArrayA(pszPath: PAnsiChar; Const apszSuffix: PAnsiChar; iArraySize: Integer): PAnsiChar; stdcall;
Function PathFindSuffixArrayW(pszPath: PWideChar; Const apszSuffix: PWideChar; iArraySize: Integer): PWideChar; stdcall;

Function PathGetArgs(pszPath: PChar): PChar; stdcall;
Function PathGetArgsA(pszPath: PAnsiChar): PAnsiChar; stdcall;
Function PathGetArgsW(pszPath: PWideChar): PWideChar; stdcall;

Function PathGetCharType(Ch: UCHAR): UINT; stdcall;
Function PathGetCharTypeA(Ch: UCHAR): UINT; stdcall;
Function PathGetCharTypeW(Ch: UCHAR): UINT; stdcall;

Function PathGetDriveNumber(pszPath: PChar): Integer; stdcall;
Function PathGetDriveNumberA(pszPath: PAnsiChar): Integer; stdcall;
Function PathGetDriveNumberW(pszPath: PWideChar): Integer; stdcall;

Function PathIsContentType(pszPath, pszContentType: PChar): BOOL; stdcall;
Function PathIsContentTypeA(pszPath, pszContentType: PAnsiChar): BOOL; stdcall;
Function PathIsContentTypeW(pszPath, pszContentType: PWideChar): BOOL; stdcall;

Function PathIsDirectory(pszPath: PChar): BOOL; stdcall;
Function PathIsDirectoryA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsDirectoryW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsDirectoryEmpty(pszPath: PChar): BOOL; stdcall;
Function PathIsDirectoryEmptyA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsDirectoryEmptyW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsFileSpec(pszPath: PChar): BOOL; stdcall;
Function PathIsFileSpecA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsFileSpecW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsLFNFileSpec(lpName: PChar): BOOL; stdcall;
Function PathIsLFNFileSpecA(lpName: PAnsiChar): BOOL; stdcall;
Function PathIsLFNFileSpecW(lpName: PWideChar): BOOL; stdcall;

Function PathIsNetworkPath(pszPath: PChar): BOOL; stdcall;
Function PathIsNetworkPathA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsNetworkPathW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsPrefix(pszPrefix, pszPath: PChar): BOOL; stdcall;
Function PathIsPrefixA(pszPrefix, pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsPrefixW(pszPrefix, pszPath: PWideChar): BOOL; stdcall;

Function PathIsRelative(pszPath: PChar): BOOL; stdcall;
Function PathIsRelativeA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsRelativeW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsRoot(pszPath: PChar): BOOL; stdcall;
Function PathIsRootA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsRootW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsSameRoot(pszPath1, pszPath2: PChar): BOOL; stdcall;
Function PathIsSameRootA(pszPath1, pszPath2: PAnsiChar): BOOL; stdcall;
Function PathIsSameRootW(pszPath1, pszPath2: PWideChar): BOOL; stdcall;

Function PathIsSystemFolder(pszPath: PChar; dwAttrb: DWORD): BOOL; stdcall;
Function PathIsSystemFolderA(pszPath: PAnsiChar; dwAttrb: DWORD): BOOL; stdcall;
Function PathIsSystemFolderW(pszPath: PWideChar; dwAttrb: DWORD): BOOL; stdcall;

Function PathIsUNC(pszPath: PChar): BOOL; stdcall;
Function PathIsUNCA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsUNCW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsUNCServer(pszPath: PChar): BOOL; stdcall;
Function PathIsUNCServerA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsUNCServerW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsUNCServerShare(pszPath: PChar): BOOL; stdcall;
Function PathIsUNCServerShareA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsUNCServerShareW(pszPath: PWideChar): BOOL; stdcall;

Function PathIsURL(pszPath: PChar): BOOL; stdcall;
Function PathIsURLA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathIsURLW(pszPath: PWideChar): BOOL; stdcall;

Function PathMakePretty(pszPath: PChar): BOOL; stdcall;
Function PathMakePrettyA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathMakePrettyW(pszPath: PWideChar): BOOL; stdcall;

Function PathMakeSystemFolder(pszPath: PChar): BOOL; stdcall;
Function PathMakeSystemFolderA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathMakeSystemFolderW(pszPath: PWideChar): BOOL; stdcall;

Function PathMatchSpec(pszFile, pszSpec: PChar): BOOL; stdcall;
Function PathMatchSpecA(pszFile, pszSpec: PAnsiChar): BOOL; stdcall;
Function PathMatchSpecW(pszFile, pszSpec: PWideChar): BOOL; stdcall;

Function PathParseIconLocation(pszIconFile: PChar): Integer; stdcall;
Function PathParseIconLocationA(pszIconFile: PAnsiChar): Integer; stdcall;
Function PathParseIconLocationW(pszIconFile: PWideChar): Integer; stdcall;

Function PathRelativePathTo(pszPath, pszFrom: PChar; dwAttrFrom: DWORD; pszTo: PChar; dwAttrTo: DWORD): BOOL; stdcall;
Function PathRelativePathToA(pszPath, pszFrom: PAnsiChar; dwAttrFrom: DWORD; pszTo: PAnsiChar; dwAttrTo: DWORD): BOOL; stdcall;
Function PathRelativePathToW(pszPath, pszFrom: PWideChar; dwAttrFrom: DWORD; pszTo: PWideChar; dwAttrTo: DWORD): BOOL; stdcall;

Function PathRemoveBackslash(pszPath: PChar): PChar; stdcall;
Function PathRemoveBackslashA(pszPath: PAnsiChar): PAnsiChar; stdcall;
Function PathRemoveBackslashW(pszPath: PWideChar): PWideChar; stdcall;

Function PathRemoveFileSpec(pszPath: PChar): BOOL; stdcall;
Function PathRemoveFileSpecA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathRemoveFileSpecW(pszPath: PWideChar): BOOL; stdcall;

Function PathRenameExtension(pszPath, pszExt: PChar): BOOL; stdcall;
Function PathRenameExtensionA(pszPath, pszExt: PAnsiChar): BOOL; stdcall;
Function PathRenameExtensionW(pszPath, pszExt: PWideChar): BOOL; stdcall;

Function PathSearchAndQualify(pszPath, pszBuf: PChar; cchBuf: UINT): BOOL; stdcall;
Function PathSearchAndQualifyA(pszPath, pszBuf: PAnsiChar; cchBuf: UINT): BOOL; stdcall;
Function PathSearchAndQualifyW(pszPath, pszBuf: PWideChar; cchBuf: UINT): BOOL; stdcall;

Function PathSkipRoot(pszPath: PChar): PChar; stdcall;
Function PathSkipRootA(pszPath: PAnsiChar): PAnsiChar; stdcall;
Function PathSkipRootW(pszPath: PWideChar): PWideChar; stdcall;

Function PathStripToRoot(pszPath: PChar): BOOL; stdcall;
Function PathStripToRootA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathStripToRootW(pszPath: PWideChar): BOOL; stdcall;

Function PathUnExpandEnvStrings(pszPath, pszBuf: PChar; cchBuf: UINT): BOOL; stdcall;
Function PathUnExpandEnvStringsA(pszPath, pszBuf: PAnsiChar; cchBuf: UINT): BOOL; stdcall;
Function PathUnExpandEnvStringsW(pszPath, pszBuf: PWideChar; cchBuf: UINT): BOOL; stdcall;

Function PathUnmakeSystemFolder(pszPath: PChar): BOOL; stdcall;
Function PathUnmakeSystemFolderA(pszPath: PAnsiChar): BOOL; stdcall;
Function PathUnmakeSystemFolderW(pszPath: PWideChar): BOOL; stdcall;

Procedure PathQuoteSpaces(pszPath: PChar); stdcall;
Procedure PathQuoteSpacesA(pszPath: PAnsiChar); stdcall;
Procedure PathQuoteSpacesW(pszPath: PWideChar); stdcall;

Procedure PathRemoveArgs(pszPath: PChar); stdcall;
Procedure PathRemoveArgsA(pszPath: PAnsiChar); stdcall;
Procedure PathRemoveArgsW(pszPath: PWideChar); stdcall;

Procedure PathRemoveBlanks(pszPath: PChar); stdcall;
Procedure PathRemoveBlanksA(pszPath: PAnsiChar); stdcall;
Procedure PathRemoveBlanksW(pszPath: PWideChar); stdcall;

Procedure PathRemoveExtension(pszPath: PChar); stdcall;
Procedure PathRemoveExtensionA(pszPath: PAnsiChar); stdcall;
Procedure PathRemoveExtensionW(pszPath: PWideChar); stdcall;

Procedure PathSetDlgItemPath(Dlg: HWND; ID: Integer; pszPath: PChar); stdcall;
Procedure PathSetDlgItemPathA(Dlg: HWND; ID: Integer; pszPath: PAnsiChar); stdcall;
Procedure PathSetDlgItemPathW(Dlg: HWND; ID: Integer; pszPath: PWideChar); stdcall;

Procedure PathStripPath(pszPath: PChar); stdcall;
Procedure PathStripPathA(pszPath: PAnsiChar); stdcall;
Procedure PathStripPathW(pszPath: PWideChar); stdcall;

Procedure PathUndecorate(pszPath: PChar); stdcall;
Procedure PathUndecorateA(pszPath: PAnsiChar); stdcall;
Procedure PathUndecorateW(pszPath: PWideChar); stdcall;

Procedure PathUnquoteSpaces(pszPath: PChar); stdcall;
Procedure PathUnquoteSpacesA(pszPath: PAnsiChar); stdcall;
Procedure PathUnquoteSpacesW(pszPath: PWideChar); stdcall;

Implementation

//
// Shell helpers
//
Const
    shlwapi = 'shlwapi.dll';

Function PathAddBackslash; External shlwapi Name 'PathAddBackslashA';
Function PathAddBackslashA; External shlwapi Name 'PathAddBackslashA';
Function PathAddBackslashW; External shlwapi Name 'PathAddBackslashW';

Function PathAddExtension; External shlwapi Name 'PathAddExtensionA';
Function PathAddExtensionA; External shlwapi Name 'PathAddExtensionA';
Function PathAddExtensionW; External shlwapi Name 'PathAddExtensionW';

Function PathAppend; External shlwapi Name 'PathAppendA';
Function PathAppendA; External shlwapi Name 'PathAppendA';
Function PathAppendW; External shlwapi Name 'PathAppendW';

Function PathBuildRoot; External shlwapi Name 'PathBuildRootA';
Function PathBuildRootA; External shlwapi Name 'PathBuildRootA';
Function PathBuildRootW; External shlwapi Name 'PathBuildRootW';

Function PathCanonicalize; External shlwapi Name 'PathCanonicalizeA';
Function PathCanonicalizeA; External shlwapi Name 'PathCanonicalizeA';
Function PathCanonicalizeW; External shlwapi Name 'PathCanonicalizeW';

Function PathCombine; External shlwapi Name 'PathCombineA';
Function PathCombineA; External shlwapi Name 'PathCombineA';
Function PathCombineW; External shlwapi Name 'PathCombineW';

Function PathCommonPrefix; External shlwapi Name 'PathCommonPrefixA';
Function PathCommonPrefixA; External shlwapi Name 'PathCommonPrefixA';
Function PathCommonPrefixW; External shlwapi Name 'PathCommonPrefixW';

Function PathCompactPath; External shlwapi Name 'PathCompactPathA';
Function PathCompactPathA; External shlwapi Name 'PathCompactPathA';
Function PathCompactPathW; External shlwapi Name 'PathCompactPathW';

Function PathCompactPathEx; External shlwapi Name 'PathCompactPathExA';
Function PathCompactPathExA; External shlwapi Name 'PathCompactPathExA';
Function PathCompactPathExW; External shlwapi Name 'PathCompactPathExW';

Function PathFileExists; External shlwapi Name 'PathFileExistsA';
Function PathFileExistsA; External shlwapi Name 'PathFileExistsA';
Function PathFileExistsW; External shlwapi Name 'PathFileExistsW';

Function PathFindExtension; External shlwapi Name 'PathFindExtensionA';
Function PathFindExtensionA; External shlwapi Name 'PathFindExtensionA';
Function PathFindExtensionW; External shlwapi Name 'PathFindExtensionW';

Function PathFindFileName; External shlwapi Name 'PathFindFileNameA';
Function PathFindFileNameA; External shlwapi Name 'PathFindFileNameA';
Function PathFindFileNameW; External shlwapi Name 'PathFindFileNameW';

Function PathFindNextComponent; External shlwapi Name 'PathFindNextComponentA';
Function PathFindNextComponentA; External shlwapi Name 'PathFindNextComponentA';
Function PathFindNextComponentW; External shlwapi Name 'PathFindNextComponentW';

Function PathFindOnPath; External shlwapi Name 'PathFindOnPathA';
Function PathFindOnPathA; External shlwapi Name 'PathFindOnPathA';
Function PathFindOnPathW; External shlwapi Name 'PathFindOnPathW';

Function PathFindSuffixArray; External shlwapi Name 'PathFindSuffixArrayA';
Function PathFindSuffixArrayA; External shlwapi Name 'PathFindSuffixArrayA';
Function PathFindSuffixArrayW; External shlwapi Name 'PathFindSuffixArrayW';

Function PathGetArgs; External shlwapi Name 'PathGetArgsA';
Function PathGetArgsA; External shlwapi Name 'PathGetArgsA';
Function PathGetArgsW; External shlwapi Name 'PathGetArgsW';

Function PathGetCharType; External shlwapi Name 'PathGetCharTypeA';
Function PathGetCharTypeA; External shlwapi Name 'PathGetCharTypeA';
Function PathGetCharTypeW; External shlwapi Name 'PathGetCharTypeW';

Function PathGetDriveNumber; External shlwapi Name 'PathGetDriveNumberA';
Function PathGetDriveNumberA; External shlwapi Name 'PathGetDriveNumberA';
Function PathGetDriveNumberW; External shlwapi Name 'PathGetDriveNumberW';

Function PathIsContentType; External shlwapi Name 'PathIsContentTypeA';
Function PathIsContentTypeA; External shlwapi Name 'PathIsContentTypeA';
Function PathIsContentTypeW; External shlwapi Name 'PathIsContentTypeW';

Function PathIsDirectory; External shlwapi Name 'PathIsDirectoryA';
Function PathIsDirectoryA; External shlwapi Name 'PathIsDirectoryA';
Function PathIsDirectoryW; External shlwapi Name 'PathIsDirectoryW';

Function PathIsDirectoryEmpty; External shlwapi Name 'PathIsDirectoryEmptyA';
Function PathIsDirectoryEmptyA; External shlwapi Name 'PathIsDirectoryEmptyA';
Function PathIsDirectoryEmptyW; External shlwapi Name 'PathIsDirectoryEmptyW';

Function PathIsFileSpec; External shlwapi Name 'PathIsFileSpecA';
Function PathIsFileSpecA; External shlwapi Name 'PathIsFileSpecA';
Function PathIsFileSpecW; External shlwapi Name 'PathIsFileSpecW';

Function PathIsLFNFileSpec; External shlwapi Name 'PathIsLFNFileSpecA';
Function PathIsLFNFileSpecA; External shlwapi Name 'PathIsLFNFileSpecA';
Function PathIsLFNFileSpecW; External shlwapi Name 'PathIsLFNFileSpecW';

Function PathIsNetworkPath; External shlwapi Name 'PathIsNetworkPathA';
Function PathIsNetworkPathA; External shlwapi Name 'PathIsNetworkPathA';
Function PathIsNetworkPathW; External shlwapi Name 'PathIsNetworkPathW';

Function PathIsPrefix; External shlwapi Name 'PathIsPrefixA';
Function PathIsPrefixA; External shlwapi Name 'PathIsPrefixA';
Function PathIsPrefixW; External shlwapi Name 'PathIsPrefixW';

Function PathIsRelative; External shlwapi Name 'PathIsRelativeA';
Function PathIsRelativeA; External shlwapi Name 'PathIsRelativeA';
Function PathIsRelativeW; External shlwapi Name 'PathIsRelativeW';

Function PathIsRoot; External shlwapi Name 'PathIsRootA';
Function PathIsRootA; External shlwapi Name 'PathIsRootA';
Function PathIsRootW; External shlwapi Name 'PathIsRootW';

Function PathIsSameRoot; External shlwapi Name 'PathIsSameRootA';
Function PathIsSameRootA; External shlwapi Name 'PathIsSameRootA';
Function PathIsSameRootW; External shlwapi Name 'PathIsSameRootW';

Function PathIsSystemFolder; External shlwapi Name 'PathIsSystemFolderA';
Function PathIsSystemFolderA; External shlwapi Name 'PathIsSystemFolderA';
Function PathIsSystemFolderW; External shlwapi Name 'PathIsSystemFolderW';

Function PathIsUNC; External shlwapi Name 'PathIsUNCA';
Function PathIsUNCA; External shlwapi Name 'PathIsUNCA';
Function PathIsUNCW; External shlwapi Name 'PathIsUNCW';

Function PathIsUNCServer; External shlwapi Name 'PathIsUNCServerA';
Function PathIsUNCServerA; External shlwapi Name 'PathIsUNCServerA';
Function PathIsUNCServerW; External shlwapi Name 'PathIsUNCServerW';

Function PathIsUNCServerShare; External shlwapi Name 'PathIsUNCServerShareA';
Function PathIsUNCServerShareA; External shlwapi Name 'PathIsUNCServerShareA';
Function PathIsUNCServerShareW; External shlwapi Name 'PathIsUNCServerShareW';

Function PathIsURL; External shlwapi Name 'PathIsURLA';
Function PathIsURLA; External shlwapi Name 'PathIsURLA';
Function PathIsURLW; External shlwapi Name 'PathIsURLW';

Function PathMakePretty; External shlwapi Name 'PathMakePrettyA';
Function PathMakePrettyA; External shlwapi Name 'PathMakePrettyA';
Function PathMakePrettyW; External shlwapi Name 'PathMakePrettyW';

Function PathMakeSystemFolder; External shlwapi Name 'PathMakeSystemFolderA';
Function PathMakeSystemFolderA; External shlwapi Name 'PathMakeSystemFolderA';
Function PathMakeSystemFolderW; External shlwapi Name 'PathMakeSystemFolderW';

Function PathMatchSpec; External shlwapi Name 'PathMatchSpecA';
Function PathMatchSpecA; External shlwapi Name 'PathMatchSpecA';
Function PathMatchSpecW; External shlwapi Name 'PathMatchSpecW';

Function PathParseIconLocation; External shlwapi Name 'PathParseIconLocationA';
Function PathParseIconLocationA; External shlwapi Name 'PathParseIconLocationA';
Function PathParseIconLocationW; External shlwapi Name 'PathParseIconLocationW';

Function PathRelativePathTo; External shlwapi Name 'PathRelativePathToA';
Function PathRelativePathToA; External shlwapi Name 'PathRelativePathToA';
Function PathRelativePathToW; External shlwapi Name 'PathRelativePathToW';

Function PathRemoveBackslash; External shlwapi Name 'PathRemoveBackslashA';
Function PathRemoveBackslashA; External shlwapi Name 'PathRemoveBackslashA';
Function PathRemoveBackslashW; External shlwapi Name 'PathRemoveBackslashW';

Function PathRemoveFileSpec; External shlwapi Name 'PathRemoveFileSpecA';
Function PathRemoveFileSpecA; External shlwapi Name 'PathRemoveFileSpecA';
Function PathRemoveFileSpecW; External shlwapi Name 'PathRemoveFileSpecW';

Function PathRenameExtension; External shlwapi Name 'PathRenameExtensionA';
Function PathRenameExtensionA; External shlwapi Name 'PathRenameExtensionA';
Function PathRenameExtensionW; External shlwapi Name 'PathRenameExtensionW';

Function PathSearchAndQualify; External shlwapi Name 'PathSearchAndQualifyA';
Function PathSearchAndQualifyA; External shlwapi Name 'PathSearchAndQualifyA';
Function PathSearchAndQualifyW; External shlwapi Name 'PathSearchAndQualifyW';

Function PathSkipRoot; External shlwapi Name 'PathSkipRootA';
Function PathSkipRootA; External shlwapi Name 'PathSkipRootA';
Function PathSkipRootW; External shlwapi Name 'PathSkipRootW';

Function PathStripToRoot; External shlwapi Name 'PathStripToRootA';
Function PathStripToRootA; External shlwapi Name 'PathStripToRootA';
Function PathStripToRootW; External shlwapi Name 'PathStripToRootW';

Function PathUnExpandEnvStrings; External shlwapi Name 'PathUnExpandEnvStringsA';
Function PathUnExpandEnvStringsA; External shlwapi Name 'PathUnExpandEnvStringsA';
Function PathUnExpandEnvStringsW; External shlwapi Name 'PathUnExpandEnvStringsW';

Function PathUnmakeSystemFolder; External shlwapi Name 'PathUnmakeSystemFolderA';
Function PathUnmakeSystemFolderA; External shlwapi Name 'PathUnmakeSystemFolderA';
Function PathUnmakeSystemFolderW; External shlwapi Name 'PathUnmakeSystemFolderW';

Procedure PathQuoteSpaces; External shlwapi Name 'PathQuoteSpacesA';
Procedure PathQuoteSpacesA; External shlwapi Name 'PathQuoteSpacesA';
Procedure PathQuoteSpacesW; External shlwapi Name 'PathQuoteSpacesW';

Procedure PathRemoveArgs; External shlwapi Name 'PathRemoveArgsA';
Procedure PathRemoveArgsA; External shlwapi Name 'PathRemoveArgsA';
Procedure PathRemoveArgsW; External shlwapi Name 'PathRemoveArgsW';

Procedure PathRemoveBlanks; External shlwapi Name 'PathRemoveBlanksA';
Procedure PathRemoveBlanksA; External shlwapi Name 'PathRemoveBlanksA';
Procedure PathRemoveBlanksW; External shlwapi Name 'PathRemoveBlanksW';

Procedure PathRemoveExtension; External shlwapi Name 'PathRemoveExtensionA';
Procedure PathRemoveExtensionA; External shlwapi Name 'PathRemoveExtensionA';
Procedure PathRemoveExtensionW; External shlwapi Name 'PathRemoveExtensionW';

Procedure PathSetDlgItemPath; External shlwapi Name 'PathSetDlgItemPathA';
Procedure PathSetDlgItemPathA; External shlwapi Name 'PathSetDlgItemPathA';
Procedure PathSetDlgItemPathW; External shlwapi Name 'PathSetDlgItemPathW';

Procedure PathStripPath; External shlwapi Name 'PathStripPathA';
Procedure PathStripPathA; External shlwapi Name 'PathStripPathA';
Procedure PathStripPathW; External shlwapi Name 'PathStripPathW';

Procedure PathUndecorate; External shlwapi Name 'PathUndecorateA';
Procedure PathUndecorateA; External shlwapi Name 'PathUndecorateA';
Procedure PathUndecorateW; External shlwapi Name 'PathUndecorateW';

Procedure PathUnquoteSpaces; External shlwapi Name 'PathUnquoteSpacesA';
Procedure PathUnquoteSpacesA; External shlwapi Name 'PathUnquoteSpacesA';
Procedure PathUnquoteSpacesW; External shlwapi Name 'PathUnquoteSpacesW';

End.

Die scheint ja schonmal gültig zu sein.

Meine SHLWAPI.dll im System32 Ordner hat die version 6.0.2900.3199 und ist 464 KB groß.

Wenn ich jetzt folgendes Testprojekt ausführen möchte bekomme ich jedesmal ne AV:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses
  uPathUtils;


procedure TForm1.Button2Click(Sender: TObject);
var
  test : string;
  index: integer;
begin
  test := 'C:\Programme\madCollection\madUninstall.exe,12'; //<- hier die AV

  index := PathParseIconLocation(pchar(test));
  ShowMessage(IntToStr(index));
end;

end.

Kann mir bitte einer erklären woran das liegen kann? Ist meine dll beschädigt? hmm das ist mir bis jetzt so noch nie passiert.

@marabu: danke für den Code! Nur leider kann ich "PathFindOnPath" ja leider nicht verwenden.

Noch viel komischer ist folgendes:

wenn ich folgenden aufruf mache hab ich wieder ne AV:

Delphi-Quellcode:
  test := 'C:\Programme\madCollection\madUninstall.exe, 12';//hier ne AV

  PathRemoveArgs(pchar(test));
Jedoch so bekomme ich als rückgabe "C:\Programme\madCollection\madUninstall.exe,1 2", jedoch sollte ich ja "C:\Programme\madCollection\madUninstall.exe" ehalten:

Delphi-Quellcode:
  test := 'C:\Programme\madCollection\madUninstall.exe,12';// Keine AV (Ohne dem leerzeichen)

  PathRemoveArgs(pchar(test));
  Mit Zitat antworten Zitat