获取网络文件的名字 (100分)

  • 主题发起人 主题发起人 温柔的邂逅
  • 开始时间 开始时间

温柔的邂逅

Unregistered / Unconfirmed
GUEST, unregistred user!
如:http://www.ddd.com.cn/fszjz/kkk.exe
怎样得到kkk.exe这个文件名,有现成的函数吗?
帮帮忙
谢谢喽
 
uses
wininet;
里面有很多 url操作函数,可以把一个url分解成很多部分
 
function parseURL(URL:String):String;
var
index:integer;
tmp:String;
begin
for index:=length(URL) downto 1 do
if URL[index]<>'/' then
tmp:=URL[Index]+tmp
else break;
result:=tmp;

end;
 
to :张无忌,
请问哪个函数能实现楼主的功能,请指教。
 
自己编个简单的函数也可以啊!
 
to :ZRWeng
你的方法很好,从后往前判断。
我想知道,是不是有系统函数。
 
//result:=tmp;
这样的结果是不是有点问题呢? 再仔细看看。[:D]
 
我说了你们可以找wininet里的url函数, 功能很强大,基本上没有什么BUG,找msdn也可以吗
这个大家应该都有的呀
 
一查wininet函数列表,很容易就知道那几个函数是的,除非不认识那些简单的E文
 
to :张无忌,
这是WinInet单元的函数列表,
请问哪个函数能实现楼主的功能,我看都不象啊!

function CommitUrlCacheEntry;
function CommitUrlCacheEntryA;
function CommitUrlCacheEntryW;
function CreateUrlCacheEntry;
function CreateUrlCacheEntryA;
function CreateUrlCacheEntryW;
function DeleteUrlCacheEntry;
function FindCloseUrlCache;
function FindFirstUrlCacheEntry;
function FindFirstUrlCacheEntryA;
function FindFirstUrlCacheEntryW;
function FindNextUrlCacheEntry;
function FindNextUrlCacheEntryA;
function FindNextUrlCacheEntryW;
function FtpCommand;
function FtpCommandA;
function FtpCommandW;
function FtpCreateDirectory;
function FtpCreateDirectoryA;
function FtpCreateDirectoryW;
function FtpDeleteFile;
function FtpDeleteFileA;
function FtpDeleteFileW;
function FtpFindFirstFile;
function FtpFindFirstFileA;
function FtpFindFirstFileW;
function FtpGetCurrentDirectory;
function FtpGetCurrentDirectoryA;
function FtpGetCurrentDirectoryW;
function FtpGetFile;
function FtpGetFileA;
function FtpGetFileW;
function FtpOpenFile;
function FtpOpenFileA;
function FtpOpenFileW;
function FtpPutFile;
function FtpPutFileA;
function FtpPutFileW;
function FtpRemoveDirectory;
function FtpRemoveDirectoryA;
function FtpRemoveDirectoryW;
function FtpRenameFile;
function FtpRenameFileA;
function FtpRenameFileW;
function FtpSetCurrentDirectory;
function FtpSetCurrentDirectoryA;
function FtpSetCurrentDirectoryW;
function FtpGetFileSize;
function GetUrlCacheEntryInfo;
function GetUrlCacheEntryInfoA;
function GetUrlCacheEntryInfoW;
function GopherCreateLocator;
function GopherCreateLocatorA;
function GopherCreateLocatorW;
function GopherFindFirstFile;
function GopherFindFirstFileA;
function GopherFindFirstFileW;
function GopherGetAttribute;
function GopherGetAttributeA;
function GopherGetAttributeW;
function GopherGetLocatorType;
function GopherGetLocatorTypeA;
function GopherGetLocatorTypeW;
function GopherOpenFile;
function GopherOpenFileA;
function GopherOpenFileW;
function HttpAddRequestHeaders;
function HttpAddRequestHeadersA;
function HttpAddRequestHeadersW;
function HttpOpenRequest;
function HttpOpenRequestA;
function HttpOpenRequestW;
function HttpQueryInfo;
function HttpQueryInfoA;
function HttpQueryInfoW;
function HttpSendRequest;
function HttpSendRequestA;
function HttpSendRequestW;
function InternetCanonicalizeUrl;
function InternetCanonicalizeUrlA;
function InternetCanonicalizeUrlW;
function InternetCloseHandle;
function InternetCombineUrl;
function InternetCombineUrlA;
function InternetCombineUrlW;
function InternetConfirmZoneCrossing
function InternetConnect;
function InternetConnectA;
function InternetConnectW;
function InternetCrackUrl;
function InternetCrackUrlA;
function InternetCrackUrlW;
function InternetCreateUrl;
function InternetCreateUrlA;
function InternetCreateUrlW;
function InternetErrorDlg;
function InternetFindNextFile;
function InternetFindNextFileA;
function InternetFindNextFileW;
function InternetGetCookie;
function InternetGetCookieA;
function InternetGetCookieW;
function InternetGetLastResponseInfo
function InternetGetLastResponseInfo
function InternetGetLastResponseInfo
function InternetOpen;
function InternetOpenA;
function InternetOpenW;
function InternetOpenUrl;
function InternetOpenUrlA;
function InternetOpenUrlW;
function InternetQueryDataAvailable;
function InternetQueryOption;
function InternetQueryOptionA;
function InternetQueryOptionW;
function InternetReadFile;
function InternetSetCookie;
function InternetSetCookieA;
function InternetSetCookieW;
function InternetSetFilePointer;
function InternetSetOption;
function InternetSetOptionA;
function InternetSetOptionW;
function InternetSetOptionEx;
function InternetSetOptionExA;
function InternetSetOptionExW;
function InternetSetStatusCallback;
function InternetTimeFromSystemTime;
function InternetWriteFile;
function ReadUrlCacheEntryStream;
function RetrieveUrlCacheEntryFile;
function RetrieveUrlCacheEntryFileA;
function RetrieveUrlCacheEntryFileW;
function RetrieveUrlCacheEntryStream
function RetrieveUrlCacheEntryStream
function RetrieveUrlCacheEntryStream
function SetUrlCacheEntryInfo;
function SetUrlCacheEntryInfoA;
function SetUrlCacheEntryInfoW;
function UnlockUrlCacheEntryFile;
function UnlockUrlCacheEntryStream;

function CreateUrlCacheGroup;
function DeleteUrlCacheGroup;
function FindFirstUrlCacheEntryEx;
function FindFirstUrlCacheEntryExA;
function FindFirstUrlCacheEntryExW;
function FindNextUrlCacheEntryEx;
function FindNextUrlCacheEntryExA;
function FindNextUrlCacheEntryExW;
function GetUrlCacheEntryInfoEx;
function GetUrlCacheEntryInfoExA;
function GetUrlCacheEntryInfoExW;
function HttpEndRequest;
function HttpEndRequestA;
function HttpEndRequestW;
function InternetAttemptConnect;
function InternetAuthNotifyCallback;
function InternetAutodial;
function InternetAutodialHangup;
function InternetCheckConnection;
function InternetCheckConnectionA;
function InternetCheckConnectionW;
function InternetDial;
function InternetGetConnectedState;
function InternetGoOnline;
function InternetHangUp;
function InternetLockRequestFile;
function InternetReadFileEx;
function InternetReadFileExA;
function InternetReadFileExW;
function InternetSetDialState;
function InternetUnlockRequestFile;
function SetUrlCacheEntryGroup;
function HttpSendRequestEx;
function HttpSendRequestExA;
function HttpSendRequestExW;
 
function GetUrlCacheEntryInfoEx;
function GetUrlCacheEntryInfoExA;
 
to :张无忌
我是菜鸟,这个函数的参数如此多,请举个例子说明一下。
PInternetCacheEntryInfo 这是个结构体,是不是要赋值;
用这个函数实现太麻烦了吧。


function GetUrlCacheEntryInfoEx(
lpszUrl: PAnsiChar;
lpCacheEntryInfo: PInternetCacheEntryInfo;
lpdwCacheEntryInfoBufSize: LPDWORD;
lpszReserved: PAnsiChar; { must pass nil }
lpdwReserved: LPDWORD; { must pass nil }
lpReserved: Pointer; { must pass nil }
dwFlags: DWORD { reserved }
): BOOL; stdcall;
 
例子可以看MSDN里的DEMO什么的
 
不好意思,请问哪里可以下载到DELPHI的MSDN帮助。
 
唉,一个函数搞得如此麻烦~
 
function TForm1.getFileNameInUrl(url:String):String;
var
k,pos0:integer;
begin
pos0:=-1; result:='';
for k:=length(url) downTo 1 do
if url[k]='/' then
begin
pos0:=k+1;
break;
end;
if pos0>0 then result:=copy(url,pos0,length(url));
end;
 
樓主不止下問,張生不止回答,好精神,大富翁精神!!
 
看看ExtractFileName, ExtractFilePath是怎么实现的。。。
 
后退
顶部