function TForm1.Base64Decode(strInput:string):string;
var
strDecode : string;
posStart : Integer;
posEnd : Integer;
// IdDecoderMIME1: TIdDecoderMIME;
begin
while pos('=?gb2312?b?',lowercase(strInput))>0 do
begin
try
posStart:=pos('=?gb2312?b?',lowercase(strInput));
posEnd:=pos('?=',lowercase(strInput));
// strDecode:=strDecode+copy(strInput,1,posStart-1)+IdDecoderMIME1.DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
strDecode:=strDecode+copy(strInput,1,posStart-1)+ DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
strInput:=copy(strInput,posEnd+2,length(strInput)-posEnd-1);
finally
Application.ProcessMessages;
end;
end;
strDecode := strDecode + strInput;
result := strDecode;
end;
這是我在網路抄的代碼 ,可是
// strDecode:=strDecode+copy(strInput,1,posStart-1)+IdDecoderMIME1.DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
這句怎么也除錯不成功了,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,急,
uj5u.com熱心網友回復:
報什么錯呢?uj5u.com熱心網友回復:
IdDecoderMIME1: TIdDecoderMIME; 這個沒看到你創建啊
function TForm1.Base64Decode(strInput:string):string;
var
strDecode : string;
posStart : Integer;
posEnd : Integer;
IdDecoderMIME1: TIdDecoderMIME;
begin
IdDecoderMIME1:=TIdDecoderMIME.Create(nil);
while pos('=?gb2312?b?',lowercase(strInput))>0 do
begin
try
posStart:=pos('=?gb2312?b?',lowercase(strInput));
posEnd:=pos('?=',lowercase(strInput));
strDecode:=strDecode+copy(strInput,1,posStart-1)+IdDecoderMIME1.DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
strDecode:=strDecode+copy(strInput,1,posStart-1)+ DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
strInput:=copy(strInput,posEnd+2,length(strInput)-posEnd-1);
finally
Application.ProcessMessages;
end;
end;
strDecode := strDecode + strInput;
result := strDecode;
end;
uj5u.com熱心網友回復:
報的這個錯了undeclared identifier: 'TIdDecoderMIME'
前幾天出差,不好意思
uj5u.com熱心網友回復:
沒有參考EncdDecd 單元吧uj5u.com熱心網友回復:
已經參考了EncdDecd 的uj5u.com熱心網友回復:
EncdDecd 單元中有沒有TIdDecoderMIME類的定義?
uj5u.com熱心網友回復:
好像是的了unit EncdDecd;
interface
uses Classes;
procedure EncodeStream(Input, Output: TStream);
procedure DecodeStream(Input, Output: TStream);
function EncodeString(const Input: string): string;
function DecodeString(const Input: string): string;
uj5u.com熱心網友回復:
你使用的是Indy那個版本呢?uj5u.com熱心網友回復:
D6的企業版了uj5u.com熱心網友回復:
D6沒有,用UU或者XX那個試試轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/100375.html
標籤:VCL組件開發及應用
上一篇:delphi 7安裝dev express 控制元件
下一篇:delphi XE6 DLL問題
