掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
WEBフォルダのリンク先を取得するには? (ID:9054)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
長らく放置してしまいまして申し訳ありません。 結局さっぱり分からなくて以下のようにして無理やり取得しています。 もっと良いやり方があれば教えてください。 procedure TForm1.Button1Click(Sender: TObject); var BrowseInfo: TBrowseInfo; FolderName, FolderPath: array[0..MAX_PATH] of Char; pidl: PItemIDList; lpMalloc: IMalloc; begin if FAILED(SHGetMalloc(lpMalloc)) then Exit; with BrowseInfo do begin hwndOwner := Handle; pidlRoot := PItemIDList(CSIDL_NETWORK); pszDisplayName := FolderName; lpszTitle := 'WebDavを選択してください'; ulFlags := BIF_RETURNONLYFSDIRS; lpfn := nil; end; pidl := SHBrowseForFolder(BrowseInfo); if pidl = nil then exit; SHGetPathFromIDList(pidl, FolderPath); lpMalloc.Free(pidl); Edit1.Text := ReadURLString(FolderPath); end; function TForm1.ReadURLString(Path: String): String; var fs: TFileStream; wS: WideString; i: Integer; begin Result := ''; Path := Path + '\target.lnk'; if not FileExists(Path) then Exit; fs := TFileStream.Create(Path, fmOpenRead) try fs.Position := 0; i := fs.Size; wS := ''; SetLength(wS, i div 2); fs.ReadBuffer(wS[1], i); finally fs.Free; end; i:= Pos('https://', wS); if i=0 then Exit; Result := Copy(wS, i, Length(wS)-i-1); end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.