谢谢各位```
6 个解决方案
#1
是获取图片还是获取验证码识别出字符?
#2
识别出字符暂时还不太现实 只要获取图片就可以了 yzty 有什么好办法吗?
#3
用WebBrowse,简单:
function TForm1.GetLocalImg(key:string): Boolean;
Var
lpEntryInfo: PInternetCacheEntryInfo;
dwEntrySize, dwLastError, Hwd: LongWord;
Begin
Result := false;
dwEntrySize := 0;
FindFirstUrlCacheEntry(Nil, TInternetCacheEntryInfo(Nil^), dwEntrySize);
GetMem(lpEntryInfo, dwEntrySize);
Hwd := FindFirstUrlCacheEntry(Nil, lpEntryInfo^, dwEntrySize);
If Hwd <> 0 Then
Begin
Repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(Hwd, TInternetCacheEntryInfo(Nil^), dwEntrySize);
dwLastError := GetLastError();
If dwLastError = ERROR_INSUFFICIENT_BUFFER Then
Begin
GetMem(lpEntryInfo, dwEntrySize);
If FindNextUrlCacheEntry(Hwd, lpEntryInfo^, dwEntrySize) Then
Begin
//这里的key可以传入验证码的url的特征部分,图片格式你自己看看是什么,这里是jpg
If Pos(UpperCase(key), UpperCase(lpEntryInfo.lpszSourceUrlName)) > 0 Then
If (FileExists(lpEntryInfo.lpszLocalFileName)) And (UpperCase(ExtractFileExt(lpEntryInfo.lpszLocalFileName)) = '.JPG') Then
Begin
Image.Picture.LoadFromFile(lpEntryInfo.lpszLocalFileName);
Result := true;
Break;
End;
End;
End;
application.ProcessMessages;
Until (dwLastError = ERROR_NO_MORE_ITEMS);
End;
FreeMem(lpEntryInfo);
FindCloseUrlCache(Hwd);
end;
function TForm1.GetLocalImg(key:string): Boolean;
Var
lpEntryInfo: PInternetCacheEntryInfo;
dwEntrySize, dwLastError, Hwd: LongWord;
Begin
Result := false;
dwEntrySize := 0;
FindFirstUrlCacheEntry(Nil, TInternetCacheEntryInfo(Nil^), dwEntrySize);
GetMem(lpEntryInfo, dwEntrySize);
Hwd := FindFirstUrlCacheEntry(Nil, lpEntryInfo^, dwEntrySize);
If Hwd <> 0 Then
Begin
Repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(Hwd, TInternetCacheEntryInfo(Nil^), dwEntrySize);
dwLastError := GetLastError();
If dwLastError = ERROR_INSUFFICIENT_BUFFER Then
Begin
GetMem(lpEntryInfo, dwEntrySize);
If FindNextUrlCacheEntry(Hwd, lpEntryInfo^, dwEntrySize) Then
Begin
//这里的key可以传入验证码的url的特征部分,图片格式你自己看看是什么,这里是jpg
If Pos(UpperCase(key), UpperCase(lpEntryInfo.lpszSourceUrlName)) > 0 Then
If (FileExists(lpEntryInfo.lpszLocalFileName)) And (UpperCase(ExtractFileExt(lpEntryInfo.lpszLocalFileName)) = '.JPG') Then
Begin
Image.Picture.LoadFromFile(lpEntryInfo.lpszLocalFileName);
Result := true;
Break;
End;
End;
End;
application.ProcessMessages;
Until (dwLastError = ERROR_NO_MORE_ITEMS);
End;
FreeMem(lpEntryInfo);
FindCloseUrlCache(Hwd);
end;
#4
2003 再说一下这段代码需要用到的uses 可以吗
总是出现Undeclared identifier编译错误
多谢了
总是出现Undeclared identifier编译错误
多谢了
#5
还有 怎么把分送给帮助过我的朋友 我刚来这个论坛没多久 好多功能不熟悉``
#6
uses WinInet;
#1
是获取图片还是获取验证码识别出字符?
#2
识别出字符暂时还不太现实 只要获取图片就可以了 yzty 有什么好办法吗?
#3
用WebBrowse,简单:
function TForm1.GetLocalImg(key:string): Boolean;
Var
lpEntryInfo: PInternetCacheEntryInfo;
dwEntrySize, dwLastError, Hwd: LongWord;
Begin
Result := false;
dwEntrySize := 0;
FindFirstUrlCacheEntry(Nil, TInternetCacheEntryInfo(Nil^), dwEntrySize);
GetMem(lpEntryInfo, dwEntrySize);
Hwd := FindFirstUrlCacheEntry(Nil, lpEntryInfo^, dwEntrySize);
If Hwd <> 0 Then
Begin
Repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(Hwd, TInternetCacheEntryInfo(Nil^), dwEntrySize);
dwLastError := GetLastError();
If dwLastError = ERROR_INSUFFICIENT_BUFFER Then
Begin
GetMem(lpEntryInfo, dwEntrySize);
If FindNextUrlCacheEntry(Hwd, lpEntryInfo^, dwEntrySize) Then
Begin
//这里的key可以传入验证码的url的特征部分,图片格式你自己看看是什么,这里是jpg
If Pos(UpperCase(key), UpperCase(lpEntryInfo.lpszSourceUrlName)) > 0 Then
If (FileExists(lpEntryInfo.lpszLocalFileName)) And (UpperCase(ExtractFileExt(lpEntryInfo.lpszLocalFileName)) = '.JPG') Then
Begin
Image.Picture.LoadFromFile(lpEntryInfo.lpszLocalFileName);
Result := true;
Break;
End;
End;
End;
application.ProcessMessages;
Until (dwLastError = ERROR_NO_MORE_ITEMS);
End;
FreeMem(lpEntryInfo);
FindCloseUrlCache(Hwd);
end;
function TForm1.GetLocalImg(key:string): Boolean;
Var
lpEntryInfo: PInternetCacheEntryInfo;
dwEntrySize, dwLastError, Hwd: LongWord;
Begin
Result := false;
dwEntrySize := 0;
FindFirstUrlCacheEntry(Nil, TInternetCacheEntryInfo(Nil^), dwEntrySize);
GetMem(lpEntryInfo, dwEntrySize);
Hwd := FindFirstUrlCacheEntry(Nil, lpEntryInfo^, dwEntrySize);
If Hwd <> 0 Then
Begin
Repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(Hwd, TInternetCacheEntryInfo(Nil^), dwEntrySize);
dwLastError := GetLastError();
If dwLastError = ERROR_INSUFFICIENT_BUFFER Then
Begin
GetMem(lpEntryInfo, dwEntrySize);
If FindNextUrlCacheEntry(Hwd, lpEntryInfo^, dwEntrySize) Then
Begin
//这里的key可以传入验证码的url的特征部分,图片格式你自己看看是什么,这里是jpg
If Pos(UpperCase(key), UpperCase(lpEntryInfo.lpszSourceUrlName)) > 0 Then
If (FileExists(lpEntryInfo.lpszLocalFileName)) And (UpperCase(ExtractFileExt(lpEntryInfo.lpszLocalFileName)) = '.JPG') Then
Begin
Image.Picture.LoadFromFile(lpEntryInfo.lpszLocalFileName);
Result := true;
Break;
End;
End;
End;
application.ProcessMessages;
Until (dwLastError = ERROR_NO_MORE_ITEMS);
End;
FreeMem(lpEntryInfo);
FindCloseUrlCache(Hwd);
end;
#4
2003 再说一下这段代码需要用到的uses 可以吗
总是出现Undeclared identifier编译错误
多谢了
总是出现Undeclared identifier编译错误
多谢了
#5
还有 怎么把分送给帮助过我的朋友 我刚来这个论坛没多久 好多功能不熟悉``
#6
uses WinInet;