フォントファイルの絶対PIDLという名前を取得します FontPIDL
このコードを使用して開きます:var ShExeInfo:SHELLEXECUTEINFO;
begin
ZeroMemory(@ShExeInfo, SizeOf(ShExeInfo));
ShExeInfo.cbSize := SizeOf(ShExeInfo);
ShExeInfo.lpVerb := 'Open';
ShExeInfo.lpIDList := FontPIDL;
ShExeInfo.nShow := SW_SHOWNORMAL;
ShExeInfo.fMask := SEE_MASK_IDLIST;
end;
エラーが発生します:The parameter is incorrect
どうやって直せばいいの?私が見逃しているパラメータはありますか?
アップデート :
フォントファイルの絶対PIDLを取得する方法:
var
psfDeskTop : IShellFolder;
psfFont : IShellFolder;
pEnumList : IEnumIdList;
pidFont : PItemIdList;
pidChild : PItemIdList;
pidAbFont : PItemIdList;
FontPath : array[0..MAX_PATH - 1] of Char;
pchEaten, dwAttributes, ItemsFetched : ULONG;
begin
FillChar(FontPath, sizeof(FontPath), #0);
SHGetSpecialFolderPath(0, FontPath, CSIDL_FONTS, False);
SHGetDesktopFolder(psfDeskTop);
psfDeskTop.ParseDisplayName(0, nil, FontPath, pchEaten, pidFont,
dwAttributes);
psfDeskTop.BindToObject(pidFont, nil, IID_IShellFolder, psfFont);
psfFont.EnumObjects(0, SHCONTF_FOLDERS or SHCONTF_NONFOLDERS or
SHCONTF_INCLUDEHIDDEN, pEnumList);
ItemsFetched := 0;
while pEnumList.Next(1, pidChild, ItemsFetched) = NO_ERROR do
begin
pidAbFont := ILCombine(pidFont , pidChild);
///... do something
end;
end;